Skip to content

Commit 0b424a7

Browse files
committed
isprint() wants value in range [-1, 255]
The MSVC impl. assert()s this
1 parent 45671fa commit 0b424a7

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/factory/printer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ std::ostream& operator<<(std::ostream& strm, const escape& Q)
497497
case '\'': next = '\''; break;
498498
case '\"': next = '\"'; if(Q.S==escape::CSV) quote = '"'; break;
499499
default:
500-
if(!isprint(C)) {
500+
if(!isprint((unsigned char)C)) {
501501
// print three charator escape
502502
strm<<"\\x"<<hexdigit(C>>4)<<hexdigit(C);
503503
} else {
@@ -534,7 +534,7 @@ std::ostream& operator<<(std::ostream& strm, const maybeQuote& q)
534534
esc = true;
535535
break;
536536
default:
537-
if(!isprint(q.s[i])) {
537+
if(!isprint((unsigned char)q.s[i])) {
538538
esc = true;
539539
}
540540
break;

testApp/misc/testprinter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,15 +247,15 @@ void showNTTable()
247247
iarr.push_back(42); // will not be shown
248248
input->getSubFieldT<pvd::PVIntArray>("value.colA")->replace(pvd::freeze(iarr));
249249

250-
sarr.push_back("one\x7f");
250+
sarr.push_back("one\x7f\x80");
251251
sarr.push_back("two words");
252252
sarr.push_back("A '\"'");
253253
input->getSubFieldT<pvd::PVStringArray>("value.colB")->replace(pvd::freeze(sarr));
254254

255255

256256
testDiff("<undefined> \n"
257257
"labelA \"label B\"\n"
258-
" 1 one\\x7F\n"
258+
" 1 one\\x7F\\x80\n"
259259
" 2 \"two words\"\n"
260260
" 3 \"A \\'\"\"\\'\"\n"
261261
, print(input->stream()),

0 commit comments

Comments
 (0)