From 1c91537c9f9669246713a5be628493ae2fc4899a Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 3 Mar 2016 17:12:58 -0500 Subject: Combine StrToInt methods. This Cl combines the two StrToInt implementations. In doing so I had to add some more overrides to toDecimalDigit() and add a isDecimalDigit(). BUG=pdfium:423 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1757283002 . --- fpdfsdk/src/javascript/PublicMethods.cpp | 2 +- fpdfsdk/src/javascript/util.cpp | 24 ------------------------ fpdfsdk/src/javascript/util.h | 2 -- 3 files changed, 1 insertion(+), 27 deletions(-) (limited to 'fpdfsdk/src') diff --git a/fpdfsdk/src/javascript/PublicMethods.cpp b/fpdfsdk/src/javascript/PublicMethods.cpp index f510d51d64..f228072b35 100644 --- a/fpdfsdk/src/javascript/PublicMethods.cpp +++ b/fpdfsdk/src/javascript/PublicMethods.cpp @@ -242,7 +242,7 @@ int CJS_PublicMethods::ParseStringInteger(const CFX_WideString& string, if (!FXSYS_iswdigit(c)) break; - nRet = nRet * 10 + FXSYS_toDecimalDigitWide(c); + nRet = nRet * 10 + FXSYS_toDecimalDigit(c); nSkip = i - nStart + 1; if (nSkip >= nMaxStep) break; diff --git a/fpdfsdk/src/javascript/util.cpp b/fpdfsdk/src/javascript/util.cpp index 4bc28cd03a..c9149be570 100644 --- a/fpdfsdk/src/javascript/util.cpp +++ b/fpdfsdk/src/javascript/util.cpp @@ -512,30 +512,6 @@ FX_BOOL util::scand(IJS_Context* cc, return TRUE; } -int64_t FX_atoi64(const char* nptr) { - int c; /* current char */ - int64_t total; /* current total */ - int sign; /* if '-', then negative, otherwise positive */ - - /* skip whitespace */ - while (isspace((int)(unsigned char)*nptr)) - ++nptr; - - c = (int)(unsigned char)*nptr++; - sign = c; /* save sign indication */ - if (c == '-' || c == '+') - c = (int)(unsigned char)*nptr++; /* skip sign */ - - total = 0; - - while (isdigit(c)) { - total = 10 * total + FXSYS_toDecimalDigit(c); /* accumulate digit */ - c = (int)(unsigned char)*nptr++; /* get next char */ - } - - return sign == '-' ? -total : total; -} - FX_BOOL util::byteToChar(IJS_Context* cc, const std::vector& params, CJS_Value& vRet, diff --git a/fpdfsdk/src/javascript/util.h b/fpdfsdk/src/javascript/util.h index 22a8358150..9441b11b13 100644 --- a/fpdfsdk/src/javascript/util.h +++ b/fpdfsdk/src/javascript/util.h @@ -63,6 +63,4 @@ class CJS_Util : public CJS_Object { JS_STATIC_METHOD(byteToChar, util); }; -int64_t FX_atoi64(const char* nptr); - #endif // FPDFSDK_SRC_JAVASCRIPT_UTIL_H_ -- cgit v1.2.3