THRIFT-3755 TDebugProtocol::writeString hits assert in isprint on Windows with debug CRT

This closes #960
This commit is contained in:
tpcwang 2016-03-23 15:22:33 -07:00 committed by Nobuaki Sukegawa
parent 6657b8337d
commit 3bf5bf9933

View File

@ -347,7 +347,9 @@ uint32_t TDebugProtocol::writeString(const string& str) {
output += "\\\\"; output += "\\\\";
} else if (*it == '"') { } else if (*it == '"') {
output += "\\\""; output += "\\\"";
} else if (std::isprint(*it)) { // passing characters <0 to std::isprint causes asserts. isprint takes an
// int, so we need to be careful of sign extension
} else if (std::isprint((unsigned char)*it)) {
output += *it; output += *it;
} else { } else {
switch (*it) { switch (*it) {