2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-05-29 00:10:54 +00:00

Fix signed/unsigned char warning (fixes #604)

This commit is contained in:
Jay Berkenbilt 2022-01-10 11:52:07 -05:00 committed by Jay Berkenbilt
parent 0f1ffa1215
commit 77c31305fe

View File

@ -719,7 +719,7 @@ QPDFTokenizer::findEI(PointerHolder<InputSource> input)
for (std::string::iterator iter = value.begin();
iter != value.end(); ++iter)
{
signed char ch = *iter;
char ch = *iter;
if (((ch >= 'a') && (ch <= 'z')) ||
((ch >= 'A') && (ch <= 'Z')) ||
(ch == '*'))
@ -729,10 +729,11 @@ QPDFTokenizer::findEI(PointerHolder<InputSource> input)
// alphabetic characters.
found_alpha = true;
}
else if ((ch < 32) && (! isSpace(ch)))
else if ((static_cast<signed char>(ch) < 32) &&
(! isSpace(ch)))
{
// ch is signed, so characters outside of
// 7-bit will be < 0.
// Compare ch as a signed char so characters
// outside of 7-bit will be < 0.
found_non_printable = true;
break;
}