isprint() wants value in range [-1, 255]

The MSVC impl. assert()s this
This commit is contained in:
Michael Davidsaver
2022-11-26 10:44:02 -08:00
parent 45671faaea
commit 0b424a71ec
2 changed files with 4 additions and 4 deletions

View File

@@ -497,7 +497,7 @@ std::ostream& operator<<(std::ostream& strm, const escape& Q)
case '\'': next = '\''; break;
case '\"': next = '\"'; if(Q.S==escape::CSV) quote = '"'; break;
default:
if(!isprint(C)) {
if(!isprint((unsigned char)C)) {
// print three charator escape
strm<<"\\x"<<hexdigit(C>>4)<<hexdigit(C);
} else {
@@ -534,7 +534,7 @@ std::ostream& operator<<(std::ostream& strm, const maybeQuote& q)
esc = true;
break;
default:
if(!isprint(q.s[i])) {
if(!isprint((unsigned char)q.s[i])) {
esc = true;
}
break;