]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/wxchar.cpp
Don't forget wxrc
[wxWidgets.git] / src / common / wxchar.cpp
index 06c69bd0cd0319719a899c40ca10bfd4883c1f97..6d682be476acc6685a656be996f0c07566a41d72 100644 (file)
@@ -599,7 +599,13 @@ 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",
+#if wxUSE_UNICODE
+                     s.mb_str().data()
+#else
+                     s.c_str()
+#endif
+                 ) == -1 )
             return -1;
     }
 
@@ -752,7 +758,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 +809,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 +828,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
 // ----------------------------------------------------------------------------