bool WXDLLEXPORT wxOKlibc()
{
-#if wxUSE_WCHAR_T && defined(__UNIX__) && defined(__GLIBC__)
+#if wxUSE_WCHAR_T && defined(__UNIX__) && defined(__GLIBC__) && !defined(__WINE__)
// glibc 2.0 uses UTF-8 even when it shouldn't
wchar_t res = 0;
if ((MB_CUR_MAX == 2) &&
#endif // wxNEED_PRINTF_CONVERSION
+#if wxUSE_WCHAR_T
+
// ----------------------------------------------------------------------------
// ctype.h stuff (currently unused)
// ----------------------------------------------------------------------------
WXDLLEXPORT int wxToupper(wxChar ch) { return (wxChar)CharUpper((LPTSTR)(ch)); }
#endif
-#ifndef wxStrdup
-WXDLLEXPORT wxChar * wxStrdup(const wxChar *psz)
+#ifndef wxStrdupA
+
+WXDLLEXPORT char *wxStrdupA(const char *s)
{
- size_t size = (wxStrlen(psz) + 1) * sizeof(wxChar);
- wxChar *ret = (wxChar *) malloc(size);
- memcpy(ret, psz, size);
+ return strcpy((char *)malloc(strlen(s) + 1), s);
+}
+
+#endif // wxStrdupA
+
+#ifndef wxStrdupW
+
+WXDLLEXPORT wchar_t * wxStrdupW(const wchar_t *pwz)
+{
+ size_t size = (wxWcslen(pwz) + 1) * sizeof(wchar_t);
+ wchar_t *ret = (wchar_t *) malloc(size);
+ memcpy(ret, pwz, size);
return ret;
}
-#endif
+
+#endif // wxStrdupW
#ifndef wxStricmp
int WXDLLEXPORT wxStricmp(const wxChar *psz1, const wxChar *psz2)
}
#endif
-#ifndef wxStrtok
-WXDLLEXPORT wxChar * wxStrtok(wxChar *psz, const wxChar *delim, wxChar **save_ptr)
-{
- if (!psz)
- {
- psz = *save_ptr;
- if ( !psz )
- return NULL;
- }
-
- psz += wxStrspn(psz, delim);
- if (!*psz)
- {
- *save_ptr = (wxChar *)NULL;
- return (wxChar *)NULL;
- }
-
- wxChar *ret = psz;
- psz = wxStrpbrk(psz, delim);
- if (!psz)
- {
- *save_ptr = (wxChar*)NULL;
- }
- else
- {
- *psz = wxT('\0');
- *save_ptr = psz + 1;
- }
-
- return ret;
-}
-#endif // wxStrtok
-
#ifndef wxSetlocale
WXDLLEXPORT wxWCharBuffer wxSetlocale(int category, const wxChar *locale)
{
return system(wxConvLocal.cWX2MB(psz));
}
-#endif
+#endif // wxNEED_WX_STDLIB_H
#ifdef wxNEED_WX_TIME_H
WXDLLEXPORT size_t wxStrftime(wxChar *s, size_t max, const wxChar *fmt, const struct tm *tm)
return 0;
}
}
-#endif
+#endif // wxNEED_WX_TIME_H
+
+#endif // wxUSE_WCHAR_T
+
+// ----------------------------------------------------------------------------
+// functions which we may need even if !wxUSE_WCHAR_T
+// ----------------------------------------------------------------------------
+
+#ifndef wxStrtok
+
+WXDLLEXPORT wxChar * wxStrtok(wxChar *psz, const wxChar *delim, wxChar **save_ptr)
+{
+ if (!psz)
+ {
+ psz = *save_ptr;
+ if ( !psz )
+ return NULL;
+ }
+
+ psz += wxStrspn(psz, delim);
+ if (!*psz)
+ {
+ *save_ptr = (wxChar *)NULL;
+ return (wxChar *)NULL;
+ }
+
+ wxChar *ret = psz;
+ psz = wxStrpbrk(psz, delim);
+ if (!psz)
+ {
+ *save_ptr = (wxChar*)NULL;
+ }
+ else
+ {
+ *psz = wxT('\0');
+ *save_ptr = psz + 1;
+ }
+
+ return ret;
+}
+
+#endif // wxStrtok
+