]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/strvararg.cpp
don't dereference end iterator (closes #10656)
[wxWidgets.git] / src / common / strvararg.cpp
index b06f3e6cf26a65247e7e86e5b81199f391ba3331..e89bdf35b593a78c80ec5a95ccf6a3776a20c961 100644 (file)
@@ -373,9 +373,7 @@ private:
     size_t m_nCopied;
 };
 
-
-
-#ifdef __WINDOWS
+#ifdef __WINDOWS__
 
 // on Windows, we should use %s and %c regardless of the build:
 class wxPrintfFormatConverterWchar : public wxFormatConverterBase<wchar_t>
@@ -520,7 +518,7 @@ class wxScanfFormatConverterWchar : public wxFormatConverterBase<wchar_t>
     }
 };
 
-const wxWCharBuffer wxScanfConvertFormatW(const wchar_t *format)
+const wxScopedWCharBuffer wxScanfConvertFormatW(const wchar_t *format)
 {
     return wxScanfFormatConverterWchar().Convert(format);
 }
@@ -611,6 +609,21 @@ const wchar_t* wxFormatString::AsWChar()
 }
 #endif // wxUSE_UNICODE && !wxUSE_UTF8_LOCALE_ONLY
 
+wxString wxFormatString::InputAsString() const
+{
+    if ( m_str )
+        return *m_str;
+    if ( m_cstr )
+        return m_cstr->AsString();
+    if ( m_wchar )
+        return wxString(m_wchar);
+    if ( m_char )
+        return wxString(m_char);
+
+    wxFAIL_MSG( "invalid wxFormatString - not initialized?" );
+    return wxString();
+}
+
 // ----------------------------------------------------------------------------
 // wxFormatString::GetArgumentType()
 // ----------------------------------------------------------------------------