X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/64716cd79d5e70358e10dca44effea1d16f14cdc..6c41a418df66b66711eba536526a3085f690782e:/src/common/string.cpp?ds=sidebyside diff --git a/src/common/string.cpp b/src/common/string.cpp index 37a116fa02..54a87d7ba5 100644 --- a/src/common/string.cpp +++ b/src/common/string.cpp @@ -104,27 +104,21 @@ extern const char WXDLLEXPORT *g_szNul = &g_strEmpty.dummy; // always available), but it's unsafe because it doesn't check for buffer // size - so give a warning #define wxVsprintf(buffer,len,format,argptr) vsprintf(buffer,format, argptr) -#if defined(__VISUALC__) - #pragma message("Using sprintf() because no snprintf()-like function defined") -#elif defined(__GNUG__) - #warning "Using sprintf() because no snprintf()-like function defined" -#elif defined(__MWERKS__) - #warning "Using sprintf() because no snprintf()-like function defined" -#elif defined(__WATCOMC__) - // No warning -#elif defined(__BORLANDC__) - // No warning -#elif defined(__SUNCC__) - // nothing -- I don't know about "#warning" for Sun's CC -#elif defined(__DECCXX) - // nothing -#else - // change this to some analogue of '#warning' for your compiler - #error "Using sprintf() because no snprintf()-like function defined" -#endif //compiler + #if defined(__VISUALC__) + #pragma message("Using sprintf() because no snprintf()-like function defined") + #elif defined(__GNUG__) && !defined(__UNIX__) + #warning "Using sprintf() because no snprintf()-like function defined" + #elif defined(__MWERKS__) + #warning "Using sprintf() because no snprintf()-like function defined" + #endif //compiler #endif // no vsnprintf +#ifdef _AIX + // AIX has vsnprintf, but there's no prototype in the system headers. + extern "C" int vsnprintf(char* str, size_t n, const char* format, va_list ap); +#endif + // ---------------------------------------------------------------------------- // global functions // ---------------------------------------------------------------------------- @@ -1461,12 +1455,16 @@ void wxArrayString::Remove(const char *sz) // need a critical section to protect access to gs_compareFunction and // gs_sortAscending variables - static wxCriticalSection gs_critsectStringSort; + static wxCriticalSection *gs_critsectStringSort = NULL; // call this before the value of the global sort vars is changed/after // you're finished with them - #define START_SORT() gs_critsectStringSort.Enter() - #define END_SORT() gs_critsectStringSort.Leave() + #define START_SORT() wxASSERT( !gs_critsectStringSort ); \ + gs_critsectStringSort = new wxCriticalSection; \ + gs_critsectStringSort->Enter() + #define END_SORT() gs_critsectStringSort->Leave(); \ + delete gs_critsectStringSort; \ + gs_critsectStringSort = NULL #else // !threads #define START_SORT() #define END_SORT()