summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/fsdk_baseannot.cpp
diff options
context:
space:
mode:
authordan sinclair <dsinclair@chromium.org>2015-11-10 13:33:04 -0500
committerdan sinclair <dsinclair@chromium.org>2015-11-10 13:33:04 -0500
commit0569ab0b11b723d9bca4ddd642b0cf8828c4bdd1 (patch)
treed0f6ba295574785c773536be7b5526680ed60f04 /fpdfsdk/src/fsdk_baseannot.cpp
parente6e16954f0cdc324849fca9da883be8f131b3834 (diff)
downloadpdfium-0569ab0b11b723d9bca4ddd642b0cf8828c4bdd1.tar.xz
Revert x4 "Cleanup some numeric code."
This reverts commit b27902b8995bb3e003daed6b0811ed746763c68d. Cleanup some numeric code. This changes the various comparisons of char >= '0' && char <= '9' and char < '0' || char > '9' to use std::isdigit checks. It also cleans up a handful of hex to digit conversions to call one common method. TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1432973003 .
Diffstat (limited to 'fpdfsdk/src/fsdk_baseannot.cpp')
-rw-r--r--fpdfsdk/src/fsdk_baseannot.cpp42
1 files changed, 22 insertions, 20 deletions
diff --git a/fpdfsdk/src/fsdk_baseannot.cpp b/fpdfsdk/src/fsdk_baseannot.cpp
index 1ccac9275a..52f34fae8e 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"
@@ -217,9 +216,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;
@@ -227,9 +229,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++;
}
@@ -241,9 +243,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++;
}
@@ -255,9 +257,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++;
}
@@ -269,9 +271,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++;
}
@@ -283,9 +285,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++;
}
@@ -297,9 +299,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++;
}
@@ -318,9 +320,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++;
}
@@ -335,9 +337,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++;
}