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 /fpdfsdk/src/javascript/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 'fpdfsdk/src/javascript/util.cpp')
-rw-r--r-- | fpdfsdk/src/javascript/util.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fpdfsdk/src/javascript/util.cpp b/fpdfsdk/src/javascript/util.cpp index 14e15c1b6f..cf10bbd7b4 100644 --- a/fpdfsdk/src/javascript/util.cpp +++ b/fpdfsdk/src/javascript/util.cpp @@ -425,7 +425,7 @@ void util::printx(const std::string& cFormat, break; case 'X': { while (itSource < iSize) { - if ((cSource[itSource] >= '0' && cSource[itSource] <= '9') || + if (std::isdigit(cSource[itSource]) || (cSource[itSource] >= 'a' && cSource[itSource] <= 'z') || (cSource[itSource] >= 'A' && cSource[itSource] <= 'Z')) { cPurpose += cSource[itSource]; @@ -450,7 +450,7 @@ void util::printx(const std::string& cFormat, } break; case '9': { while (itSource < iSize) { - if (cSource[itSource] >= '0' && cSource[itSource] <= '9') { + if (std::isdigit(cSource[itSource])) { cPurpose += cSource[itSource]; itSource++; break; |