From 1fe509c0c26b31ee654dda17be99205362024f68 Mon Sep 17 00:00:00 2001 From: Bernard Normier Date: Thu, 22 Sep 2005 14:01:13 +0000 Subject: Ported IceUtil to VS 2005 Beta 2 x64 --- cpp/src/IceUtil/Unicode.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'cpp/src/IceUtil/Unicode.cpp') diff --git a/cpp/src/IceUtil/Unicode.cpp b/cpp/src/IceUtil/Unicode.cpp index 8fbe1267af5..724139f25bd 100644 --- a/cpp/src/IceUtil/Unicode.cpp +++ b/cpp/src/IceUtil/Unicode.cpp @@ -45,6 +45,7 @@ IceUtil::wstringToString(const wstring& str) result += 0x80 | ((wc>>6) & 0x3f); result += 0x80 | (wc & 0x3f); } +#if SIZEOF_WCHAR_T >= 4 else if(wc < 0x10FFFF) { result += 0xf0 | (wc>>18); @@ -52,6 +53,7 @@ IceUtil::wstringToString(const wstring& str) result += 0x80 | ((wc>>6) & 0x3f); result += 0x80 | (wc & 0x3f); } +#endif else { return result; // Error, not encodable. @@ -159,11 +161,13 @@ IceUtil::stringToWstring(const string& str) // // See comments in IceUtil/Unicode.h // + +# if _MSC_VER < 1400 string IceUtil::wstringToString(const basic_string<__wchar_t>& str) { assert(sizeof(__wchar_t) == SIZEOF_WCHAR_T); - return wstringToString(*reinterpret_cast(&str)); + return wstringToString(*reinterpret_cast(&str)); } basic_string<__wchar_t> @@ -172,5 +176,20 @@ IceUtil::stringToNativeWstring(const string& str) assert(sizeof(__wchar_t) == SIZEOF_WCHAR_T); return reinterpret_cast& >(stringToWstring(str)); } +# else +string +IceUtil::wstringToString(const basic_string& str) +{ + assert(sizeof(__wchar_t) == SIZEOF_WCHAR_T); + return wstringToString(*reinterpret_cast(&str)); +} + +basic_string +IceUtil::stringToTypedefWstring(const string& str) +{ + assert(sizeof(__wchar_t) == SIZEOF_WCHAR_T); + return reinterpret_cast& >(stringToWstring(str)); +} +# endif #endif -- cgit v1.2.3