Browse Source

in encode_utf8, there is an implicit truncating cast that VS2015CTP6 is

warning about.  I've added static_cast<char> to silence the warning and
express the intent.
master
Steve Carroll 8 years ago
committed by Jacob Potter
parent
commit
ae9542cc35
  1. 20
      json11.cpp

20
json11.cpp

@ -381,19 +381,19 @@ struct JsonParser {
return;
if (pt < 0x80) {
out += pt;
out += static_cast<char>(pt);
} else if (pt < 0x800) {
out += (pt >> 6) | 0xC0;
out += (pt & 0x3F) | 0x80;
out += static_cast<char>((pt >> 6) | 0xC0);
out += static_cast<char>((pt & 0x3F) | 0x80);
} else if (pt < 0x10000) {
out += (pt >> 12) | 0xE0;
out += ((pt >> 6) & 0x3F) | 0x80;
out += (pt & 0x3F) | 0x80;
out += static_cast<char>((pt >> 12) | 0xE0);
out += static_cast<char>(((pt >> 6) & 0x3F) | 0x80);
out += static_cast<char>((pt & 0x3F) | 0x80);
} else {
out += (pt >> 18) | 0xF0;
out += ((pt >> 12) & 0x3F) | 0x80;
out += ((pt >> 6) & 0x3F) | 0x80;
out += (pt & 0x3F) | 0x80;
out += static_cast<char>((pt >> 18) | 0xF0);
out += static_cast<char>(((pt >> 12) & 0x3F) | 0x80);
out += static_cast<char>(((pt >> 6) & 0x3F) | 0x80);
out += static_cast<char>((pt & 0x3F) | 0x80);
}
}

Loading…
Cancel
Save