]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/string.cpp
Applied fixes for AIX (GTK 1.0 compilation).
[wxWidgets.git] / src / common / string.cpp
index 37f88471720d8b8aabe8df7b1ed639ef05115a33..1b42fd789319d28250c99a425201e8ce677a2b17 100644 (file)
   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("<U"))) {
            hex.MakeUpper(); uni.MakeUpper();
            int pos = ::wxHexToDec(hex.Mid(2,2));