summaryrefslogtreecommitdiff
path: root/core/src/fxcrt/fx_basic_util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/fxcrt/fx_basic_util.cpp')
-rw-r--r--core/src/fxcrt/fx_basic_util.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/core/src/fxcrt/fx_basic_util.cpp b/core/src/fxcrt/fx_basic_util.cpp
index 78bdeee693..46a0dec1e5 100644
--- a/core/src/fxcrt/fx_basic_util.cpp
+++ b/core/src/fxcrt/fx_basic_util.cpp
@@ -5,17 +5,12 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#include "../../include/fxcrt/fx_basic.h"
-#include "../../include/fxcrt/fx_ext.h"
-
#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
#include <sys/types.h>
#include <dirent.h>
#else
#include <direct.h>
#endif
-
-#include <cctype>
-
CFX_PrivateData::~CFX_PrivateData() {
ClearAll();
}
@@ -105,11 +100,14 @@ void FX_atonum(const CFX_ByteStringC& strc, FX_BOOL& bInteger, void* pData) {
bNegative = TRUE;
cc++;
}
- while (cc < len && std::isdigit(str[cc])) {
- integer = integer * 10 + FXSYS_toDecimalDigit(str[cc]);
- if (integer < 0)
+ while (cc < len) {
+ if (str[cc] < '0' || str[cc] > '9') {
break;
-
+ }
+ integer = integer * 10 + str[cc] - '0';
+ if (integer < 0) {
+ break;
+ }
cc++;
}
if (bNegative) {
@@ -146,7 +144,7 @@ FX_FLOAT FX_atof(const CFX_ByteStringC& strc) {
if (str[cc] == '.') {
break;
}
- value = value * 10 + FXSYS_toDecimalDigit(str[cc]);
+ value = value * 10 + str[cc] - '0';
cc++;
}
static const FX_FLOAT fraction_scales[] = {
@@ -157,7 +155,7 @@ FX_FLOAT FX_atof(const CFX_ByteStringC& strc) {
if (cc < len && str[cc] == '.') {
cc++;
while (cc < len) {
- value += fraction_scales[scale] * FXSYS_toDecimalDigit(str[cc]);
+ value += fraction_scales[scale] * (str[cc] - '0');
scale++;
if (scale == sizeof fraction_scales / sizeof(FX_FLOAT)) {
break;