summaryrefslogtreecommitdiff
path: root/core/fxcrt/fx_extension.cpp
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 /core/fxcrt/fx_extension.cpp
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 'core/fxcrt/fx_extension.cpp')
-rw-r--r--core/fxcrt/fx_extension.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/core/fxcrt/fx_extension.cpp b/core/fxcrt/fx_extension.cpp
index 47bd937ff8..209584b68d 100644
--- a/core/fxcrt/fx_extension.cpp
+++ b/core/fxcrt/fx_extension.cpp
@@ -6,6 +6,8 @@
#include "core/fxcrt/fx_extension.h"
+#include <cwctype>
+
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
#include <wincrypt.h>
#else
@@ -67,11 +69,10 @@ float FXSYS_wcstof(const wchar_t* pwsStr, int32_t iLength, int32_t* pUsedLen) {
float fValue = 0.0f;
while (iUsedLen < iLength) {
wchar_t wch = pwsStr[iUsedLen];
- if (wch >= L'0' && wch <= L'9')
- fValue = fValue * 10.0f + (wch - L'0');
- else
+ if (!std::iswdigit(wch))
break;
+ fValue = fValue * 10.0f + (wch - L'0');
iUsedLen++;
}
@@ -79,12 +80,11 @@ float FXSYS_wcstof(const wchar_t* pwsStr, int32_t iLength, int32_t* pUsedLen) {
float fPrecise = 0.1f;
while (++iUsedLen < iLength) {
wchar_t wch = pwsStr[iUsedLen];
- if (wch >= L'0' && wch <= L'9') {
- fValue += (wch - L'0') * fPrecise;
- fPrecise *= 0.1f;
- } else {
+ if (!std::iswdigit(wch))
break;
- }
+
+ fValue += (wch - L'0') * fPrecise;
+ fPrecise *= 0.1f;
}
}
if (pUsedLen)