Index: fpdfsdk/src/fsdk_baseannot.cpp |
diff --git a/fpdfsdk/src/fsdk_baseannot.cpp b/fpdfsdk/src/fsdk_baseannot.cpp |
index c6731e6f568542e926a243e52b6257d16239a277..d0151fbeb264164f2c92f3f95796236f70f7f58c 100644 |
--- a/fpdfsdk/src/fsdk_baseannot.cpp |
+++ b/fpdfsdk/src/fsdk_baseannot.cpp |
@@ -4,6 +4,7 @@ |
// 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" |
@@ -219,12 +220,9 @@ CPDFSDK_DateTime& CPDFSDK_DateTime::FromPDFDateTimeString( |
int i = 0; |
int j, k; |
FX_CHAR ch; |
- while (i < strLength) { |
- ch = dtStr[i]; |
- if (ch >= '0' && ch <= '9') |
- break; |
- i++; |
- } |
+ while (i < strLength && !std::isdigit(dtStr[i])) |
+ ++i; |
+ |
if (i >= strLength) |
return *this; |
@@ -232,9 +230,9 @@ CPDFSDK_DateTime& CPDFSDK_DateTime::FromPDFDateTimeString( |
k = 0; |
while (i < strLength && j < 4) { |
ch = dtStr[i]; |
- k = k * 10 + ch - '0'; |
+ k = k * 10 + FXSYS_toDecimalDigit(ch); |
j++; |
- if (ch < '0' || ch > '9') |
+ if (!std::isdigit(ch)) |
break; |
i++; |
} |
@@ -246,9 +244,9 @@ CPDFSDK_DateTime& CPDFSDK_DateTime::FromPDFDateTimeString( |
k = 0; |
while (i < strLength && j < 2) { |
ch = dtStr[i]; |
- k = k * 10 + ch - '0'; |
+ k = k * 10 + FXSYS_toDecimalDigit(ch); |
j++; |
- if (ch < '0' || ch > '9') |
+ if (!std::isdigit(ch)) |
break; |
i++; |
} |
@@ -260,9 +258,9 @@ CPDFSDK_DateTime& CPDFSDK_DateTime::FromPDFDateTimeString( |
k = 0; |
while (i < strLength && j < 2) { |
ch = dtStr[i]; |
- k = k * 10 + ch - '0'; |
+ k = k * 10 + FXSYS_toDecimalDigit(ch); |
j++; |
- if (ch < '0' || ch > '9') |
+ if (!std::isdigit(ch)) |
break; |
i++; |
} |
@@ -274,9 +272,9 @@ CPDFSDK_DateTime& CPDFSDK_DateTime::FromPDFDateTimeString( |
k = 0; |
while (i < strLength && j < 2) { |
ch = dtStr[i]; |
- k = k * 10 + ch - '0'; |
+ k = k * 10 + FXSYS_toDecimalDigit(ch); |
j++; |
- if (ch < '0' || ch > '9') |
+ if (!std::isdigit(ch)) |
break; |
i++; |
} |
@@ -288,9 +286,9 @@ CPDFSDK_DateTime& CPDFSDK_DateTime::FromPDFDateTimeString( |
k = 0; |
while (i < strLength && j < 2) { |
ch = dtStr[i]; |
- k = k * 10 + ch - '0'; |
+ k = k * 10 + FXSYS_toDecimalDigit(ch); |
j++; |
- if (ch < '0' || ch > '9') |
+ if (!std::isdigit(ch)) |
break; |
i++; |
} |
@@ -302,9 +300,9 @@ CPDFSDK_DateTime& CPDFSDK_DateTime::FromPDFDateTimeString( |
k = 0; |
while (i < strLength && j < 2) { |
ch = dtStr[i]; |
- k = k * 10 + ch - '0'; |
+ k = k * 10 + FXSYS_toDecimalDigit(ch); |
j++; |
- if (ch < '0' || ch > '9') |
+ if (!std::isdigit(ch)) |
break; |
i++; |
} |
@@ -323,9 +321,9 @@ CPDFSDK_DateTime& CPDFSDK_DateTime::FromPDFDateTimeString( |
k = 0; |
while (i < strLength && j < 2) { |
ch = dtStr[i]; |
- k = k * 10 + ch - '0'; |
+ k = k * 10 + FXSYS_toDecimalDigit(ch); |
j++; |
- if (ch < '0' || ch > '9') |
+ if (!std::isdigit(ch)) |
break; |
i++; |
} |
@@ -340,9 +338,9 @@ CPDFSDK_DateTime& CPDFSDK_DateTime::FromPDFDateTimeString( |
k = 0; |
while (i < strLength && j < 2) { |
ch = dtStr[i]; |
- k = k * 10 + ch - '0'; |
+ k = k * 10 + FXSYS_toDecimalDigit(ch); |
j++; |
- if (ch < '0' || ch > '9') |
+ if (!std::isdigit(ch)) |
break; |
i++; |
} |