From a4c0a06821a6f77ee1d7aebeb2eee02bb7aa913d Mon Sep 17 00:00:00 2001 From: Stef Date: Wed, 31 Mar 2004 04:04:16 +0000 Subject: Unix porting Unix porting --- src/sablotr.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/sablotr.cpp') 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& 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& 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& 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; } -- cgit v1.2.3