Commit 77c31305fe1e9fde7ebf221fca94e7628cbf5a28
Committed by
Jay Berkenbilt
1 parent
0f1ffa12
Fix signed/unsigned char warning (fixes #604)
Showing
1 changed file
with
5 additions
and
4 deletions
libqpdf/QPDFTokenizer.cc
| @@ -719,7 +719,7 @@ QPDFTokenizer::findEI(PointerHolder<InputSource> input) | @@ -719,7 +719,7 @@ QPDFTokenizer::findEI(PointerHolder<InputSource> input) | ||
| 719 | for (std::string::iterator iter = value.begin(); | 719 | for (std::string::iterator iter = value.begin(); |
| 720 | iter != value.end(); ++iter) | 720 | iter != value.end(); ++iter) |
| 721 | { | 721 | { |
| 722 | - signed char ch = *iter; | 722 | + char ch = *iter; |
| 723 | if (((ch >= 'a') && (ch <= 'z')) || | 723 | if (((ch >= 'a') && (ch <= 'z')) || |
| 724 | ((ch >= 'A') && (ch <= 'Z')) || | 724 | ((ch >= 'A') && (ch <= 'Z')) || |
| 725 | (ch == '*')) | 725 | (ch == '*')) |
| @@ -729,10 +729,11 @@ QPDFTokenizer::findEI(PointerHolder<InputSource> input) | @@ -729,10 +729,11 @@ QPDFTokenizer::findEI(PointerHolder<InputSource> input) | ||
| 729 | // alphabetic characters. | 729 | // alphabetic characters. |
| 730 | found_alpha = true; | 730 | found_alpha = true; |
| 731 | } | 731 | } |
| 732 | - else if ((ch < 32) && (! isSpace(ch))) | 732 | + else if ((static_cast<signed char>(ch) < 32) && |
| 733 | + (! isSpace(ch))) | ||
| 733 | { | 734 | { |
| 734 | - // ch is signed, so characters outside of | ||
| 735 | - // 7-bit will be < 0. | 735 | + // Compare ch as a signed char so characters |
| 736 | + // outside of 7-bit will be < 0. | ||
| 736 | found_non_printable = true; | 737 | found_non_printable = true; |
| 737 | break; | 738 | break; |
| 738 | } | 739 | } |