for (loop = 0, required = 0, ptr = str;
loop < len;
loop++, required++, ptr++) {
- if (*ptr < 32 || *ptr == '\"' || *ptr == '\\')
+ if ((unsigned char)(*ptr) < 32 || *ptr == '\"' || *ptr == '\\')
required++;
}
*ptr2++ = '\"';
for (loop = 0; loop < len; loop++) {
- if (*ptr > 31 && *ptr != '\"' && *ptr != '\\') {
+ if ((unsigned char)(*ptr) > 31 && *ptr != '\"' && *ptr != '\\') {
*ptr2++ = *ptr++;
} else {
*ptr2++ = '\\';