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

Unified Diff: base/sys_info_android.cc

Issue 1498003003: Remove kint64max. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: INT64_MAX 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 | « base/sys_info.cc ('k') | base/sys_info_chromeos.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/sys_info_android.cc
diff --git a/base/sys_info_android.cc b/base/sys_info_android.cc
index 0eeb581c93c46e916e0c927a6b78590f23d73281..4b923d1ac9494b21d40bcafc215651a0cba8f416 100644
--- a/base/sys_info_android.cc
+++ b/base/sys_info_android.cc
@@ -65,9 +65,9 @@ const int kDefaultAndroidBugfixVersion = 99;
// Parse out the OS version numbers from the system properties.
void ParseOSVersionNumbers(const char* os_version_str,
- int32 *major_version,
- int32 *minor_version,
- int32 *bugfix_version) {
+ int32_t* major_version,
+ int32_t* minor_version,
+ int32_t* bugfix_version) {
if (os_version_str[0]) {
// Try to parse out the version numbers from the string.
int num_read = sscanf(os_version_str, "%d.%d.%d", major_version,
@@ -90,13 +90,13 @@ void ParseOSVersionNumbers(const char* os_version_str,
// Parses a system property (specified with unit 'k','m' or 'g').
// Returns a value in bytes.
// Returns -1 if the string could not be parsed.
-int64 ParseSystemPropertyBytes(const base::StringPiece& str) {
- const int64 KB = 1024;
- const int64 MB = 1024 * KB;
- const int64 GB = 1024 * MB;
+int64_t ParseSystemPropertyBytes(const base::StringPiece& str) {
+ const int64_t KB = 1024;
+ const int64_t MB = 1024 * KB;
+ const int64_t GB = 1024 * MB;
if (str.size() == 0u)
return -1;
- int64 unit_multiplier = 1;
+ int64_t unit_multiplier = 1;
size_t length = str.size();
if (str[length - 1] == 'k') {
unit_multiplier = KB;
@@ -108,10 +108,11 @@ int64 ParseSystemPropertyBytes(const base::StringPiece& str) {
unit_multiplier = GB;
length--;
}
- int64 result = 0;
+ int64_t result = 0;
bool parsed = base::StringToInt64(str.substr(0, length), &result);
bool negative = result <= 0;
- bool overflow = result >= std::numeric_limits<int64>::max() / unit_multiplier;
+ bool overflow =
+ result >= std::numeric_limits<int64_t>::max() / unit_multiplier;
if (!parsed || negative || overflow)
return -1;
return result * unit_multiplier;
@@ -123,14 +124,15 @@ int GetDalvikHeapSizeMB() {
// dalvik.vm.heapsize property is writable by a root user.
// Clamp it to reasonable range as a sanity check,
// a typical android device will never have less than 48MB.
- const int64 MB = 1024 * 1024;
- int64 result = ParseSystemPropertyBytes(heap_size_str);
+ const int64_t MB = 1024 * 1024;
+ int64_t result = ParseSystemPropertyBytes(heap_size_str);
if (result == -1) {
// We should consider not exposing these values if they are not reliable.
LOG(ERROR) << "Can't parse dalvik.vm.heapsize: " << heap_size_str;
result = base::SysInfo::AmountOfPhysicalMemoryMB() / 3;
}
- result = std::min<int64>(std::max<int64>(32 * MB, result), 1024 * MB) / MB;
+ result =
+ std::min<int64_t>(std::max<int64_t>(32 * MB, result), 1024 * MB) / MB;
return static_cast<int>(result);
}
@@ -140,14 +142,14 @@ int GetDalvikHeapGrowthLimitMB() {
// dalvik.vm.heapgrowthlimit property is writable by a root user.
// Clamp it to reasonable range as a sanity check,
// a typical android device will never have less than 24MB.
- const int64 MB = 1024 * 1024;
- int64 result = ParseSystemPropertyBytes(heap_size_str);
+ const int64_t MB = 1024 * 1024;
+ int64_t result = ParseSystemPropertyBytes(heap_size_str);
if (result == -1) {
// We should consider not exposing these values if they are not reliable.
LOG(ERROR) << "Can't parse dalvik.vm.heapgrowthlimit: " << heap_size_str;
result = base::SysInfo::AmountOfPhysicalMemoryMB() / 6;
}
- result = std::min<int64>(std::max<int64>(16 * MB, result), 512 * MB) / MB;
+ result = std::min<int64_t>(std::max<int64_t>(16 * MB, result), 512 * MB) / MB;
return static_cast<int>(result);
}
@@ -166,14 +168,14 @@ std::string SysInfo::OperatingSystemName() {
}
std::string SysInfo::OperatingSystemVersion() {
- int32 major, minor, bugfix;
+ int32_t major, minor, bugfix;
OperatingSystemVersionNumbers(&major, &minor, &bugfix);
return StringPrintf("%d.%d.%d", major, minor, bugfix);
}
-void SysInfo::OperatingSystemVersionNumbers(int32* major_version,
- int32* minor_version,
- int32* bugfix_version) {
+void SysInfo::OperatingSystemVersionNumbers(int32_t* major_version,
+ int32_t* minor_version,
+ int32_t* bugfix_version) {
// Read the version number string out from the properties.
char os_version_str[PROP_VALUE_MAX];
__system_property_get("ro.build.version.release", os_version_str);
« no previous file with comments | « base/sys_info.cc ('k') | base/sys_info_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698