summaryrefslogtreecommitdiff
path: root/core/src/fpdftext/fpdf_text.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 /core/src/fpdftext/fpdf_text.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 'core/src/fpdftext/fpdf_text.cpp')
-rw-r--r--core/src/fpdftext/fpdf_text.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/core/src/fpdftext/fpdf_text.cpp b/core/src/fpdftext/fpdf_text.cpp
index bef805189b..55ab483722 100644
--- a/core/src/fpdftext/fpdf_text.cpp
+++ b/core/src/fpdftext/fpdf_text.cpp
@@ -14,8 +14,6 @@
#include "third_party/base/nonstd_unique_ptr.h"
#include "txtproc.h"
-#include <cctype>
-
CFX_ByteString CharFromUnicodeAlt(FX_WCHAR unicode,
int destcp,
const FX_CHAR* defchar) {
@@ -438,9 +436,10 @@ void NormalizeString(CFX_WideString& str) {
static FX_BOOL IsNumber(CFX_WideString& str) {
for (int i = 0; i < str.GetLength(); i++) {
FX_WCHAR ch = str[i];
- // TODO(dsinclair): --.+ +.-- should probably not be a number.
- if (!std::iswdigit(ch) && ch != '-' && ch != '+' && ch != '.' && ch != ' ')
+ if ((ch < '0' || ch > '9') && ch != '-' && ch != '+' && ch != '.' &&
+ ch != ' ') {
return FALSE;
+ }
}
return TRUE;
}