X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e5cceba0eabb781b09b3fdb87453b50bdc951a12..e9c54ec33655bfa9a57eb7955b114621fb940e1f:/src/common/strconv.cpp diff --git a/src/common/strconv.cpp b/src/common/strconv.cpp index a95b15e28c..25620c07c5 100644 --- a/src/common/strconv.cpp +++ b/src/common/strconv.cpp @@ -54,7 +54,7 @@ WXDLLEXPORT_DATA(wxCSConv) wxConvLocal((const wxChar *)NULL); #else // stand-ins in absence of wchar_t - WXDLLEXPORT_DATA(wxMBConv) wxConvLibc, wxConvFile; + WXDLLEXPORT_DATA(wxMBConv) wxConvLibc, wxConvFile, wxConvLocal; #endif // wxUSE_WCHAR_T WXDLLEXPORT_DATA(wxMBConv *) wxConvCurrent = &wxConvLibc; @@ -244,7 +244,7 @@ const wxCharBuffer wxMBConv::cWC2MB(const wchar_t *pwz) const // return value excludes NUL size_t nLen = pwz ? WC2MB((char *) NULL, pwz, 0) : (size_t)-1; if (nLen == (size_t)-1) - return wxCharBuffer(NULL); + return wxCharBuffer((const char *)NULL); wxCharBuffer buf(nLen); // this allocates nLen+1 WC2MB((char *)(const char *) buf, pwz, nLen+1); @@ -779,7 +779,11 @@ public: size_t MB2WC(wchar_t *buf, const char *psz, size_t n) { size_t len = +#ifdef __WXWINE__ + MultiByteToWideChar(m_CodePage, 0, psz, -1, (WCHAR*) buf, buf ? n : 0); +#else MultiByteToWideChar(m_CodePage, 0, psz, -1, buf, buf ? n : 0); +#endif //VS: returns # of written chars for buf!=NULL and *size* // needed buffer for buf==NULL return len ? (buf ? len : len-1) : (size_t)-1; @@ -787,8 +791,13 @@ public: size_t WC2MB(char *buf, const wchar_t *psz, size_t n) { +#ifdef __WXWINE__ + size_t len = WideCharToMultiByte(m_CodePage, 0, (const WCHAR*) psz, -1, buf, + buf ? n : 0, NULL, NULL); +#else size_t len = WideCharToMultiByte(m_CodePage, 0, psz, -1, buf, buf ? n : 0, NULL, NULL); +#endif //VS: returns # of written chars for buf!=NULL and *size* // needed buffer for buf==NULL return len ? (buf ? len : len-1) : (size_t)-1;