From 0cb92317201a79b1c34c76d4133b23c6fa4842ad Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Sun, 17 Feb 2019 22:20:50 -0800 Subject: [PATCH] Avoid shifting negative value --- src/common/strconv.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/strconv.cpp b/src/common/strconv.cpp index 88f22fe95d..560322317a 100644 --- a/src/common/strconv.cpp +++ b/src/common/strconv.cpp @@ -1425,7 +1425,7 @@ size_t wxMBConvUTF8::FromWChar(char *buf, size_t n, len += cnt + 1; if (buf) { - *buf++ = (char) ((-128 >> cnt) | ((cc >> (cnt * 6)) & (0x3f >> cnt))); + *buf++ = (char) ((~0x7fu >> cnt) | ((cc >> (cnt * 6)) & (0x3f >> cnt))); while (cnt--) *buf++ = (char) (0x80 | ((cc >> (cnt * 6)) & 0x3f)); }