#include "wx/log.h"
#endif
-#if defined(__WIN32__) && defined(wxNEED_WX_CTYPE_H)
- #include <windef.h>
- #include <winbase.h>
- #include <winnls.h>
- #include <winnt.h>
-#endif
-
#ifdef __WXWINCE__
// there is no errno.h under CE apparently
#define wxSET_ERRNO(value)
return -1;
}
-#define vswprintf wxCRT_VsnprintfW_
+#define vswprintf wxCRT_VsnprintfW
static int vfwprintf(FILE *stream, const wchar_t *format, va_list argptr)
{
#endif // wxNEED_WPRINTF
-#ifdef wxNEED_PRINTF_CONVERSION
-
-// ----------------------------------------------------------------------------
-// wxFormatConverter: class doing the "%s" -> "%ls" conversion
-// ----------------------------------------------------------------------------
-
-/*
- Here are the gory details. We want to follow the Windows/MS conventions,
- that is to have
-
- In ANSI mode:
-
- format specifier results in
- -----------------------------------
- %c, %hc, %hC char
- %lc, %C, %lC wchar_t
-
- In Unicode mode:
-
- format specifier results in
- -----------------------------------
- %hc, %C, %hC char
- %c, %lc, %lC wchar_t
-
-
- while on POSIX systems we have %C identical to %lc and %c always means char
- (in any mode) while %lc always means wchar_t,
-
- So to use native functions in order to get our semantics we must do the
- following translations in Unicode mode (nothing to do in ANSI mode):
-
- wxWidgets specifier POSIX specifier
- ----------------------------------------
-
- %hc, %C, %hC %c
- %c %lc
-
-
- And, of course, the same should be done for %s as well.
-*/
-
-class wxFormatConverter
-{
-public:
- wxFormatConverter(const wchar_t *format);
-
- // notice that we only translated the string if m_fmtOrig == NULL (as set
- // by CopyAllBefore()), otherwise we should simply use the original format
- operator const wchar_t *() const
- { return m_fmtOrig ? m_fmtOrig : m_fmt.c_str(); }
-
-private:
- // copy another character to the translated format: this function does the
- // copy if we are translating but doesn't do anything at all if we don't,
- // so we don't create the translated format string at all unless we really
- // need to (i.e. InsertFmtChar() is called)
- wchar_t CopyFmtChar(wchar_t ch)
- {
- if ( !m_fmtOrig )
- {
- // we're translating, do copy
- m_fmt += ch;
- }
- else
- {
- // simply increase the count which should be copied by
- // CopyAllBefore() later if needed
- m_nCopied++;
- }
-
- return ch;
- }
-
- // insert an extra character
- void InsertFmtChar(wchar_t ch)
- {
- if ( m_fmtOrig )
- {
- // so far we haven't translated anything yet
- CopyAllBefore();
- }
-
- m_fmt += ch;
- }
-
- void CopyAllBefore()
- {
- wxASSERT_MSG( m_fmtOrig && m_fmt.empty(), _T("logic error") );
-
- m_fmt = wxString(m_fmtOrig, m_nCopied);
-
- // we won't need it any longer
- m_fmtOrig = NULL;
- }
-
- static bool IsFlagChar(wchar_t ch)
- {
- return ch == _T('-') || ch == _T('+') ||
- ch == _T('0') || ch == _T(' ') || ch == _T('#');
- }
-
- void SkipDigits(const wchar_t **ptpc)
- {
- while ( **ptpc >= _T('0') && **ptpc <= _T('9') )
- CopyFmtChar(*(*ptpc)++);
- }
-
- // the translated format
- wxString m_fmt;
-
- // the original format
- const wchar_t *m_fmtOrig;
-
- // the number of characters already copied
- size_t m_nCopied;
-};
-
-wxFormatConverter::wxFormatConverter(const wchar_t *format)
-{
- m_fmtOrig = format;
- m_nCopied = 0;
-
- while ( *format )
- {
- if ( CopyFmtChar(*format++) == _T('%') )
- {
- // skip any flags
- while ( IsFlagChar(*format) )
- CopyFmtChar(*format++);
-
- // and possible width
- if ( *format == _T('*') )
- CopyFmtChar(*format++);
- else
- SkipDigits(&format);
-
- // precision?
- if ( *format == _T('.') )
- {
- CopyFmtChar(*format++);
- if ( *format == _T('*') )
- CopyFmtChar(*format++);
- else
- SkipDigits(&format);
- }
-
- // next we can have a size modifier
- enum
- {
- Default,
- Short,
- Long
- } size;
-
- switch ( *format )
- {
- case _T('h'):
- size = Short;
- format++;
- break;
-
- case _T('l'):
- // "ll" has a different meaning!
- if ( format[1] != _T('l') )
- {
- size = Long;
- format++;
- break;
- }
- //else: fall through
-
- default:
- size = Default;
- }
-
- // and finally we should have the type
- switch ( *format )
- {
- case _T('C'):
- case _T('S'):
- // %C and %hC -> %c and %lC -> %lc
- if ( size == Long )
- CopyFmtChar(_T('l'));
-
- InsertFmtChar(*format++ == _T('C') ? _T('c') : _T('s'));
- break;
-
- case _T('c'):
- case _T('s'):
- // %c -> %lc but %hc stays %hc and %lc is still %lc
- if ( size == Default)
- InsertFmtChar(_T('l'));
- // fall through
-
- default:
- // nothing special to do
- if ( size != Default )
- CopyFmtChar(*(format - 1));
- CopyFmtChar(*format++);
- }
- }
- }
-}
-
-#else // !wxNEED_PRINTF_CONVERSION
- // no conversion necessary
- #define wxFormatConverter(x) (x)
-#endif // wxNEED_PRINTF_CONVERSION/!wxNEED_PRINTF_CONVERSION
-
-#ifdef __WXDEBUG__
-// For testing the format converter
-wxString wxConvertFormat(const wchar_t *format)
-{
- return wxString(wxFormatConverter(format));
-}
-#endif
-
// ----------------------------------------------------------------------------
// wxPrintf(), wxScanf() and relatives
// ----------------------------------------------------------------------------
va_list argptr;
va_start(argptr, format);
- int ret = vwprintf( wxFormatConverter(format), argptr );
+ int ret = vwprintf( format, argptr );
va_end(argptr);
va_list argptr;
va_start( argptr, format );
- int ret = vfwprintf( stream, wxFormatConverter(format), argptr );
+ int ret = vfwprintf( stream, format, argptr );
va_end(argptr);
#ifndef wxCRT_VfprintfW
int wxCRT_VfprintfW( FILE *stream, const wchar_t *format, va_list argptr )
{
- return vfwprintf( stream, wxFormatConverter(format), argptr );
+ return vfwprintf( stream, format, argptr );
}
#endif
#ifndef wxCRT_VprintfW
int wxCRT_VprintfW( const wchar_t *format, va_list argptr )
{
- return vwprintf( wxFormatConverter(format), argptr );
+ return vwprintf( format, argptr );
}
#endif
-#ifndef wxCRT_VsnprintfW
-int wxCRT_VsnprintfW(wchar_t *str, size_t size, const wchar_t *format, va_list argptr )
-{
- return vswprintf( str, size, wxFormatConverter(format), argptr );
-}
-#endif // !wxCRT_VsnprintfW
-
-// FIXME-UTF8: we only implement widechar version of vsnprintf() in wxprint.cpp,
-// so this one has to convert the data for now
-#ifndef wxCRT_VsnprintfA
-int wxCRT_VsnprintfA(char *buf, size_t len, const char *format, va_list argptr)
-{
- wxWCharBuffer wbuf(len);
- int rt = wxCRT_VsnprintfW(wbuf.data(), len,
- (const wchar_t*)wxConvLibc.cMB2WC(format),
- argptr);
- if ( rt < 0 || rt >= (int)len )
- return rt;
-
- if ( wxConvLibc.FromWChar(buf, len, wbuf) == wxCONV_FAILED )
- return -1;
-
- return rt;
-}
-#endif // !wxCRT_VsnprintfA
-
#ifndef wxCRT_VsprintfW
int wxCRT_VsprintfW( wchar_t *str, const wchar_t *format, va_list argptr )
{
// same as for wxSprintf()
- return vswprintf(str, INT_MAX / 4, wxFormatConverter(format), argptr);
+ return vswprintf(str, INT_MAX / 4, format, argptr);
}
#endif
#ifdef __VMS
#if (__DECCXX_VER >= 70100000) && !defined(__STD_CFRONT) && !defined( __NONAMESPACE_STD )
- int ret = std::vwscanf(wxFormatConverter(format), argptr);
+ int ret = std::vwscanf(format, argptr);
#else
- int ret = vwscanf(wxFormatConverter(format), argptr);
+ int ret = vwscanf(format, argptr);
#endif
#else
- int ret = vwscanf(wxFormatConverter(format), argptr);
+ int ret = vwscanf(format, argptr);
#endif
va_end(argptr);
#ifdef __VMS
#if (__DECCXX_VER >= 70100000) && !defined(__STD_CFRONT) && !defined( __NONAMESPACE_STD )
- int ret = std::vswscanf(str, wxFormatConverter(format), argptr);
+ int ret = std::vswscanf(str, format, argptr);
#else
- int ret = vswscanf(str, wxFormatConverter(format), argptr);
+ int ret = vswscanf(str, format, argptr);
#endif
#else
- int ret = vswscanf(str, wxFormatConverter(format), argptr);
+ int ret = vswscanf(str, format, argptr);
#endif
va_end(argptr);
va_start(argptr, format);
#ifdef __VMS
#if (__DECCXX_VER >= 70100000) && !defined(__STD_CFRONT) && !defined( __NONAMESPACE_STD )
- int ret = std::vfwscanf(stream, wxFormatConverter(format), argptr);
+ int ret = std::vfwscanf(stream, format, argptr);
#else
- int ret = vfwscanf(stream, wxFormatConverter(format), argptr);
+ int ret = vfwscanf(stream, format, argptr);
#endif
#else
- int ret = vfwscanf(stream, wxFormatConverter(format), argptr);
+ int ret = vfwscanf(stream, format, argptr);
#endif
va_end(argptr);
{
#ifdef __VMS
#if (__DECCXX_VER >= 70100000) && !defined(__STD_CFRONT) && !defined( __NONAMESPACE_STD )
- return std::vswscanf(str, wxFormatConverter(format), argptr);
+ return std::vswscanf(str, format, argptr);
#else
- return vswscanf(str, wxFormatConverter(format), argptr);
+ return vswscanf(str, format, argptr);
#endif
#else
- return vswscanf(str, wxFormatConverter(format), argptr);
+ return vswscanf(str, format, argptr);
#endif
}
#endif
#if wxUSE_UNICODE
+namespace
+{
+
#if !wxUSE_UTF8_LOCALE_ONLY
-static int ConvertStringToBuf(const wxString& s, char *out, size_t outsize)
+int wxInternalConvertStringToBuf(const wxString& s, char *out, size_t outsize)
{
const wxWX2WCbuf buf = s.wc_str();
#endif // !wxUSE_UTF8_LOCALE_ONLY
#if wxUSE_UNICODE_UTF8
-static int ConvertStringToBuf(const wxString& s, wchar_t *out, size_t outsize)
+int wxInternalConvertStringToBuf(const wxString& s, wchar_t *out, size_t outsize)
{
const wxWX2WCbuf buf(s.wc_str());
size_t len = wxWcslen(buf);
}
#endif // wxUSE_UNICODE_UTF8
+} // anonymous namespace
+
template<typename T>
static size_t PrintfViaString(T *out, size_t outsize,
const wxString& format, va_list argptr)
wxString s;
s.PrintfV(format, argptr);
- return ConvertStringToBuf(s, out, outsize);
+ return wxInternalConvertStringToBuf(s, out, outsize);
}
#endif // wxUSE_UNICODE
int wxVsprintf(char *str, const wxString& format, va_list argptr)
{
#if wxUSE_UTF8_LOCALE_ONLY
- return vsprintf(str, format.wx_str(), argptr);
+ return wxCRT_VsprintfA(str, format.wx_str(), argptr);
#else
#if wxUSE_UNICODE_UTF8
if ( wxLocaleIsUtf8 )
- return vsprintf(str, format.wx_str(), argptr);
+ return wxCRT_VsprintfA(str, format.wx_str(), argptr);
else
#endif
#if wxUSE_UNICODE
// ctype.h stuff (currently unused)
// ----------------------------------------------------------------------------
-#if defined(__WIN32__) && defined(wxNEED_WX_CTYPE_H)
-static inline WORD wxMSW_ctype(wchar_t ch)
-{
- WORD ret;
- GetStringTypeEx(LOCALE_USER_DEFAULT, CT_CTYPE1, &ch, 1, &ret);
- return ret;
-}
-
-int wxCRT_IsalnumW(wchar_t ch) { return IsCharAlphaNumeric(ch); }
-int wxCRT_IsalphaW(wchar_t ch) { return IsCharAlpha(ch); }
-int wxCRT_IscntrlW(wchar_t ch) { return wxMSW_ctype(ch) & C1_CNTRL; }
-int wxCRT_IsdigitW(wchar_t ch) { return wxMSW_ctype(ch) & C1_DIGIT; }
-int wxCRT_IsgraphW(wchar_t ch) { return wxMSW_ctype(ch) & (C1_DIGIT|C1_PUNCT|C1_ALPHA); }
-int wxCRT_IslowerW(wchar_t ch) { return IsCharLower(ch); }
-int wxCRT_IsprintW(wchar_t ch) { return wxMSW_ctype(ch) & (C1_DIGIT|C1_SPACE|C1_PUNCT|C1_ALPHA); }
-int wxCRT_IspunctW(wchar_t ch) { return wxMSW_ctype(ch) & C1_PUNCT; }
-int wxCRT_IsspaceW(wchar_t ch) { return wxMSW_ctype(ch) & C1_SPACE; }
-int wxCRT_IsupperW(wchar_t ch) { return IsCharUpper(ch); }
-int wxCRT_IsxdigitW(wchar_t ch) { return wxMSW_ctype(ch) & C1_XDIGIT; }
-int wxCRT_Tolower(wchar_t ch) { return (wchar_t)CharLower((LPTSTR)(ch)); }
-int wxCRT_Toupper(wchar_t ch) { return (wchar_t)CharUpper((LPTSTR)(ch)); }
-#endif
-
#ifdef wxNEED_WX_MBSTOWCS
WXDLLEXPORT size_t wxMbstowcs (wchar_t * out, const char * in, size_t outlen)
#endif // wxNEED_WX_MBSTOWCS
-#if defined(wxNEED_WX_CTYPE_H)
-
-#include <CoreFoundation/CoreFoundation.h>
-
-#define cfalnumset CFCharacterSetGetPredefined(kCFCharacterSetAlphaNumeric)
-#define cfalphaset CFCharacterSetGetPredefined(kCFCharacterSetLetter)
-#define cfcntrlset CFCharacterSetGetPredefined(kCFCharacterSetControl)
-#define cfdigitset CFCharacterSetGetPredefined(kCFCharacterSetDecimalDigit)
-//CFCharacterSetRef cfgraphset = kCFCharacterSetControl && !' '
-#define cflowerset CFCharacterSetGetPredefined(kCFCharacterSetLowercaseLetter)
-//CFCharacterSetRef cfprintset = !kCFCharacterSetControl
-#define cfpunctset CFCharacterSetGetPredefined(kCFCharacterSetPunctuation)
-#define cfspaceset CFCharacterSetGetPredefined(kCFCharacterSetWhitespaceAndNewline)
-#define cfupperset CFCharacterSetGetPredefined(kCFCharacterSetUppercaseLetter)
-
-int wxCRT_IsalnumW(wchar_t ch) { return CFCharacterSetIsCharacterMember(cfalnumset, ch); }
-int wxCRT_IsalphaW(wchar_t ch) { return CFCharacterSetIsCharacterMember(cfalphaset, ch); }
-int wxCRT_IscntrlW(wchar_t ch) { return CFCharacterSetIsCharacterMember(cfcntrlset, ch); }
-int wxCRT_IsdigitW(wchar_t ch) { return CFCharacterSetIsCharacterMember(cfdigitset, ch); }
-int wxCRT_IsgraphW(wchar_t ch) { return !CFCharacterSetIsCharacterMember(cfcntrlset, ch) && ch != ' '; }
-int wxCRT_IslowerW(wchar_t ch) { return CFCharacterSetIsCharacterMember(cflowerset, ch); }
-int wxCRT_IsprintW(wchar_t ch) { return !CFCharacterSetIsCharacterMember(cfcntrlset, ch); }
-int wxCRT_IspunctW(wchar_t ch) { return CFCharacterSetIsCharacterMember(cfpunctset, ch); }
-int wxCRT_IsspaceW(wchar_t ch) { return CFCharacterSetIsCharacterMember(cfspaceset, ch); }
-int wxCRT_IsupperW(wchar_t ch) { return CFCharacterSetIsCharacterMember(cfupperset, ch); }
-int wxCRT_IsxdigitW(wchar_t ch) { return wxCRT_IsdigitW(ch) || (ch>='a' && ch<='f') || (ch>='A' && ch<='F'); }
-
-// FIXME: these are broken!
-extern "C" int wxCRT_TolowerW(wchar_t ch) { return (wchar_t)tolower((char)(ch)); }
-extern "C" int wxCRT_ToupperW(wchar_t ch) { return (wchar_t)toupper((char)(ch)); }
-
-#endif // wxNEED_WX_CTYPE_H
-
#ifndef wxCRT_StrdupA
WXDLLEXPORT char *wxCRT_StrdupA(const char *s)
{
// string.h functions
// ----------------------------------------------------------------------------
-#ifndef wxCRT_StrcatW
-WXDLLEXPORT wchar_t *wxCRT_StrcatW(wchar_t *dest, const wchar_t *src)
-{
- wchar_t *ret = dest;
- while (*dest) dest++;
- while ((*dest++ = *src++));
- return ret;
-}
-#endif
-
-#ifndef wxCRT_StrchrW
-WXDLLEXPORT const wchar_t *wxCRT_StrchrW(const wchar_t *s, wchar_t c)
-{
- // be careful here as the terminating NUL makes part of the string
- while ( *s != c )
- {
- if ( !*s++ )
- return NULL;
- }
-
- return s;
-}
-#endif
-
-#ifndef wxCRT_StrcmpW
-WXDLLEXPORT int wxCRT_StrcmpW(const wchar_t *s1, const wchar_t *s2)
-{
- while ((*s1 == *s2) && *s1) s1++, s2++;
- if ((wxUChar)*s1 < (wxUChar)*s2) return -1;
- if ((wxUChar)*s1 > (wxUChar)*s2) return 1;
- return 0;
-}
-#endif
-
-#ifndef wxCRT_StrcpyW
-WXDLLEXPORT wchar_t * wxCRT_StrcpyW(wchar_t *dest, const wchar_t *src)
-{
- wchar_t *ret = dest;
- while ((*dest++ = *src++));
- return ret;
-}
-#endif
-
-template<typename T>
-static inline size_t wxCRT_DoStrlen(const T *s)
+// this (and wxCRT_StrncmpW below) are extern "C" because they are needed
+// by regex code, the rest isn't needed, so it's not declared as extern "C"
+#ifndef wxCRT_StrlenW
+extern "C" WXDLLEXPORT size_t wxCRT_StrlenW(const wchar_t *s)
{
size_t n = 0;
while ( *s++ )
return n;
}
-
-// these two (and wxCRT_StrncmpW below) are extern "C" because they are needed
-// by regex code, the rest isn't needed, so it's not declared as extern "C"
-#ifndef wxCRT_StrlenA
-WXDLLEXPORT size_t wxCRT_StrlenA(const char *s)
- { return wxCRT_DoStrlen(s); }
-#endif
-#ifndef wxCRT_StrlenW
-extern "C" WXDLLEXPORT size_t wxCRT_StrlenW(const wchar_t *s)
- { return wxCRT_DoStrlen(s); }
-#endif
-
-#ifndef wxCRT_StrncatW
-WXDLLEXPORT wchar_t * wxCRT_StrncatW(wchar_t *dest, const wchar_t *src, size_t n)
-{
- wchar_t *ret = dest;
- while (*dest) dest++;
- while (n && (*dest++ = *src++)) n--;
- return ret;
-}
-#endif
-
-#ifndef wxCRT_StrncmpW
-extern "C"
-WXDLLEXPORT int wxCRT_StrncmpW(const wchar_t *s1, const wchar_t *s2, size_t n)
-{
- while (n && (*s1 == *s2) && *s1) n--, s1++, s2++;
- if (n) {
- if ((wxUChar)*s1 < (wxUChar)*s2) return -1;
- if ((wxUChar)*s1 > (wxUChar)*s2) return 1;
- }
- return 0;
-}
-#endif
-
-#ifndef wxCRT_StrncpyW
-WXDLLEXPORT wchar_t * wxCRT_StrncpyW(wchar_t *dest, const wchar_t *src, size_t n)
-{
- wchar_t *ret = dest;
- while (n && (*dest++ = *src++)) n--;
- while (n) *dest++=0, n--; // the docs specify padding with zeroes
- return ret;
-}
-#endif
-
-#ifndef wxCRT_StrpbrkW
-WXDLLEXPORT const wchar_t * wxCRT_StrpbrkW(const wchar_t *s, const wchar_t *accept)
-{
- while (*s && !wxCRT_Strchr(accept, *s))
- s++;
-
- return *s ? s : NULL;
-}
-#endif
-
-#ifndef wxCRT_StrrchrW
-WXDLLEXPORT const wchar_t * wxCRT_StrrchrW(const wchar_t *s, wchar_t c)
-{
- const wchar_t *ret = NULL;
- do
- {
- if ( *s == c )
- ret = s;
- s++;
- }
- while ( *s );
-
- return ret;
-}
-#endif
-
-#ifndef wxCRT_StrspnW
-WXDLLEXPORT size_t wxCRT_StrspnW(const wchar_t *s, const wchar_t *accept)
-{
- size_t len = 0;
- while (wxCRT_Strchr(accept, *s++)) len++;
- return len;
-}
-#endif
-
-#ifndef wxCRT_StrstrW
-WXDLLEXPORT const wchar_t *wxCRT_StrstrW(const wchar_t *haystack, const wchar_t *needle)
-{
- wxASSERT_MSG( needle != NULL, _T("NULL argument in wxCRT_Strstr") );
-
- // VZ: this is not exactly the most efficient string search algorithm...
-
- const size_t len = wxStrlen(needle);
-
- while ( const wchar_t *fnd = wxCRT_Strchr(haystack, *needle) )
- {
- if ( !wxCRT_Strncmp(fnd, needle, len) )
- return fnd;
-
- haystack = fnd + 1;
- }
-
- return NULL;
-}
-#endif
-
-#ifndef wxCRT_StrtodW
-WXDLLEXPORT double wxCRT_StrtodW(const wchar_t *nptr, wchar_t **endptr)
-{
- const wchar_t *start = nptr;
-
- // FIXME: only correct for C locale
- while (wxIsspace(*nptr)) nptr++;
- if (*nptr == wxT('+') || *nptr == wxT('-')) nptr++;
- while (wxIsdigit(*nptr)) nptr++;
- if (*nptr == wxT('.')) {
- nptr++;
- while (wxIsdigit(*nptr)) nptr++;
- }
- if (*nptr == wxT('E') || *nptr == wxT('e')) {
- nptr++;
- if (*nptr == wxT('+') || *nptr == wxT('-')) nptr++;
- while (wxIsdigit(*nptr)) nptr++;
- }
-
- wxString data(nptr, nptr-start);
- wxWX2MBbuf dat = data.mb_str(wxConvLibc);
- char *rdat = wxMBSTRINGCAST dat;
- double ret = strtod(dat, &rdat);
-
- if (endptr) *endptr = (wchar_t *)(start + (rdat - (const char *)dat));
-
- return ret;
-}
-#endif // !wxCRT_StrtodW
-
-#ifndef wxCRT_StrtolW
-WXDLLEXPORT long int wxCRT_StrtolW(const wchar_t *nptr, wchar_t **endptr, int base)
-{
- const wchar_t *start = nptr;
-
- // FIXME: only correct for C locale
- while (wxIsspace(*nptr)) nptr++;
- if (*nptr == wxT('+') || *nptr == wxT('-')) nptr++;
- if (((base == 0) || (base == 16)) &&
- (nptr[0] == wxT('0') && nptr[1] == wxT('x'))) {
- nptr += 2;
- base = 16;
- }
- else if ((base == 0) && (nptr[0] == wxT('0'))) base = 8;
- else if (base == 0) base = 10;
-
- while ((wxIsdigit(*nptr) && (*nptr - wxT('0') < base)) ||
- (wxIsalpha(*nptr) && (wxToupper(*nptr) - wxT('A') + 10 < base))) nptr++;
-
- wxString data(start, nptr-start);
- wxWX2MBbuf dat = data.mb_str(wxConvLibc);
- char *rdat = wxMBSTRINGCAST dat;
- long int ret = strtol(dat, &rdat, base);
-
- if (endptr) *endptr = (wchar_t *)(start + (rdat - (const char *)dat));
-
- return ret;
-}
-#endif // !wxCRT_StrtolW
-
-#ifndef wxCRT_StrtoulW
-WXDLLEXPORT unsigned long int wxCRT_StrtoulW(const wchar_t *nptr, wchar_t **endptr, int base)
-{
- return (unsigned long int) wxCRT_StrtolW(nptr, endptr, base);
-}
#endif
-
+// ----------------------------------------------------------------------------
+// stdlib.h functions
+// ----------------------------------------------------------------------------
#ifndef wxCRT_GetenvW
wchar_t* WXDLLEXPORT wxCRT_GetenvW(const wchar_t *name)
#endif // wxUSE_WCHAR_T
+#ifdef wxLongLong_t
template<typename T>
static wxULongLong_t
wxCRT_StrtoullBase(const T* nptr, T** endptr, int base, T* sign)
{ return wxCRT_DoStrtoull(nptr, endptr, base); }
#endif
+#endif // wxLongLong_t
+
// ----------------------------------------------------------------------------
// functions which we may need even if !wxUSE_WCHAR_T
// ----------------------------------------------------------------------------