summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
diff options
context:
space:
mode:
authordan sinclair <dsinclair@chromium.org>2015-10-29 15:08:50 -0400
committerdan sinclair <dsinclair@chromium.org>2015-10-29 15:08:50 -0400
commit23d576f0b498bd4f37ef2175916223a2e5ea0324 (patch)
treeb6561f688e88f00b437eba6128c1b5129d813a7e /core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
parent589f7e0a57675efce9810c15a3e9b7c49bf0bc90 (diff)
downloadpdfium-23d576f0b498bd4f37ef2175916223a2e5ea0324.tar.xz
Revert "Cleanup some numeric code."
This reverts commit 589f7e0a57675efce9810c15a3e9b7c49bf0bc90. Broke the build on Mac, unable to find std::isdigit. TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1428853002 .
Diffstat (limited to 'core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp')
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp31
1 files changed, 22 insertions, 9 deletions
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
index 88e2269c7a..1fa27e3805 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
@@ -7,7 +7,6 @@
#include "../../../include/fpdfapi/fpdf_page.h"
#include "../../../include/fpdfapi/fpdf_module.h"
#include "../../../include/fxcodec/fx_codec.h"
-#include "../../../include/fxcrt/fx_ext.h"
#include "pageint.h"
#include <limits.h>
@@ -876,20 +875,34 @@ CFX_ByteString CPDF_StreamParser::ReadHexString() {
FX_BOOL bFirst = TRUE;
int code = 0;
while (1) {
- if (ch == '>')
+ if (ch == '>') {
break;
-
- if (std::isxdigit(ch)) {
- int val = HexCharToDigit(ch);
+ }
+ if (ch >= '0' && ch <= '9') {
+ if (bFirst) {
+ code = (ch - '0') * 16;
+ } else {
+ code += ch - '0';
+ buf.AppendChar((char)code);
+ }
+ bFirst = !bFirst;
+ } else if (ch >= 'A' && ch <= 'F') {
if (bFirst) {
- code = val * 16;
+ code = (ch - 'A' + 10) * 16;
} else {
- code += val;
- buf.AppendByte((uint8_t)code);
+ code += ch - 'A' + 10;
+ buf.AppendChar((char)code);
+ }
+ bFirst = !bFirst;
+ } else if (ch >= 'a' && ch <= 'f') {
+ if (bFirst) {
+ code = (ch - 'a' + 10) * 16;
+ } else {
+ code += ch - 'a' + 10;
+ buf.AppendChar((char)code);
}
bFirst = !bFirst;
}
-
if (!PositionIsInBounds())
break;