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 | 719 | for (std::string::iterator iter = value.begin(); |
| 720 | 720 | iter != value.end(); ++iter) |
| 721 | 721 | { |
| 722 | - signed char ch = *iter; | |
| 722 | + char ch = *iter; | |
| 723 | 723 | if (((ch >= 'a') && (ch <= 'z')) || |
| 724 | 724 | ((ch >= 'A') && (ch <= 'Z')) || |
| 725 | 725 | (ch == '*')) |
| ... | ... | @@ -729,10 +729,11 @@ QPDFTokenizer::findEI(PointerHolder<InputSource> input) |
| 729 | 729 | // alphabetic characters. |
| 730 | 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 | 737 | found_non_printable = true; |
| 737 | 738 | break; |
| 738 | 739 | } | ... | ... |