diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2015-10-29 14:56:26 -0400 |
---|---|---|
committer | Dan Sinclair <dsinclair@chromium.org> | 2015-10-29 14:56:26 -0400 |
commit | 589f7e0a57675efce9810c15a3e9b7c49bf0bc90 (patch) | |
tree | 6839707c05c00f227744ffc3788665cb1cb5b7bd /fpdfsdk/src/fsdk_baseannot.cpp | |
parent | 6ed0028f1cf12ee53e9e7f657b7ba186c77a42f3 (diff) | |
download | pdfium-589f7e0a57675efce9810c15a3e9b7c49bf0bc90.tar.xz |
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.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1415933005 .
Diffstat (limited to 'fpdfsdk/src/fsdk_baseannot.cpp')
-rw-r--r-- | fpdfsdk/src/fsdk_baseannot.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/fpdfsdk/src/fsdk_baseannot.cpp b/fpdfsdk/src/fsdk_baseannot.cpp index c6731e6f56..ebf56ad293 100644 --- a/fpdfsdk/src/fsdk_baseannot.cpp +++ b/fpdfsdk/src/fsdk_baseannot.cpp @@ -221,7 +221,7 @@ CPDFSDK_DateTime& CPDFSDK_DateTime::FromPDFDateTimeString( FX_CHAR ch; while (i < strLength) { ch = dtStr[i]; - if (ch >= '0' && ch <= '9') + if (std::isdigit(ch)) break; i++; } @@ -234,7 +234,7 @@ CPDFSDK_DateTime& CPDFSDK_DateTime::FromPDFDateTimeString( ch = dtStr[i]; k = k * 10 + ch - '0'; j++; - if (ch < '0' || ch > '9') + if (!std::isdigit(ch)) break; i++; } @@ -248,7 +248,7 @@ CPDFSDK_DateTime& CPDFSDK_DateTime::FromPDFDateTimeString( ch = dtStr[i]; k = k * 10 + ch - '0'; j++; - if (ch < '0' || ch > '9') + if (!std::isdigit(ch)) break; i++; } @@ -262,7 +262,7 @@ CPDFSDK_DateTime& CPDFSDK_DateTime::FromPDFDateTimeString( ch = dtStr[i]; k = k * 10 + ch - '0'; j++; - if (ch < '0' || ch > '9') + if (!std::isdigit(ch)) break; i++; } @@ -276,7 +276,7 @@ CPDFSDK_DateTime& CPDFSDK_DateTime::FromPDFDateTimeString( ch = dtStr[i]; k = k * 10 + ch - '0'; j++; - if (ch < '0' || ch > '9') + if (!std::isdigit(ch)) break; i++; } @@ -290,7 +290,7 @@ CPDFSDK_DateTime& CPDFSDK_DateTime::FromPDFDateTimeString( ch = dtStr[i]; k = k * 10 + ch - '0'; j++; - if (ch < '0' || ch > '9') + if (!std::isdigit(ch)) break; i++; } @@ -304,7 +304,7 @@ CPDFSDK_DateTime& CPDFSDK_DateTime::FromPDFDateTimeString( ch = dtStr[i]; k = k * 10 + ch - '0'; j++; - if (ch < '0' || ch > '9') + if (!std::isdigit(ch)) break; i++; } @@ -325,7 +325,7 @@ CPDFSDK_DateTime& CPDFSDK_DateTime::FromPDFDateTimeString( ch = dtStr[i]; k = k * 10 + ch - '0'; j++; - if (ch < '0' || ch > '9') + if (!std::isdigit(ch)) break; i++; } @@ -342,7 +342,7 @@ CPDFSDK_DateTime& CPDFSDK_DateTime::FromPDFDateTimeString( ch = dtStr[i]; k = k * 10 + ch - '0'; j++; - if (ch < '0' || ch > '9') + if (!std::isdigit(ch)) break; i++; } |