diff --git a/base/include/android-base/parseint.h b/base/include/android-base/parseint.h index ed75e2d48..7415409c0 100644 --- a/base/include/android-base/parseint.h +++ b/base/include/android-base/parseint.h @@ -31,7 +31,7 @@ namespace base { template bool ParseUint(const char* s, T* out, T max = std::numeric_limits::max()) { - int base = (s[0] == '0' && s[1] == 'x') ? 16 : 10; + int base = (s[0] == '0' && (s[1] == 'x' || s[1] == 'X')) ? 16 : 10; errno = 0; char* end; unsigned long long int result = strtoull(s, &end, base); @@ -53,7 +53,7 @@ template bool ParseInt(const char* s, T* out, T min = std::numeric_limits::min(), T max = std::numeric_limits::max()) { - int base = (s[0] == '0' && s[1] == 'x') ? 16 : 10; + int base = (s[0] == '0' && (s[1] == 'x' || s[1] == 'X')) ? 16 : 10; errno = 0; char* end; long long int result = strtoll(s, &end, base);