X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/939fba6c17da245488a77a3f58e983180fc5de91..5ce61d9fd2a225e5579c07a60a71bd481a282d99:/src/common/wxchar.cpp diff --git a/src/common/wxchar.cpp b/src/common/wxchar.cpp index 11233ff4fd..aa6fb1ec6d 100644 --- a/src/common/wxchar.cpp +++ b/src/common/wxchar.cpp @@ -540,6 +540,23 @@ int WXDLLEXPORT wxSnprintf_(wxChar *buf, size_t len, const wxChar *format, ...) } #endif // wxSnprintf_ +#if defined(__DMC__) + /* Digital Mars adds count to _stprintf (C99) so convert */ + #if wxUSE_UNICODE + int wxSprintf (wchar_t * __RESTRICT s, const wchar_t * __RESTRICT format, ... ) + { + va_list arglist; + + va_start( arglist, format ); + int iLen = swprintf ( s, -1, format, arglist ); + va_end( arglist ); + return iLen ; + } + + #endif // wxUSE_UNICODE + +#endif //__DMC__ + // ---------------------------------------------------------------------------- // implement the standard IO functions for wide char if libc doesn't have them // ---------------------------------------------------------------------------- @@ -599,7 +616,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 +769,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 +820,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 +839,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 // ---------------------------------------------------------------------------- @@ -965,7 +985,7 @@ inline WORD wxMSW_ctype(wxChar ch) WXDLLEXPORT int wxIsalnum(wxChar ch) { return IsCharAlphaNumeric(ch); } WXDLLEXPORT int wxIsalpha(wxChar ch) { return IsCharAlpha(ch); } -WXDLLEXPORT int wxIsctrl(wxChar ch) { return wxMSW_ctype(ch) & C1_CNTRL; } +WXDLLEXPORT int wxIscntrl(wxChar ch) { return wxMSW_ctype(ch) & C1_CNTRL; } WXDLLEXPORT int wxIsdigit(wxChar ch) { return wxMSW_ctype(ch) & C1_DIGIT; } WXDLLEXPORT int wxIsgraph(wxChar ch) { return wxMSW_ctype(ch) & (C1_DIGIT|C1_PUNCT|C1_ALPHA); } WXDLLEXPORT int wxIslower(wxChar ch) { return IsCharLower(ch); } @@ -1389,19 +1409,20 @@ 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 ) { void** ptr = (void **)malloc(num * size); memset( ptr, 0, num * size); return ptr; } +#endif -#if (_WIN32_WCE <= 211) int isspace(int c) { return (c == ' '); } -#endif #endif +