Kaydet (Commit) cf704d65 authored tarafından Tor Lillqvist's avatar Tor Lillqvist

WaE: comparison of constant 255 with expression of type 'const char'

Better fix for warning: "comparison of constant 255 with expression of
type 'const char' is always true". I hadn't considered that the code
is in a template, so it must handle strings of arbitrary integer types
(well, Unicode).

Change-Id: I38d6d480bfc3ff89db1276cac38d310ecdcc2cfa
üst 6fa98a08
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
// handle high unicode characters. // handle high unicode characters.
if (*b == 0x20 || *b == 0x21 || (*b >= 0x23 && *b <= 0x2E) || if (*b == 0x20 || *b == 0x21 || (*b >= 0x23 && *b <= 0x2E) ||
- (*b >= 0x30 && *b <= 0x5B) || (*b >= 0x5D && *b <= 0xFF)) - (*b >= 0x30 && *b <= 0x5B) || (*b >= 0x5D && *b <= 0xFF))
+ (*b >= 0x30 && *b <= 0x5B) || (*b >= 0x5D)) + (*b >= 0x30 && *b <= 0x5B) || (*b >= 0x5D && static_cast<typename std::basic_string<Ch>::traits_type::int_type>(*b) <= 0xFF))
result += *b; result += *b;
else if (*b == Ch('\b')) result += Ch('\\'), result += Ch('b'); else if (*b == Ch('\b')) result += Ch('\\'), result += Ch('b');
else if (*b == Ch('\f')) result += Ch('\\'), result += Ch('f'); else if (*b == Ch('\f')) result += Ch('\\'), result += Ch('f');
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment