Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Unified Diff: fpdfsdk/src/javascript/util.cpp

Issue 1449873003: Reland "Cleanup some numeric code."" (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Fix windows build Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fpdfsdk/src/javascript/PublicMethods.cpp ('k') | pdfium.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/src/javascript/util.cpp
diff --git a/fpdfsdk/src/javascript/util.cpp b/fpdfsdk/src/javascript/util.cpp
index c021ec9e9552ea8a5854bfde47b893a6c00a3da3..30df53ea7292ee4a5010fd070179d7301a2ceac9 100644
--- a/fpdfsdk/src/javascript/util.cpp
+++ b/fpdfsdk/src/javascript/util.cpp
@@ -13,6 +13,7 @@
#include "JS_Runtime.h"
#include "JS_Value.h"
#include "PublicMethods.h"
+#include "core/include/fxcrt/fx_ext.h"
#include "fpdfsdk/include/javascript/IJavaScript.h"
#include "resource.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 */
}
« no previous file with comments | « fpdfsdk/src/javascript/PublicMethods.cpp ('k') | pdfium.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698