Turns out comparing a signed byte to values above 0x7f doesn't make
sense. *All* signed byte integers are less than or equal to 0x9f,
so the other two branches of the if could never be taken.
This code probably needs more review and testing, but we might as
well make it do what it intends to do before reviewing those
intentions and factoring out some of the copy-and-paste verbosity.
/* High bit set, but not a Unicode character! */
/* Non printing DECMCS or ISO Latin-1 character? */
- if (*inspec <= 0x9F) {
- int hex;
+ if ((unsigned char)*inspec <= 0x9F) {
+ int hex;
outspec[0] = '^';
outspec++;
hex = (*inspec >> 4) & 0xF;
}
*output_cnt = 3;
return 1;
- } else if (*inspec == 0xA0) {
+ } else if ((unsigned char)*inspec == 0xA0) {
outspec[0] = '^';
outspec[1] = 'A';
outspec[2] = '0';
*output_cnt = 3;
return 1;
- } else if (*inspec == 0xFF) {
+ } else if ((unsigned char)*inspec == 0xFF) {
outspec[0] = '^';
outspec[1] = 'F';
outspec[2] = 'F';