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

Unified Diff: chromeos/dbus/cros_disks_client.cc

Issue 1540803002: Switch to standard integer types in chromeos/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more includes 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
« no previous file with comments | « chromeos/dbus/cros_disks_client.h ('k') | chromeos/dbus/cros_disks_client_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/dbus/cros_disks_client.cc
diff --git a/chromeos/dbus/cros_disks_client.cc b/chromeos/dbus/cros_disks_client.cc
index fafbdec79e8286f21e482b796792b7a082a8a665..eee2f7284cec3ca9d148bcf0819d7f69537567fc 100644
--- a/chromeos/dbus/cros_disks_client.cc
+++ b/chromeos/dbus/cros_disks_client.cc
@@ -4,12 +4,16 @@
#include "chromeos/dbus/cros_disks_client.h"
+#include <stddef.h>
+#include <stdint.h>
+
#include <map>
#include "base/bind.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/location.h"
+#include "base/macros.h"
#include "base/stl_util.h"
#include "base/strings/stringprintf.h"
#include "base/sys_info.h"
@@ -44,14 +48,14 @@ const char kLazyUnmountOption[] = "lazy";
const char kMountLabelOption[] = "mountlabel";
// Checks if retrieved media type is in boundaries of DeviceMediaType.
-bool IsValidMediaType(uint32 type) {
- return type < static_cast<uint32>(cros_disks::DEVICE_MEDIA_NUM_VALUES);
+bool IsValidMediaType(uint32_t type) {
+ return type < static_cast<uint32_t>(cros_disks::DEVICE_MEDIA_NUM_VALUES);
}
// Translates enum used in cros-disks to enum used in Chrome.
// Note that we could just do static_cast, but this is less sensitive to
// changes in cros-disks.
-DeviceType DeviceMediaTypeToDeviceType(uint32 media_type_uint32) {
+DeviceType DeviceMediaTypeToDeviceType(uint32_t media_type_uint32) {
if (!IsValidMediaType(media_type_uint32))
return DEVICE_TYPE_UNKNOWN;
@@ -77,9 +81,9 @@ DeviceType DeviceMediaTypeToDeviceType(uint32 media_type_uint32) {
}
bool ReadMountEntryFromDbus(dbus::MessageReader* reader, MountEntry* entry) {
- uint32 error_code = 0;
+ uint32_t error_code = 0;
std::string source_path;
- uint32 mount_type = 0;
+ uint32_t mount_type = 0;
std::string mount_path;
if (!reader->PopUint32(&error_code) ||
!reader->PopString(&source_path) ||
@@ -310,7 +314,7 @@ class CrosDisksClientImpl : public CrosDisksClient {
// make this fail if reader is not able to read the error code value from
// the response.
dbus::MessageReader reader(response);
- uint32 error_code = 0;
+ uint32_t error_code = 0;
if (reader.PopUint32(&error_code) &&
static_cast<MountError>(error_code) != MOUNT_ERROR_NONE) {
error_callback.Run();
@@ -426,7 +430,7 @@ class CrosDisksClientImpl : public CrosDisksClient {
// Handles FormatCompleted signal and calls |handler|.
void OnFormatCompleted(FormatCompletedHandler handler, dbus::Signal* signal) {
dbus::MessageReader reader(signal);
- uint32 error_code = 0;
+ uint32_t error_code = 0;
std::string device_path;
if (!reader.PopUint32(&error_code) || !reader.PopString(&device_path)) {
LOG(ERROR) << "Invalid signal: " << signal->ToString();
@@ -519,7 +523,7 @@ DiskInfo::~DiskInfo() {
// }
// dict entry {
// string "DeviceMediaType"
-// variant uint32 1
+// variant uint32_t 1
// }
// dict entry {
// string "DeviceMountPaths"
@@ -532,7 +536,7 @@ DiskInfo::~DiskInfo() {
// }
// dict entry {
// string "DeviceSize"
-// variant uint64 7998537728
+// variant uint64_t 7998537728
// }
// dict entry {
// string "DriveIsRotational"
@@ -606,15 +610,16 @@ void DiskInfo::InitializeFromResponse(dbus::Response* response) {
properties->GetStringWithoutPathExpansion(cros_disks::kIdLabel, &label_);
properties->GetStringWithoutPathExpansion(cros_disks::kIdUuid, &uuid_);
- // dbus::PopDataAsValue() pops uint64 as double.
- // The top 11 bits of uint64 are dropped by the use of double. But, this works
+ // dbus::PopDataAsValue() pops uint64_t as double.
+ // The top 11 bits of uint64_t are dropped by the use of double. But, this
+ // works
// unless the size exceeds 8 PB.
double device_size_double = 0;
if (properties->GetDoubleWithoutPathExpansion(cros_disks::kDeviceSize,
&device_size_double))
total_size_in_bytes_ = device_size_double;
- // dbus::PopDataAsValue() pops uint32 as double.
+ // dbus::PopDataAsValue() pops uint32_t as double.
double media_type_double = 0;
if (properties->GetDoubleWithoutPathExpansion(cros_disks::kDeviceMediaType,
&media_type_double))
« no previous file with comments | « chromeos/dbus/cros_disks_client.h ('k') | chromeos/dbus/cros_disks_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698