X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2027288898d08094f0c299942e12f0a086264ec7..c693edf3bc9539378a7ac56d90d41d89c7dc7579:/src/common/string.cpp diff --git a/src/common/string.cpp b/src/common/string.cpp index 37f8847172..1b42fd7893 100644 --- a/src/common/string.cpp +++ b/src/common/string.cpp @@ -56,6 +56,11 @@ IMPLEMENT_DYNAMIC_CLASS(wxString, wxObject) #endif //WXSTRING_IS_WXOBJECT +#if wxUSE_UNICODE +#undef wxUSE_EXPERIMENTAL_PRINTF +#define wxUSE_EXPERIMENTAL_PRINTF 1 +#endif + // allocating extra space for each string consumes more memory but speeds up // the concatenation operations (nLen is the current string's length) // NB: EXTRA_ALLOC must be >= 0! @@ -89,6 +94,13 @@ extern const wxChar WXDLLEXPORT *g_szNul = &g_strEmpty.dummy; // conditional compilation // ---------------------------------------------------------------------------- +#if !defined(__WXSW__) && wxUSE_UNICODE + #ifdef wxUSE_EXPERIMENTAL_PRINTF + #undef wxUSE_EXPERIMENTAL_PRINTF + #endif + #define wxUSE_EXPERIMENTAL_PRINTF 1 +#endif + // we want to find out if the current platform supports vsnprintf()-like // function: for Unix this is done with configure, for Windows we test the // compiler explicitly. @@ -985,14 +997,17 @@ int wxString::Printf(const wxChar *pszFormat, ...) int wxString::PrintfV(const wxChar* pszFormat, va_list argptr) { // static buffer to avoid dynamic memory allocation each time - static char s_szScratch[1024]; + char s_szScratch[1024]; // using static buffer causes internal compiler err +#if 0 #if wxUSE_THREADS // protect the static buffer static wxCriticalSection critsect; wxCriticalSectionLocker lock(critsect); #endif +#endif -#if 1 // the new implementation +#if wxUSE_EXPERIMENTAL_PRINTF +// the new implementation Reinit(); for (size_t n = 0; pszFormat[n]; n++) @@ -2128,7 +2143,7 @@ static void wxLoadCharacterSets(void) if (already_loaded) return; already_loaded = TRUE; -#if defined(__UNIX__) +#if defined(__UNIX__) && wxUSE_TEXTFILE // search through files in /usr/share/i18n/charmaps wxString fname; for (fname = ::wxFindFirstFile(_T("/usr/share/i18n/charmaps/*")); @@ -2181,8 +2196,7 @@ static void wxLoadCharacterSets(void) wxString uni = token.GetNextToken(); // skip whitespace again while (wxIsEmpty(uni) && token.HasMoreTokens()) uni = token.GetNextToken(); - - if ((hex.Len() > 2) && (hex.GetChar(0) == escchar) && (hex.GetChar(1) == _T('x')) && + if ((hex.Len() > 2) && (wxString(hex.GetChar(0)) == escchar) && (hex.GetChar(1) == _T('x')) && (uni.Left(2) == _T("