Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Unified Diff: components/proximity_auth/metrics.cc

Issue 1551433002: Switch to standard integer types in components/, part 3 of 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/proximity_auth/metrics.cc
diff --git a/components/proximity_auth/metrics.cc b/components/proximity_auth/metrics.cc
index 1e388032ec747d02d6a228e748ab73a6225bf341..b8ceb1f676129dbdc69bb2ee1cea461ca5ada174 100644
--- a/components/proximity_auth/metrics.cc
+++ b/components/proximity_auth/metrics.cc
@@ -4,9 +4,12 @@
#include "components/proximity_auth/metrics.h"
+#include <stdint.h>
+
#include <algorithm>
#include "base/logging.h"
+#include "base/macros.h"
#include "base/md5.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/sparse_histogram.h"
@@ -17,24 +20,24 @@ namespace metrics {
namespace {
-// Converts the 4-byte prefix of an MD5 hash into a int32 value.
-int32 DigestToInt32(const base::MD5Digest& digest) {
- // First, copy to a uint32, since byte swapping and endianness conversions
+// Converts the 4-byte prefix of an MD5 hash into a int32_t value.
+int32_t DigestToInt32(const base::MD5Digest& digest) {
+ // First, copy to a uint32_t, since byte swapping and endianness conversions
// expect unsigned integers.
- uint32 unsigned_value;
+ uint32_t unsigned_value;
DCHECK_GE(arraysize(digest.a), sizeof(unsigned_value));
memcpy(&unsigned_value, digest.a, sizeof(unsigned_value));
unsigned_value = base::ByteSwap(base::HostToNet32(unsigned_value));
- // Then copy the resulting bit pattern to an int32 to match the datatype that
- // histograms expect.
- int32 value;
+ // Then copy the resulting bit pattern to an int32_t to match the datatype
+ // that histograms expect.
+ int32_t value;
memcpy(&value, &unsigned_value, sizeof(value));
return value;
}
// Returns a hash of the given |name|, encoded as a 32-bit signed integer.
-int32 HashDeviceModelName(const std::string& name) {
+int32_t HashDeviceModelName(const std::string& name) {
base::MD5Digest digest;
base::MD5Sum(name.c_str(), name.size(), &digest);
return DigestToInt32(digest);
« no previous file with comments | « components/proximity_auth/logging/logging_unittest.cc ('k') | components/proximity_auth/mock_proximity_auth_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698