PolicyManager: Move payload_size to int64_t.
Code style encourages signed types instead of unsigned types and the
value being exposed is already signed. This patch fixes that for the
payload_size variable and adapts the BoxedValue::ValuePrinter
implementations to use the int64_t and uint64_t types.
BUG=None
TEST=Unit tests updated
Change-Id: I21310c59d8c2654c43cac27265055c8577341562
Reviewed-on: https://chromium-review.googlesource.com/198269
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
diff --git a/policy_manager/boxed_value.cc b/policy_manager/boxed_value.cc
index 0cf7ed2..02bc0bd 100644
--- a/policy_manager/boxed_value.cc
+++ b/policy_manager/boxed_value.cc
@@ -28,31 +28,31 @@
}
template<>
+string BoxedValue::ValuePrinter<int>(const void *value) {
+ const int* val = reinterpret_cast<const int*>(value);
+ return base::IntToString(*val);
+}
+
+template<>
string BoxedValue::ValuePrinter<unsigned int>(const void *value) {
const unsigned int* val = reinterpret_cast<const unsigned int*>(value);
return base::UintToString(*val);
}
template<>
-string BoxedValue::ValuePrinter<unsigned long>(const void *value) {
- const unsigned long* val = reinterpret_cast<const unsigned long*>(value);
- return base::Uint64ToString(static_cast<uint64>(*val));
+string BoxedValue::ValuePrinter<int64_t>(const void *value) {
+ const int64_t* val = reinterpret_cast<const int64_t*>(value);
+ return base::Int64ToString(*val);
}
template<>
-string BoxedValue::ValuePrinter<unsigned long long>(const void *value) {
- const unsigned long long* val =
- reinterpret_cast<const unsigned long long*>(value);
+string BoxedValue::ValuePrinter<uint64_t>(const void *value) {
+ const uint64_t* val =
+ reinterpret_cast<const uint64_t*>(value);
return base::Uint64ToString(static_cast<uint64>(*val));
}
template<>
-string BoxedValue::ValuePrinter<int>(const void *value) {
- const int* val = reinterpret_cast<const int*>(value);
- return base::IntToString(*val);
-}
-
-template<>
string BoxedValue::ValuePrinter<bool>(const void *value) {
const bool* val = reinterpret_cast<const bool*>(value);
return *val ? "true" : "false";