X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4c663122e48dfd9eca0170b0e56541efc211c996..fef5c55604e20e2a90843a2278b1f5c8c817dcee:/src/common/wxchar.cpp?ds=sidebyside diff --git a/src/common/wxchar.cpp b/src/common/wxchar.cpp index 846e7d5058..edbe661e75 100644 --- a/src/common/wxchar.cpp +++ b/src/common/wxchar.cpp @@ -599,7 +599,7 @@ int vfwprintf(FILE *stream, const wxChar *format, va_list argptr) if ( rc != -1 ) { // we can't do much better without Unicode support in libc... - if ( fprintf(stream, "%s", s.mb_str()) == -1 ) + if ( fprintf(stream, "%s", (const char*)s.mb_str() ) == -1 ) return -1; } @@ -752,7 +752,11 @@ wxFormatConverter::wxFormatConverter(const wxChar *format) // precision? if ( *format == _T('.') ) { - SkipDigits(&format); + CopyFmtChar(*format++); + if ( *format == _T('*') ) + CopyFmtChar(*format++); + else + SkipDigits(&format); } // next we can have a size modifier @@ -799,23 +803,14 @@ wxFormatConverter::wxFormatConverter(const wxChar *format) case _T('c'): case _T('s'): // %c -> %lc but %hc stays %hc and %lc is still %lc - switch ( size ) - { - case Default: - InsertFmtChar(_T('l')); - break; - - case Short: - CopyFmtChar(_T('h')); - break; - - case Long: - ; - } + if ( size == Default) + InsertFmtChar(_T('l')); // fall through default: // nothing special to do + if ( size != Default ) + CopyFmtChar(*(format - 1)); CopyFmtChar(*format++); } } @@ -827,6 +822,14 @@ wxFormatConverter::wxFormatConverter(const wxChar *format) #define wxFormatConverter(x) (x) #endif // wxNEED_PRINTF_CONVERSION/!wxNEED_PRINTF_CONVERSION +#ifdef __WXDEBUG__ +// For testing the format converter +wxString wxConvertFormat(const wxChar *format) +{ + return wxString(wxFormatConverter(format)); +} +#endif + // ---------------------------------------------------------------------------- // wxPrintf(), wxScanf() and relatives // ---------------------------------------------------------------------------- @@ -1389,7 +1392,7 @@ int isascii( int c ) } #endif -#if defined(__WXWINCE__) +#if defined(__WXWINCE__) && (_WIN32_WCE <= 211) #if (_WIN32_WCE < 300) void *calloc( size_t num, size_t size ) { @@ -1399,12 +1402,10 @@ void *calloc( size_t num, size_t size ) } #endif -#if (_WIN32_WCE <= 211) int isspace(int c) { return (c == ' '); } -#endif #endif