Merge "Add 0X as a valid hex prefix for parseint" am: 392a2c8f0f
am: 11373394fd
am: 92b1727472
Change-Id: I054cbb995db521669f474a6e484f71933f4d6e91
This commit is contained in:
commit
35146c467d
|
@ -31,7 +31,7 @@ namespace base {
|
|||
template <typename T>
|
||||
bool ParseUint(const char* s, T* out,
|
||||
T max = std::numeric_limits<T>::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 <typename T>
|
|||
bool ParseInt(const char* s, T* out,
|
||||
T min = std::numeric_limits<T>::min(),
|
||||
T max = std::numeric_limits<T>::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);
|
||||
|
|
Loading…
Reference in New Issue