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!
// 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.
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++)
size_t wxString::find_first_of(const wxChar* sz, size_t nStart) const
{
- const char *start = c_str() + nStart;
- char *firstOf = strpbrk(start, sz);
+ const wxChar *start = c_str() + nStart;
+ const wxChar *firstOf = wxStrpbrk(start, sz);
if ( firstOf )
return firstOf - start;
else
wxASSERT( nStart <= Len() );
}
- for ( const char *p = c_str() + length() - 1; p >= c_str(); p-- )
+ for ( const wxChar *p = c_str() + length() - 1; p >= c_str(); p-- )
{
if ( wxStrchr(sz, *p) )
return p - c_str();
wxASSERT( nStart <= Len() );
}
- size_t nAccept = strspn(c_str() + nStart, sz);
+ size_t nAccept = wxStrspn(c_str() + nStart, sz);
if ( nAccept >= length() - nStart )
return npos;
else
{
wxASSERT( nStart <= Len() );
- for ( const char *p = c_str() + nStart; *p; p++ )
+ for ( const wxChar *p = c_str() + nStart; *p; p++ )
{
if ( *p != ch )
return p - c_str();
wxASSERT( nStart <= Len() );
}
- for ( const char *p = c_str() + nStart - 1; p >= c_str(); p-- )
+ for ( const wxChar *p = c_str() + nStart - 1; p >= c_str(); p-- )
{
if ( !wxStrchr(sz, *p) )
return p - c_str();
wxASSERT( nStart <= Len() );
}
- for ( const char *p = c_str() + nStart - 1; p >= c_str(); p-- )
+ for ( const wxChar *p = c_str() + nStart - 1; p >= c_str(); p-- )
{
if ( *p != ch )
return p - c_str();
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/*"));
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));