diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2015-10-29 14:56:26 -0400 |
---|---|---|
committer | Dan Sinclair <dsinclair@chromium.org> | 2015-10-29 14:56:26 -0400 |
commit | 589f7e0a57675efce9810c15a3e9b7c49bf0bc90 (patch) | |
tree | 6839707c05c00f227744ffc3788665cb1cb5b7bd /core/src/fxcrt/fx_basic_util.cpp | |
parent | 6ed0028f1cf12ee53e9e7f657b7ba186c77a42f3 (diff) | |
download | pdfium-589f7e0a57675efce9810c15a3e9b7c49bf0bc90.tar.xz |
Cleanup some numeric code.
This changes the various comparisons of char >= '0' && char <= '9' and
char < '0' || char > '9' to use std::isdigit checks. It also cleans up
a handful of hex to digit conversions to call one common method.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1415933005 .
Diffstat (limited to 'core/src/fxcrt/fx_basic_util.cpp')
-rw-r--r-- | core/src/fxcrt/fx_basic_util.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/core/src/fxcrt/fx_basic_util.cpp b/core/src/fxcrt/fx_basic_util.cpp index 46a0dec1e5..71119082a2 100644 --- a/core/src/fxcrt/fx_basic_util.cpp +++ b/core/src/fxcrt/fx_basic_util.cpp @@ -101,13 +101,13 @@ void FX_atonum(const CFX_ByteStringC& strc, FX_BOOL& bInteger, void* pData) { cc++; } while (cc < len) { - if (str[cc] < '0' || str[cc] > '9') { + if (!std::isdigit(str[cc])) break; - } + integer = integer * 10 + str[cc] - '0'; - if (integer < 0) { + if (integer < 0) break; - } + cc++; } if (bNegative) { |