X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/30b21f9a048d957a989cf5623c369745fec8a27d..1e8a4bc241f0031d538a3ea474211b9840ca2bd8:/src/common/string.cpp diff --git a/src/common/string.cpp b/src/common/string.cpp index 06bb55f9c3..fbdedd721e 100644 --- a/src/common/string.cpp +++ b/src/common/string.cpp @@ -116,6 +116,8 @@ extern const char WXDLLEXPORT *g_szNul = &g_strEmpty.dummy; // 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" @@ -1459,12 +1461,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() @@ -1483,8 +1489,9 @@ static int wxStringCompareFunction(const void *first, const void *second) wxString *strFirst = (wxString *)first; wxString *strSecond = (wxString *)second; - if ( gs_compareFunction ) + if ( gs_compareFunction ) { return gs_compareFunction(*strFirst, *strSecond); + } else { int result = strcmp(strFirst->c_str(), strSecond->c_str());