Always use standard mbstowcs() and wcstombs() functions.
Don't provide our own (not fully functional) definitions of them and always use the system versions as we don't support OS X 10.2 which was the last platform where these functions didn't exist/work. See #15580. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75024 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -565,24 +565,6 @@ WXDLLIMPEXP_BASE wchar_t * wxCRT_GetenvW(const wchar_t *name);
|
|||||||
/* wcstoi doesn't exist */
|
/* wcstoi doesn't exist */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __DARWIN__
|
|
||||||
#if !defined(__WXOSX_IPHONE__) && MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_2
|
|
||||||
#define wxNEED_WX_MBSTOWCS
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef wxNEED_WX_MBSTOWCS
|
|
||||||
/* even though they are defined and "implemented", they are bad and just
|
|
||||||
stubs so we need our own - we need these even in ANSI builds!! */
|
|
||||||
WXDLLIMPEXP_BASE size_t wxMbstowcs(wchar_t *, const char *, size_t);
|
|
||||||
WXDLLIMPEXP_BASE size_t wxWcstombs(char *, const wchar_t *, size_t);
|
|
||||||
#else
|
|
||||||
#define wxMbstowcs mbstowcs
|
|
||||||
#define wxWcstombs wcstombs
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------
|
/* -------------------------------------------------------------------------
|
||||||
time.h
|
time.h
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
@@ -89,7 +89,7 @@ WXDLLIMPEXP_BASE size_t wxMB2WC(wchar_t *buf, const char *psz, size_t n)
|
|||||||
#ifdef HAVE_WCSRTOMBS
|
#ifdef HAVE_WCSRTOMBS
|
||||||
return mbsrtowcs(buf, &psz, n, &mbstate);
|
return mbsrtowcs(buf, &psz, n, &mbstate);
|
||||||
#else
|
#else
|
||||||
return wxMbstowcs(buf, psz, n);
|
return mbstowcs(buf, psz, n);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,7 +102,7 @@ WXDLLIMPEXP_BASE size_t wxMB2WC(wchar_t *buf, const char *psz, size_t n)
|
|||||||
#ifdef HAVE_WCSRTOMBS
|
#ifdef HAVE_WCSRTOMBS
|
||||||
return mbsrtowcs(NULL, &psz, 0, &mbstate);
|
return mbsrtowcs(NULL, &psz, 0, &mbstate);
|
||||||
#else
|
#else
|
||||||
return wxMbstowcs(NULL, psz, 0);
|
return mbstowcs(NULL, psz, 0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,14 +122,14 @@ WXDLLIMPEXP_BASE size_t wxWC2MB(char *buf, const wchar_t *pwz, size_t n)
|
|||||||
#ifdef HAVE_WCSRTOMBS
|
#ifdef HAVE_WCSRTOMBS
|
||||||
return wcsrtombs(buf, &pwz, n, &mbstate);
|
return wcsrtombs(buf, &pwz, n, &mbstate);
|
||||||
#else
|
#else
|
||||||
return wxWcstombs(buf, pwz, n);
|
return wcstombs(buf, pwz, n);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_WCSRTOMBS
|
#ifdef HAVE_WCSRTOMBS
|
||||||
return wcsrtombs(NULL, &pwz, 0, &mbstate);
|
return wcsrtombs(NULL, &pwz, 0, &mbstate);
|
||||||
#else
|
#else
|
||||||
return wxWcstombs(NULL, pwz, 0);
|
return wcstombs(NULL, pwz, 0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -737,54 +737,6 @@ int wxVsnprintf(wchar_t *str, size_t size, const wxString& format, va_list argpt
|
|||||||
// ctype.h stuff (currently unused)
|
// ctype.h stuff (currently unused)
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
#ifdef wxNEED_WX_MBSTOWCS
|
|
||||||
|
|
||||||
WXDLLIMPEXP_BASE size_t wxMbstowcs (wchar_t * out, const char * in, size_t outlen)
|
|
||||||
{
|
|
||||||
if (!out)
|
|
||||||
{
|
|
||||||
size_t outsize = 0;
|
|
||||||
while(*in++)
|
|
||||||
outsize++;
|
|
||||||
return outsize;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* origin = in;
|
|
||||||
|
|
||||||
while (outlen-- && *in)
|
|
||||||
{
|
|
||||||
*out++ = (wchar_t) *in++;
|
|
||||||
}
|
|
||||||
|
|
||||||
*out = '\0';
|
|
||||||
|
|
||||||
return in - origin;
|
|
||||||
}
|
|
||||||
|
|
||||||
WXDLLIMPEXP_BASE size_t wxWcstombs (char * out, const wchar_t * in, size_t outlen)
|
|
||||||
{
|
|
||||||
if (!out)
|
|
||||||
{
|
|
||||||
size_t outsize = 0;
|
|
||||||
while(*in++)
|
|
||||||
outsize++;
|
|
||||||
return outsize;
|
|
||||||
}
|
|
||||||
|
|
||||||
const wchar_t* origin = in;
|
|
||||||
|
|
||||||
while (outlen-- && *in)
|
|
||||||
{
|
|
||||||
*out++ = (char) *in++;
|
|
||||||
}
|
|
||||||
|
|
||||||
*out = '\0';
|
|
||||||
|
|
||||||
return in - origin;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // wxNEED_WX_MBSTOWCS
|
|
||||||
|
|
||||||
#ifndef wxCRT_StrdupA
|
#ifndef wxCRT_StrdupA
|
||||||
WXDLLIMPEXP_BASE char *wxCRT_StrdupA(const char *s)
|
WXDLLIMPEXP_BASE char *wxCRT_StrdupA(const char *s)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user