summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2017-04-20 21:41:36 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-04-21 04:53:07 +0000
commite247ec47b75d45d16298e4e11ba68745b9ebe3eb (patch)
treee121024f171c04c928459b258b8cae1c1b9d0b56 /fpdfsdk
parent1badb85e5c3a4b4cd42ca1a2b223d6b3bc67cc4a (diff)
downloadpdfium-e247ec47b75d45d16298e4e11ba68745b9ebe3eb.tar.xz
Replace FXSYS_iswdigit with std::iswdigit.
Replace other one-off implementations as well. Change-Id: I2878f3fae479c12b7de5234ee3a26477d602d14d Reviewed-on: https://pdfium-review.googlesource.com/4398 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/javascript/PublicMethods.cpp39
-rw-r--r--fpdfsdk/javascript/util.cpp3
2 files changed, 18 insertions, 24 deletions
diff --git a/fpdfsdk/javascript/PublicMethods.cpp b/fpdfsdk/javascript/PublicMethods.cpp
index b3495375e0..759fd91a4d 100644
--- a/fpdfsdk/javascript/PublicMethods.cpp
+++ b/fpdfsdk/javascript/PublicMethods.cpp
@@ -7,6 +7,7 @@
#include "fpdfsdk/javascript/PublicMethods.h"
#include <algorithm>
+#include <cwctype>
#include <iomanip>
#include <limits>
#include <sstream>
@@ -135,12 +136,10 @@ bool CJS_PublicMethods::IsNumber(const CFX_WideString& str) {
p++;
c = *p;
- if (c == L'+' || c == L'-') {
- bKXJS = true;
- } else {
+ if (c != L'+' && c != L'-')
return false;
- }
- } else if (!FXSYS_iswdigit(c)) {
+ bKXJS = true;
+ } else if (!std::iswdigit(c)) {
return false;
}
p++;
@@ -152,7 +151,7 @@ bool CJS_PublicMethods::IsNumber(const CFX_WideString& str) {
bool CJS_PublicMethods::maskSatisfied(wchar_t c_Change, wchar_t c_Mask) {
switch (c_Mask) {
case L'9':
- return FXSYS_iswdigit(c_Change);
+ return !!std::iswdigit(c_Change);
case L'A':
return FXSYS_iswalpha(c_Change);
case L'O':
@@ -236,7 +235,7 @@ int CJS_PublicMethods::ParseStringInteger(const CFX_WideString& str,
break;
wchar_t c = str.GetAt(i);
- if (!FXSYS_iswdigit(c))
+ if (!std::iswdigit(c))
break;
nRet = nRet * 10 + FXSYS_toDecimalDigit(c);
@@ -255,7 +254,7 @@ CFX_WideString CJS_PublicMethods::ParseStringString(const CFX_WideString& str,
nSkip = 0;
for (int i = nStart, sz = str.GetLength(); i < sz; i++) {
wchar_t c = str.GetAt(i);
- if (!FXSYS_iswdigit(c))
+ if (!std::iswdigit(c))
break;
swRet += c;
@@ -287,7 +286,7 @@ double CJS_PublicMethods::ParseNormalDate(const CFX_WideString& value,
break;
wchar_t c = value.GetAt(i);
- if (FXSYS_iswdigit(c)) {
+ if (std::iswdigit(c)) {
number[nIndex++] = ParseStringInteger(value, i, nSkip, 4);
i += nSkip;
} else {
@@ -937,8 +936,7 @@ bool CJS_PublicMethods::AFNumber_Keystroke(CJS_Runtime* pRuntime,
if (bHasSign) {
// can't insert "change" in front to sign postion.
if (pEvent->SelStart() == 0) {
- bool& bRc = pEvent->Rc();
- bRc = false;
+ pEvent->Rc() = false;
return true;
}
}
@@ -952,8 +950,7 @@ bool CJS_PublicMethods::AFNumber_Keystroke(CJS_Runtime* pRuntime,
for (FX_STRSIZE i = 0; i < wstrChange.GetLength(); ++i) {
if (wstrChange[i] == cSep) {
if (bHasSep) {
- bool& bRc = pEvent->Rc();
- bRc = false;
+ pEvent->Rc() = false;
return true;
}
bHasSep = true;
@@ -961,28 +958,24 @@ bool CJS_PublicMethods::AFNumber_Keystroke(CJS_Runtime* pRuntime,
}
if (wstrChange[i] == L'-') {
if (bHasSign) {
- bool& bRc = pEvent->Rc();
- bRc = false;
+ pEvent->Rc() = false;
return true;
}
// sign's position is not correct
if (i != 0) {
- bool& bRc = pEvent->Rc();
- bRc = false;
+ pEvent->Rc() = false;
return true;
}
if (pEvent->SelStart() != 0) {
- bool& bRc = pEvent->Rc();
- bRc = false;
+ pEvent->Rc() = false;
return true;
}
bHasSign = true;
continue;
}
- if (!FXSYS_iswdigit(wstrChange[i])) {
- bool& bRc = pEvent->Rc();
- bRc = false;
+ if (!std::iswdigit(wstrChange[i])) {
+ pEvent->Rc() = false;
return true;
}
}
@@ -1775,7 +1768,7 @@ bool CJS_PublicMethods::AFExtractNums(CJS_Runtime* pRuntime,
CJS_Array nums;
int nIndex = 0;
for (const auto& wc : str) {
- if (FXSYS_iswdigit(wc)) {
+ if (std::iswdigit(wc)) {
sPart += wc;
} else if (sPart.GetLength() > 0) {
nums.SetElement(pRuntime, nIndex, CJS_Value(pRuntime, sPart.c_str()));
diff --git a/fpdfsdk/javascript/util.cpp b/fpdfsdk/javascript/util.cpp
index 4303342064..dc34119c38 100644
--- a/fpdfsdk/javascript/util.cpp
+++ b/fpdfsdk/javascript/util.cpp
@@ -9,6 +9,7 @@
#include <time.h>
#include <algorithm>
+#include <cwctype>
#include <string>
#include <vector>
@@ -93,7 +94,7 @@ int ParseDataType(std::wstring* sFormat) {
return UTIL_STRING;
}
if (c == L'.' || c == L'+' || c == L'-' || c == L'#' || c == L' ' ||
- FXSYS_iswdigit(c)) {
+ std::iswdigit(c)) {
continue;
}
break;