From 77c31305fe1e9fde7ebf221fca94e7628cbf5a28 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Mon, 10 Jan 2022 11:52:07 -0500 Subject: [PATCH] Fix signed/unsigned char warning (fixes #604) --- libqpdf/QPDFTokenizer.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libqpdf/QPDFTokenizer.cc b/libqpdf/QPDFTokenizer.cc index 4217575c..f4439fd1 100644 --- a/libqpdf/QPDFTokenizer.cc +++ b/libqpdf/QPDFTokenizer.cc @@ -719,7 +719,7 @@ QPDFTokenizer::findEI(PointerHolder 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 input) // alphabetic characters. found_alpha = true; } - else if ((ch < 32) && (! isSpace(ch))) + else if ((static_cast(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; }