Revert special handling for wchar

develop
kaetemi 4 years ago
parent 932a612f53
commit 1d696b8921

@ -300,13 +300,6 @@ public:
virtual void serial(bool &b) ; virtual void serial(bool &b) ;
#ifndef NL_OS_CYGWIN #ifndef NL_OS_CYGWIN
virtual void serial(char &b) ; virtual void serial(char &b) ;
#endif
#ifdef NL_OS_WINDOWS
inline void serial(wchar_t &b)
{
nlctassert(sizeof(wchar_t) == sizeof(uint16));
serial(reinterpret_cast<uint16 &>(b));
}
#endif #endif
virtual void serial(std::string &b) ; virtual void serial(std::string &b) ;
virtual void serial(ucstring &b) ; virtual void serial(ucstring &b) ;

@ -546,11 +546,7 @@ template<> struct hash<uint64>
* \typedef ucchar * \typedef ucchar
* An Unicode character (16 bits) * An Unicode character (16 bits)
*/ */
#if defined(NL_OS_WINDOWS)
typedef wchar_t ucchar;
#else
typedef uint16 ucchar; typedef uint16 ucchar;
#endif
#ifdef NL_CPP14 #ifdef NL_CPP14
typedef char32_t u32char; typedef char32_t u32char;

@ -30,11 +30,7 @@
* An unicode string class (16 bits per character). * An unicode string class (16 bits per character).
* Add features to convert and assign \c ucstring to \c string and \c string to \c ucstring. * Add features to convert and assign \c ucstring to \c string and \c string to \c ucstring.
*/ */
#if defined(NL_OS_WINDOWS)
typedef std::wstring ucstringbase;
#else
typedef std::basic_string<ucchar> ucstringbase; typedef std::basic_string<ucchar> ucstringbase;
#endif
class ucstring : public ucstringbase class ucstring : public ucstringbase
{ {

@ -168,7 +168,7 @@ bool CSystemUtils::copyTextToClipboard(const ucstring &text)
// allocates a buffer to copy text in global memory // allocates a buffer to copy text in global memory
std::string textLocal; std::string textLocal;
if (!isUnicode) textLocal = NLMISC::wideToMbcs(text); if (!isUnicode) textLocal = NLMISC::wideToMbcs((const wchar_t *)text.c_str(), text.size());
if (text.size() && !textLocal.size()) textLocal = text.toString(); if (text.size() && !textLocal.size()) textLocal = text.toString();
HGLOBAL mem = GlobalAlloc(GHND | GMEM_DDESHARE, isUnicode ? ((text.size() + 1) * sizeof(wchar_t)) : textLocal.size()); HGLOBAL mem = GlobalAlloc(GHND | GMEM_DDESHARE, isUnicode ? ((text.size() + 1) * sizeof(wchar_t)) : textLocal.size());
@ -232,7 +232,7 @@ bool CSystemUtils::pasteTextFromClipboard(ucstring &text)
} }
else else
{ {
static_cast<std::wstring &>(text) = NLMISC::mbcsToWide((const char *)hLock); reinterpret_cast<std::wstring &>(text) = NLMISC::mbcsToWide((const char *)hLock);
if (!text.size() && ((const char *)hLock)[0]) if (!text.size() && ((const char *)hLock)[0])
text = (const char *)hLock; text = (const char *)hLock;
} }

Loading…
Cancel
Save