Commit deb1c330869b2785fac8ec3916a67a0ff6916a3d

Authored by m-holger
Committed by Jay Berkenbilt
1 parent 3ee552fe

Replace strchr in QPDF_Name::normalizeName

Showing 1 changed file with 4 additions and 1 deletions
libqpdf/QPDF_Name.cc
@@ -37,7 +37,10 @@ QPDF_Name::normalizeName(std::string const& name) @@ -37,7 +37,10 @@ QPDF_Name::normalizeName(std::string const& name)
37 // QPDFTokenizer embeds a null character to encode an 37 // QPDFTokenizer embeds a null character to encode an
38 // invalid #. 38 // invalid #.
39 result += "#"; 39 result += "#";
40 - } else if (strchr("#()<>[]{}/%", ch) || (ch < 33) || (ch > 126)) { 40 + } else if (
  41 + ch < 33 || ch == '/' || ch == '(' || ch == ')' || ch == '{' ||
  42 + ch == '}' || ch == '<' || ch == '>' || ch == '[' || ch == ']' ||
  43 + ch == '%' || ch > 126) {
41 result += QUtil::hex_encode_char(ch); 44 result += QUtil::hex_encode_char(ch);
42 } else { 45 } else {
43 result += ch; 46 result += ch;