1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 00:57:45 +00:00

LibPDF: Use is_ascii_hex_digit() instead of isxdigit()

See description of #7684 for motivation.

Also, makes this code look more like the hex code in
Filter::decode_ascii_hex().

No behavior change.
This commit is contained in:
Nico Weber 2024-02-22 09:41:58 -05:00 committed by Tim Flynn
parent 6402ad29a6
commit 783b1d1c11

View file

@ -221,7 +221,7 @@ PDFErrorOr<NonnullRefPtr<NameObject>> Parser::parse_name()
int hex_value = 0; int hex_value = 0;
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
auto ch = m_reader.consume(); auto ch = m_reader.consume();
VERIFY(isxdigit(ch)); VERIFY(is_ascii_hex_digit(ch));
hex_value *= 16; hex_value *= 16;
if (ch <= '9') { if (ch <= '9') {
hex_value += ch - '0'; hex_value += ch - '0';
@ -370,7 +370,7 @@ PDFErrorOr<ByteString> Parser::parse_hex_string()
return builder.to_byte_string(); return builder.to_byte_string();
} }
if (!isxdigit(ch)) if (!is_ascii_hex_digit(ch))
return error("character in hex string isn't hex digit"); return error("character in hex string isn't hex digit");
hex_value *= 16; hex_value *= 16;