summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/fxedit/fxet_list.cpp9
-rw-r--r--fpdfsdk/fxedit/fxet_list.h1
-rw-r--r--fpdfsdk/javascript/util.cpp13
3 files changed, 7 insertions, 16 deletions
diff --git a/fpdfsdk/fxedit/fxet_list.cpp b/fpdfsdk/fxedit/fxet_list.cpp
index c10b6a205e..c8fef948af 100644
--- a/fpdfsdk/fxedit/fxet_list.cpp
+++ b/fpdfsdk/fxedit/fxet_list.cpp
@@ -10,6 +10,7 @@
#include <utility>
#include "core/fpdfdoc/cpvt_word.h"
+#include "core/fxcrt/fx_extension.h"
#include "fpdfsdk/fxedit/fxet_edit.h"
#include "fpdfsdk/pdfwindow/PWL_ListBox.h"
#include "third_party/base/stl_util.h"
@@ -638,12 +639,6 @@ int32_t CFX_ListCtrl::GetLastSelected() const {
return -1;
}
-wchar_t CFX_ListCtrl::Toupper(wchar_t c) const {
- if ((c >= 'a') && (c <= 'z'))
- c = c - ('a' - 'A');
- return c;
-}
-
int32_t CFX_ListCtrl::FindNext(int32_t nIndex, wchar_t nChar) const {
int32_t nCircleIndex = nIndex;
int32_t sz = pdfium::CollectionSize<int32_t>(m_ListItems);
@@ -653,7 +648,7 @@ int32_t CFX_ListCtrl::FindNext(int32_t nIndex, wchar_t nChar) const {
nCircleIndex = 0;
if (CFX_ListItem* pListItem = m_ListItems[nCircleIndex].get()) {
- if (Toupper(pListItem->GetFirstChar()) == Toupper(nChar))
+ if (FXSYS_toupper(pListItem->GetFirstChar()) == FXSYS_toupper(nChar))
return nCircleIndex;
}
}
diff --git a/fpdfsdk/fxedit/fxet_list.h b/fpdfsdk/fxedit/fxet_list.h
index 50e43c9d2f..cd6e2ddeff 100644
--- a/fpdfsdk/fxedit/fxet_list.h
+++ b/fpdfsdk/fxedit/fxet_list.h
@@ -262,7 +262,6 @@ class CFX_ListCtrl : protected CFX_ListContainer {
CFX_WideString GetItemText(int32_t nIndex) const;
void SetItemSelect(int32_t nItemIndex, bool bSelected);
int32_t GetLastSelected() const;
- wchar_t Toupper(wchar_t c) const;
CPWL_List_Notify* m_pNotify;
bool m_bNotifyFlag;
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;
}