diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2015-11-16 12:28:39 -0500 |
---|---|---|
committer | Dan Sinclair <dsinclair@chromium.org> | 2015-11-16 12:28:39 -0500 |
commit | 3f148915d12f54a946a0c0bf526162b79c39d650 (patch) | |
tree | 17a95f27c8a6a07356b68ac41b5fbcc0f2358ab9 /core/src/fxcrt/fx_xml_parser.cpp | |
parent | 76c6d639f46c37ba955569f507201eb3f1b613fc (diff) | |
download | pdfium-3f148915d12f54a946a0c0bf526162b79c39d650.tar.xz |
Reland "Cleanup some numeric code.""chromium/2567
This reverts commit 0569ab0b11b723d9bca4ddd642b0cf8828c4bdd1.
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=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1449873003 .
Diffstat (limited to 'core/src/fxcrt/fx_xml_parser.cpp')
-rw-r--r-- | core/src/fxcrt/fx_xml_parser.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/core/src/fxcrt/fx_xml_parser.cpp b/core/src/fxcrt/fx_xml_parser.cpp index 429bc38289..2d3ff6631e 100644 --- a/core/src/fxcrt/fx_xml_parser.cpp +++ b/core/src/fxcrt/fx_xml_parser.cpp @@ -6,6 +6,7 @@ #include "xml_int.h" +#include "core/include/fxcrt/fx_ext.h" #include "core/include/fxcrt/fx_xml.h" CXML_Parser::~CXML_Parser() { @@ -228,9 +229,8 @@ FX_DWORD CXML_Parser::GetCharRef() { iState = 10; break; } - if (g_FXCRT_XML_IsDigital(ch)) { - code = code * 10 + ch - '0'; - } + if (g_FXCRT_XML_IsDigital(ch)) + code = code * 10 + FXSYS_toDecimalDigit(ch); break; case 4: m_dwIndex++; @@ -242,7 +242,7 @@ FX_DWORD CXML_Parser::GetCharRef() { g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_HexChar; if (nHex) { if (nHex == FXCRTM_XML_CHARTYPE_HexDigital) { - code = (code << 4) + ch - '0'; + code = (code << 4) + FXSYS_toDecimalDigit(ch); } else if (nHex == FXCRTM_XML_CHARTYPE_HexLowerLetter) { code = (code << 4) + ch - 87; } else { |