summaryrefslogtreecommitdiff
path: root/fpdfsdk/javascript
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2017-04-24 16:28:07 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-04-25 00:07:29 +0000
commitef002c85521278e3082517297cf60372d7751cb1 (patch)
treebe0148d89603262c1bf11f16621a1c43509759db /fpdfsdk/javascript
parent3684a151e76991bc67dd397cba66b0620cc38bae (diff)
downloadpdfium-ef002c85521278e3082517297cf60372d7751cb1.tar.xz
Use fx_extension.h utilities in more places.
Change-Id: Iba1aa793567e69acc3cc1acbd5b9a9f531c80b7a Reviewed-on: https://pdfium-review.googlesource.com/4453 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fpdfsdk/javascript')
-rw-r--r--fpdfsdk/javascript/util.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/fpdfsdk/javascript/util.cpp b/fpdfsdk/javascript/util.cpp
index dc34119c38..bc968a59d9 100644
--- a/fpdfsdk/javascript/util.cpp
+++ b/fpdfsdk/javascript/util.cpp
@@ -321,9 +321,9 @@ bool util::printx(CJS_Runtime* pRuntime,
enum CaseMode { kPreserveCase, kUpperCase, kLowerCase };
static wchar_t TranslateCase(wchar_t input, CaseMode eMode) {
- if (eMode == kLowerCase && input >= 'A' && input <= 'Z')
+ if (eMode == kLowerCase && FXSYS_isupper(input))
return input | 0x20;
- if (eMode == kUpperCase && input >= 'a' && input <= 'z')
+ if (eMode == kUpperCase && FXSYS_islower(input))
return input & ~0x20;
return input;
}
@@ -368,9 +368,7 @@ CFX_WideString util::printx(const CFX_WideString& wsFormat,
} break;
case 'X': {
if (iSourceIdx < wsSource.GetLength()) {
- if ((wsSource[iSourceIdx] >= '0' && wsSource[iSourceIdx] <= '9') ||
- (wsSource[iSourceIdx] >= 'a' && wsSource[iSourceIdx] <= 'z') ||
- (wsSource[iSourceIdx] >= 'A' && wsSource[iSourceIdx] <= 'Z')) {
+ if (FXSYS_iswalnum(wsSource[iSourceIdx])) {
wsResult += TranslateCase(wsSource[iSourceIdx], eCaseMode);
++iFormatIdx;
}
@@ -381,8 +379,7 @@ CFX_WideString util::printx(const CFX_WideString& wsFormat,
} break;
case 'A': {
if (iSourceIdx < wsSource.GetLength()) {
- if ((wsSource[iSourceIdx] >= 'a' && wsSource[iSourceIdx] <= 'z') ||
- (wsSource[iSourceIdx] >= 'A' && wsSource[iSourceIdx] <= 'Z')) {
+ if (FXSYS_iswalpha(wsSource[iSourceIdx])) {
wsResult += TranslateCase(wsSource[iSourceIdx], eCaseMode);
++iFormatIdx;
}
@@ -393,7 +390,7 @@ CFX_WideString util::printx(const CFX_WideString& wsFormat,
} break;
case '9': {
if (iSourceIdx < wsSource.GetLength()) {
- if (wsSource[iSourceIdx] >= '0' && wsSource[iSourceIdx] <= '9') {
+ if (std::iswdigit(wsSource[iSourceIdx])) {
wsResult += wsSource[iSourceIdx];
++iFormatIdx;
}