no changes, finally
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17481 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -766,6 +766,12 @@ size_t IC_CharSet::WC2MB(char *buf, const wchar_t *psz, size_t n)
|
|||||||
|
|
||||||
#if defined(__WIN32__) && !defined(__WXMICROWIN__)
|
#if defined(__WIN32__) && !defined(__WXMICROWIN__)
|
||||||
|
|
||||||
|
#ifdef __WXWINE__
|
||||||
|
#define WINE_CAST (WCHAR *)
|
||||||
|
#else
|
||||||
|
#define WINE_CAST
|
||||||
|
#endif
|
||||||
|
|
||||||
extern long wxCharsetToCodepage(const wxChar *charset); // from utils.cpp
|
extern long wxCharsetToCodepage(const wxChar *charset); // from utils.cpp
|
||||||
|
|
||||||
class CP_CharSet : public wxCharacterSet
|
class CP_CharSet : public wxCharacterSet
|
||||||
@@ -779,29 +785,37 @@ public:
|
|||||||
|
|
||||||
size_t MB2WC(wchar_t *buf, const char *psz, size_t n)
|
size_t MB2WC(wchar_t *buf, const char *psz, size_t n)
|
||||||
{
|
{
|
||||||
size_t len =
|
const size_t len = ::MultiByteToWideChar
|
||||||
#ifdef __WXWINE__
|
(
|
||||||
MultiByteToWideChar(m_CodePage, 0, psz, -1, (WCHAR*) buf, buf ? n : 0);
|
m_CodePage, // code page
|
||||||
#else
|
0, // flags (none)
|
||||||
MultiByteToWideChar(m_CodePage, 0, psz, -1, buf, buf ? n : 0);
|
psz, // input string
|
||||||
#endif
|
-1, // its length (NUL-terminated)
|
||||||
//VS: returns # of written chars for buf!=NULL and *size*
|
WINE_CAST buf, // output string
|
||||||
// needed buffer for buf==NULL
|
buf ? n : 0 // size of output buffer
|
||||||
return len ? (buf ? len : len-1) : (size_t)-1;
|
);
|
||||||
|
|
||||||
|
// note that it returns # of written chars for buf != NULL and *size*
|
||||||
|
// of the needed buffer for buf == NULL
|
||||||
|
return len ? (buf ? len : len - 1) : (size_t)-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t WC2MB(char *buf, const wchar_t *psz, size_t n)
|
size_t WC2MB(char *buf, const wchar_t *psz, size_t n)
|
||||||
{
|
{
|
||||||
#ifdef __WXWINE__
|
const size_t len = ::WideCharToMultiByte
|
||||||
size_t len = WideCharToMultiByte(m_CodePage, 0, (const WCHAR*) psz, -1, buf,
|
(
|
||||||
buf ? n : 0, NULL, NULL);
|
m_CodePage, // code page
|
||||||
#else
|
0, // flags (none)
|
||||||
size_t len = WideCharToMultiByte(m_CodePage, 0, psz, -1, buf,
|
WINE_CAST psz, // input string
|
||||||
buf ? n : 0, NULL, NULL);
|
-1, // it is (wide) NUL-terminated
|
||||||
#endif
|
buf, // output buffer
|
||||||
//VS: returns # of written chars for buf!=NULL and *size*
|
buf ? n : 0, // and its size
|
||||||
// needed buffer for buf==NULL
|
NULL, // default "replacement" char
|
||||||
return len ? (buf ? len : len-1) : (size_t)-1;
|
NULL // [out] was it used?
|
||||||
|
);
|
||||||
|
|
||||||
|
// see the comment above!
|
||||||
|
return len ? (buf ? len : len - 1) : (size_t)-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool usable() const
|
bool usable() const
|
||||||
|
Reference in New Issue
Block a user