diff options
author | Lei Zhang <thestig@chromium.org> | 2017-05-10 01:15:46 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-05-10 17:08:14 +0000 |
commit | 58577fd17020f52314bba8989be964a8c2fd010d (patch) | |
tree | ebd92fbd721dbdc783b1ab7f166a2ddcc14d49fc /core/fpdfapi/parser | |
parent | 6e10d000ce048e67d36358c768c8cdad747eec15 (diff) | |
download | pdfium-58577fd17020f52314bba8989be964a8c2fd010d.tar.xz |
Use FXSYS_IntToTwoHexChars() in more places.
Change-Id: I84cd8e91a296119ecf80b7a092b886f291bebb45
Reviewed-on: https://pdfium-review.googlesource.com/4953
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Nicolás Peña <npm@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fpdfapi/parser')
-rw-r--r-- | core/fpdfapi/parser/fpdf_parser_decode.cpp | 6 | ||||
-rw-r--r-- | core/fpdfapi/parser/fpdf_parser_utility.cpp | 4 |
2 files changed, 6 insertions, 4 deletions
diff --git a/core/fpdfapi/parser/fpdf_parser_decode.cpp b/core/fpdfapi/parser/fpdf_parser_decode.cpp index c521c20665..64831e91e5 100644 --- a/core/fpdfapi/parser/fpdf_parser_decode.cpp +++ b/core/fpdfapi/parser/fpdf_parser_decode.cpp @@ -517,8 +517,10 @@ CFX_ByteString PDF_EncodeString(const CFX_ByteString& src, bool bHex) { if (bHex) { result.AppendChar('<'); for (int i = 0; i < srclen; i++) { - result.AppendChar("0123456789ABCDEF"[src[i] / 16]); - result.AppendChar("0123456789ABCDEF"[src[i] % 16]); + char buf[2]; + FXSYS_IntToTwoHexChars(src[i], buf); + result.AppendChar(buf[0]); + result.AppendChar(buf[1]); } result.AppendChar('>'); return result.MakeString(); diff --git a/core/fpdfapi/parser/fpdf_parser_utility.cpp b/core/fpdfapi/parser/fpdf_parser_utility.cpp index 1edf577c5b..af109e35aa 100644 --- a/core/fpdfapi/parser/fpdf_parser_utility.cpp +++ b/core/fpdfapi/parser/fpdf_parser_utility.cpp @@ -139,8 +139,8 @@ CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig) { if (ch >= 0x80 || PDFCharIsWhitespace(ch) || ch == '#' || PDFCharIsDelimiter(ch)) { dest_buf[dest_len++] = '#'; - dest_buf[dest_len++] = "0123456789ABCDEF"[ch / 16]; - dest_buf[dest_len++] = "0123456789ABCDEF"[ch % 16]; + FXSYS_IntToTwoHexChars(ch, dest_buf + dest_len); + dest_len += 2; } else { dest_buf[dest_len++] = ch; } |