From ae9542cc35cedd69e7d74056bf2c0963eff7a470 Mon Sep 17 00:00:00 2001 From: Steve Carroll Date: Tue, 3 Mar 2015 17:47:56 -0800 Subject: [PATCH] in encode_utf8, there is an implicit truncating cast that VS2015CTP6 is warning about. I've added static_cast to silence the warning and express the intent. --- json11.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/json11.cpp b/json11.cpp index 3d28c40..2dc955a 100644 --- a/json11.cpp +++ b/json11.cpp @@ -381,19 +381,19 @@ struct JsonParser { return; if (pt < 0x80) { - out += pt; + out += static_cast(pt); } else if (pt < 0x800) { - out += (pt >> 6) | 0xC0; - out += (pt & 0x3F) | 0x80; + out += static_cast((pt >> 6) | 0xC0); + out += static_cast((pt & 0x3F) | 0x80); } else if (pt < 0x10000) { - out += (pt >> 12) | 0xE0; - out += ((pt >> 6) & 0x3F) | 0x80; - out += (pt & 0x3F) | 0x80; + out += static_cast((pt >> 12) | 0xE0); + out += static_cast(((pt >> 6) & 0x3F) | 0x80); + out += static_cast((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((pt >> 18) | 0xF0); + out += static_cast(((pt >> 12) & 0x3F) | 0x80); + out += static_cast(((pt >> 6) & 0x3F) | 0x80); + out += static_cast((pt & 0x3F) | 0x80); } }