diff options
Diffstat (limited to 'src/sablotr.cpp')
-rw-r--r-- | src/sablotr.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/sablotr.cpp b/src/sablotr.cpp index 3b62cd6..218f0b8 100644 --- a/src/sablotr.cpp +++ b/src/sablotr.cpp @@ -80,10 +80,10 @@ bool DOM::transcode8to16(const std::basic_string<char>& data, (c[2] & 0xC0) == 0x80 && (c[3] & 0xC0) == 0x80) { - ret.append(1, ((wchar_t)c[0] & 7) << 18 | + ret.append(1, (wchar_t)(((wchar_t)c[0] & 7) << 18 | ((wchar_t)c[1] & 63) << 12 | ((wchar_t)c[2] & 63) << 6 | - ((wchar_t)c[3] & 63)); + ((wchar_t)c[3] & 63))); c += 3; } @@ -92,9 +92,9 @@ bool DOM::transcode8to16(const std::basic_string<char>& data, (c[1] & 0xC0) == 0x80 && (c[2] & 0xC0) == 0x80) { - ret.append(1, ((wchar_t)c[0] & 15) << 12 | + ret.append(1, (wchar_t)(((wchar_t)c[0] & 15) << 12 | ((wchar_t)c[1] & 63) << 6 | - ((wchar_t)c[2] & 63)); + ((wchar_t)c[2] & 63))); c += 2; } @@ -102,8 +102,8 @@ bool DOM::transcode8to16(const std::basic_string<char>& data, else if((c[0] & 0xE0) == 0xC0 && (c[1] & 0xC0) == 0x80) { - ret.append(1, ((wchar_t)c[0] & 31) << 6 | - ((wchar_t)c[1] & 63)); + ret.append(1, (wchar_t)(((wchar_t)c[0] & 31) << 6 | + ((wchar_t)c[1] & 63))); c += 1; } |