| Index: core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
|
| diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
|
| index 3057948959807b1e84e336729ad5ee6dc3efe3c2..dd31322744e15d7d2c01492af2ca95826e300ce3 100644
|
| --- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
|
| +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
|
| @@ -7,6 +7,7 @@
|
| #include "../../../include/fpdfapi/fpdf_page.h"
|
| #include "../../../include/fpdfapi/fpdf_module.h"
|
| #include "../../../include/fpdfapi/fpdf_serial.h"
|
| +#include "../../../include/fxcrt/fx_ext.h"
|
| #include "pageint.h"
|
|
|
| #define REQUIRE_PARAMS(count) \
|
| @@ -1534,40 +1535,26 @@ void CPDF_StreamContentParser::AddPathObject(int FillType, FX_BOOL bStroke) {
|
| }
|
| CFX_ByteString _FPDF_ByteStringFromHex(CFX_BinaryBuf& src_buf) {
|
| CFX_ByteTextBuf buf;
|
| - FX_BOOL bFirst = TRUE;
|
| + bool bFirst = true;
|
| int code = 0;
|
| const uint8_t* str = src_buf.GetBuffer();
|
| FX_DWORD size = src_buf.GetSize();
|
| for (FX_DWORD i = 0; i < size; i++) {
|
| uint8_t ch = str[i];
|
| - 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 = (ch - 'A' + 10) * 16;
|
| - } else {
|
| - code += ch - 'A' + 10;
|
| - buf.AppendChar((char)code);
|
| - }
|
| - bFirst = !bFirst;
|
| - } else if (ch >= 'a' && ch <= 'f') {
|
| +
|
| + if (std::isxdigit(ch)) {
|
| + int val = FXSYS_toHexDigit(ch);
|
| if (bFirst) {
|
| - code = (ch - 'a' + 10) * 16;
|
| + code = val * 16;
|
| } else {
|
| - code += ch - 'a' + 10;
|
| + code += val;
|
| buf.AppendChar((char)code);
|
| }
|
| bFirst = !bFirst;
|
| }
|
| }
|
| - if (!bFirst) {
|
| + if (!bFirst)
|
| buf.AppendChar((char)code);
|
| - }
|
| +
|
| return buf.GetByteString();
|
| }
|
|
|