summaryrefslogtreecommitdiff
path: root/fpdfsdk/src
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2015-11-03 15:08:31 -0500
committerDan Sinclair <dsinclair@chromium.org>2015-11-03 15:08:31 -0500
commitda06e60fb5a095a91c9a4f509466667878624cb3 (patch)
treecf9af9e6cc40e05cdbcf3ee7271ccc684e805f20 /fpdfsdk/src
parente0e922db5fb77df9a5a9cc802096f484ed21da1c (diff)
downloadpdfium-da06e60fb5a095a91c9a4f509466667878624cb3.tar.xz
Revert "Revert "Revert "Cleanup some numeric code."""
This reverts commit e0e922db5fb77df9a5a9cc802096f484ed21da1c. Broke Windows build. FAILED: ninja -t msvc -e environment.x86 -- "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64_x86\cl.exe" /nologo /showIncludes /FC @obj\core\src\fxcrt\fxcrt.fx_basic_gcc.obj.rsp /c ..\..\core\src\fxcrt\fx_basic_gcc.cpp /Foobj\core\src\fxcrt\fxcrt.fx_basic_gcc.obj /Fdobj\fxcrt.cc.pdb e:\b\build\slave\windows\build\pdfium\core\src\fxcrt\fx_basic_gcc.cpp(28) : error C2220: warning treated as error - no 'object' file generated e:\b\build\slave\windows\build\pdfium\core\src\fxcrt\fx_basic_gcc.cpp(75) : see reference to function template instantiation 'T FXSYS_StrToInt<int32_t,const FX_WCHAR*>(STR_T)' being compiled with [ T=int32_t , STR_T=const FX_WCHAR * ] e:\b\build\slave\windows\build\pdfium\core\src\fxcrt\fx_basic_gcc.cpp(28) : warning C4244: 'argument' : conversion from 'const FX_WCHAR' to 'char', possible loss of data FAILED: ninja -t msvc -e environment.x86 -- "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64_x86\cl.exe" /nologo /showIncludes /FC @obj\core\src\fpdftext\fpdftext.fpdf_text.obj.rsp /c ..\..\core\src\fpdftext\fpdf_text.cpp /Foobj\core\src\fpdftext\fpdftext.fpdf_text.obj /Fdobj\fpdftext.cc.pdb e:\b\build\slave\windows\build\pdfium\core\src\fpdftext\fpdf_text.cpp(439) : error C2039: 'isdigit' : is not a member of 'std' FAILED: ninja -t msvc -e environment.x86 -- "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64_x86\cl.exe" /nologo /showIncludes /FC @obj\core\src\fxcrt\fxcrt.fx_basic_wstring.obj.rsp /c ..\..\core\src\fxcrt\fx_basic_wstring.cpp /Foobj\core\src\fxcrt\fxcrt.fx_basic_wstring.obj /Fdobj\fxcrt.cc.pdb e:\b\build\slave\windows\build\pdfium\core\src\fxcrt\fx_basic_wstring.cpp(973) : error C2220: warning treated as error - no 'object' file generated e:\b\build\slave\windows\build\pdfium\core\src\fxcrt\fx_basic_wstring.cpp(973) : warning C4244: 'argument' : conversion from 'const FX_WCHAR' to 'char', possible loss of data e:\b\build\slave\windows\build\pdfium\core\src\fxcrt\fx_basic_wstring.cpp(981) : warning C4244: 'argument' : conversion from 'const FX_WCHAR' to 'char', possible loss of data FAILED: ninja -t msvc -e environment.x86 -- "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64_x86\cl.exe" /nologo /showIncludes /FC @obj\core\src\fpdftext\fpdftext.fpdf_text_int.obj.rsp /c ..\..\core\src\fpdftext\fpdf_text_int.cpp /Foobj\core\src\fpdftext\fpdftext.fpdf_text_int.obj /Fdobj\fpdftext.cc.pdb e:\b\build\slave\windows\build\pdfium\core\src\fpdftext\fpdf_text_int.cpp(2436) : error C2039: 'isdigit' : is not a member of 'std' e:\b\build\slave\windows\build\pdfium\core\src\fpdftext\fpdf_text_int.cpp(2440) : error C2039: 'isdigit' : is not a member of 'std' ninja: build stopped: subcommand failed. TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1431683008 .
Diffstat (limited to 'fpdfsdk/src')
-rw-r--r--fpdfsdk/src/fsdk_baseannot.cpp42
-rw-r--r--fpdfsdk/src/javascript/PublicMethods.cpp5
-rw-r--r--fpdfsdk/src/javascript/util.cpp7
3 files changed, 27 insertions, 27 deletions
diff --git a/fpdfsdk/src/fsdk_baseannot.cpp b/fpdfsdk/src/fsdk_baseannot.cpp
index d0151fbeb2..c6731e6f56 100644
--- a/fpdfsdk/src/fsdk_baseannot.cpp
+++ b/fpdfsdk/src/fsdk_baseannot.cpp
@@ -4,7 +4,6 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "../../core/include/fxcrt/fx_ext.h"
#include "../include/fsdk_define.h"
#include "../include/fsdk_mgr.h"
#include "../include/fsdk_baseannot.h"
@@ -220,9 +219,12 @@ CPDFSDK_DateTime& CPDFSDK_DateTime::FromPDFDateTimeString(
int i = 0;
int j, k;
FX_CHAR ch;
- while (i < strLength && !std::isdigit(dtStr[i]))
- ++i;
-
+ while (i < strLength) {
+ ch = dtStr[i];
+ if (ch >= '0' && ch <= '9')
+ break;
+ i++;
+ }
if (i >= strLength)
return *this;
@@ -230,9 +232,9 @@ CPDFSDK_DateTime& CPDFSDK_DateTime::FromPDFDateTimeString(
k = 0;
while (i < strLength && j < 4) {
ch = dtStr[i];
- k = k * 10 + FXSYS_toDecimalDigit(ch);
+ k = k * 10 + ch - '0';
j++;
- if (!std::isdigit(ch))
+ if (ch < '0' || ch > '9')
break;
i++;
}
@@ -244,9 +246,9 @@ CPDFSDK_DateTime& CPDFSDK_DateTime::FromPDFDateTimeString(
k = 0;
while (i < strLength && j < 2) {
ch = dtStr[i];
- k = k * 10 + FXSYS_toDecimalDigit(ch);
+ k = k * 10 + ch - '0';
j++;
- if (!std::isdigit(ch))
+ if (ch < '0' || ch > '9')
break;
i++;
}
@@ -258,9 +260,9 @@ CPDFSDK_DateTime& CPDFSDK_DateTime::FromPDFDateTimeString(
k = 0;
while (i < strLength && j < 2) {
ch = dtStr[i];
- k = k * 10 + FXSYS_toDecimalDigit(ch);
+ k = k * 10 + ch - '0';
j++;
- if (!std::isdigit(ch))
+ if (ch < '0' || ch > '9')
break;
i++;
}
@@ -272,9 +274,9 @@ CPDFSDK_DateTime& CPDFSDK_DateTime::FromPDFDateTimeString(
k = 0;
while (i < strLength && j < 2) {
ch = dtStr[i];
- k = k * 10 + FXSYS_toDecimalDigit(ch);
+ k = k * 10 + ch - '0';
j++;
- if (!std::isdigit(ch))
+ if (ch < '0' || ch > '9')
break;
i++;
}
@@ -286,9 +288,9 @@ CPDFSDK_DateTime& CPDFSDK_DateTime::FromPDFDateTimeString(
k = 0;
while (i < strLength && j < 2) {
ch = dtStr[i];
- k = k * 10 + FXSYS_toDecimalDigit(ch);
+ k = k * 10 + ch - '0';
j++;
- if (!std::isdigit(ch))
+ if (ch < '0' || ch > '9')
break;
i++;
}
@@ -300,9 +302,9 @@ CPDFSDK_DateTime& CPDFSDK_DateTime::FromPDFDateTimeString(
k = 0;
while (i < strLength && j < 2) {
ch = dtStr[i];
- k = k * 10 + FXSYS_toDecimalDigit(ch);
+ k = k * 10 + ch - '0';
j++;
- if (!std::isdigit(ch))
+ if (ch < '0' || ch > '9')
break;
i++;
}
@@ -321,9 +323,9 @@ CPDFSDK_DateTime& CPDFSDK_DateTime::FromPDFDateTimeString(
k = 0;
while (i < strLength && j < 2) {
ch = dtStr[i];
- k = k * 10 + FXSYS_toDecimalDigit(ch);
+ k = k * 10 + ch - '0';
j++;
- if (!std::isdigit(ch))
+ if (ch < '0' || ch > '9')
break;
i++;
}
@@ -338,9 +340,9 @@ CPDFSDK_DateTime& CPDFSDK_DateTime::FromPDFDateTimeString(
k = 0;
while (i < strLength && j < 2) {
ch = dtStr[i];
- k = k * 10 + FXSYS_toDecimalDigit(ch);
+ k = k * 10 + ch - '0';
j++;
- if (!std::isdigit(ch))
+ if (ch < '0' || ch > '9')
break;
i++;
}
diff --git a/fpdfsdk/src/javascript/PublicMethods.cpp b/fpdfsdk/src/javascript/PublicMethods.cpp
index 7ede42db13..e898214cd8 100644
--- a/fpdfsdk/src/javascript/PublicMethods.cpp
+++ b/fpdfsdk/src/javascript/PublicMethods.cpp
@@ -6,7 +6,6 @@
#include "PublicMethods.h"
-#include "../../../core/include/fxcrt/fx_ext.h"
#include "../../include/fsdk_mgr.h" // For CPDFDoc_Environment.
#include "../../include/javascript/IJavaScript.h"
#include "Field.h"
@@ -117,7 +116,7 @@ FX_BOOL CJS_PublicMethods::IsDigit(wchar_t ch) {
}
FX_BOOL CJS_PublicMethods::IsDigit(char ch) {
- return std::isdigit(ch);
+ return (ch >= '0' && ch <= '9');
}
FX_BOOL CJS_PublicMethods::IsAlphabetic(wchar_t ch) {
@@ -397,7 +396,7 @@ int CJS_PublicMethods::ParseStringInteger(const CFX_WideString& string,
FX_WCHAR c = string.GetAt(i);
if (IsDigit((wchar_t)c)) {
- nRet = nRet * 10 + FXSYS_toDecimalDigit(c);
+ nRet = nRet * 10 + (c - '0');
nSkip = i - nStart + 1;
if (nSkip >= nMaxStep)
break;
diff --git a/fpdfsdk/src/javascript/util.cpp b/fpdfsdk/src/javascript/util.cpp
index fc94a0e393..14e15c1b6f 100644
--- a/fpdfsdk/src/javascript/util.cpp
+++ b/fpdfsdk/src/javascript/util.cpp
@@ -6,7 +6,6 @@
#include "util.h"
-#include "../../../core/include/fxcrt/fx_ext.h"
#include "../../include/javascript/IJavaScript.h"
#include "JS_Context.h"
#include "JS_Define.h"
@@ -426,7 +425,7 @@ void util::printx(const std::string& cFormat,
break;
case 'X': {
while (itSource < iSize) {
- if (std::isdigit(cSource[itSource]) ||
+ if ((cSource[itSource] >= '0' && cSource[itSource] <= '9') ||
(cSource[itSource] >= 'a' && cSource[itSource] <= 'z') ||
(cSource[itSource] >= 'A' && cSource[itSource] <= 'Z')) {
cPurpose += cSource[itSource];
@@ -451,7 +450,7 @@ void util::printx(const std::string& cFormat,
} break;
case '9': {
while (itSource < iSize) {
- if (std::isdigit(cSource[itSource])) {
+ if (cSource[itSource] >= '0' && cSource[itSource] <= '9') {
cPurpose += cSource[itSource];
itSource++;
break;
@@ -532,7 +531,7 @@ int64_t FX_atoi64(const char* nptr) {
total = 0;
while (isdigit(c)) {
- total = 10 * total + FXSYS_toDecimalDigit(c); /* accumulate digit */
+ total = 10 * total + (c - '0'); /* accumulate digit */
c = (int)(unsigned char)*nptr++; /* get next char */
}