From e247ec47b75d45d16298e4e11ba68745b9ebe3eb Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Thu, 20 Apr 2017 21:41:36 -0700 Subject: 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 Reviewed-by: Tom Sepez --- core/fxcrt/fx_extension.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'core/fxcrt/fx_extension.cpp') 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 + #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ #include #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) -- cgit v1.2.3