summaryrefslogtreecommitdiff
path: root/common/util.c
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2012-02-10 16:11:30 -0800
committerBill Richardson <wfrichar@chromium.org>2012-02-10 16:11:30 -0800
commit6e1cdb789851051167e5021ec9a2a4484deaf234 (patch)
tree6d584d05a8538900c201a7e4b0c9e5627cb34b8b /common/util.c
parentee7fce76b032f2a5f94f122e8214e9cfc8790f62 (diff)
downloadchrome-ec-6e1cdb789851051167e5021ec9a2a4484deaf234.tar.gz
Make strtoi() do the right thing for base==16
Before, strtoi("11", 0, 16) returned 11. Now, strtoi("11", 0, 16) returns 17. BUG=none TEST=none
Diffstat (limited to 'common/util.c')
-rw-r--r--common/util.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/common/util.c b/common/util.c
index 885d830175..40908cc5ce 100644
--- a/common/util.c
+++ b/common/util.c
@@ -88,11 +88,11 @@ int strtoi(const char *nptr, char **endptr, int base)
while((c = *nptr++) && isspace(c)) {}
- if (c == '0' && *nptr == 'x' && (base == 0 || base == 16)) {
+ if (c == '0' && *nptr == 'x') {
base = 16;
c = nptr[1];
nptr += 2;
- } else {
+ } else if (base == 0) {
base = 10;
if (c == '-') {
neg = 1;