summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/javascript/util.cpp
diff options
context:
space:
mode:
authordan sinclair <dsinclair@chromium.org>2015-11-10 13:17:58 -0500
committerdan sinclair <dsinclair@chromium.org>2015-11-10 13:17:58 -0500
commitb27902b8995bb3e003daed6b0811ed746763c68d (patch)
tree26817dd2ff198b9c93db85724171766b87077a54 /fpdfsdk/src/javascript/util.cpp
parentc813e21d261c24867234107f2e2ca72e15cb2534 (diff)
downloadpdfium-b27902b8995bb3e003daed6b0811ed746763c68d.tar.xz
Revert "Revert "Revert "Revert "Cleanup some numeric code.""""
This reverts commit da06e60fb5a095a91c9a4f509466667878624cb3. 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=tsepez@chromium.org Review URL: https://codereview.chromium.org/1433513002 .
Diffstat (limited to 'fpdfsdk/src/javascript/util.cpp')
-rw-r--r--fpdfsdk/src/javascript/util.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/fpdfsdk/src/javascript/util.cpp b/fpdfsdk/src/javascript/util.cpp
index 14e15c1b6f..fc94a0e393 100644
--- a/fpdfsdk/src/javascript/util.cpp
+++ b/fpdfsdk/src/javascript/util.cpp
@@ -6,6 +6,7 @@
#include "util.h"
+#include "../../../core/include/fxcrt/fx_ext.h"
#include "../../include/javascript/IJavaScript.h"
#include "JS_Context.h"
#include "JS_Define.h"
@@ -425,7 +426,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 +451,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;
@@ -531,7 +532,7 @@ int64_t FX_atoi64(const char* nptr) {
total = 0;
while (isdigit(c)) {
- total = 10 * total + (c - '0'); /* accumulate digit */
+ total = 10 * total + FXSYS_toDecimalDigit(c); /* accumulate digit */
c = (int)(unsigned char)*nptr++; /* get next char */
}