Index: fpdfsdk/src/fsdk_baseannot.cpp |
diff --git a/fpdfsdk/src/fsdk_baseannot.cpp b/fpdfsdk/src/fsdk_baseannot.cpp |
index f6ead75f9fd73685a0d67cc62dd8866a57c2918a..8cd3df97c0fca00e9104322037e32058fe72838e 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 "fpdfsdk/include/fsdk_baseannot.h" |
#include "fpdfsdk/include/fsdk_define.h" |
#include "fpdfsdk/include/fsdk_mgr.h" |
@@ -216,12 +217,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; |
@@ -229,9 +227,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++; |
} |
@@ -243,9 +241,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++; |
} |
@@ -257,9 +255,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++; |
} |
@@ -271,9 +269,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++; |
} |
@@ -285,9 +283,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++; |
} |
@@ -299,9 +297,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++; |
} |
@@ -320,9 +318,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++; |
} |
@@ -337,9 +335,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++; |
} |