X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6b583d40a8cd1dd38de2ad84e650023b857f80f7..62c9b3d73fdf9a892a311241f1effc12dde0282a:/include/wx/string.h?ds=inline diff --git a/include/wx/string.h b/include/wx/string.h index 10729ed6eb..22e0ec6f5e 100644 --- a/include/wx/string.h +++ b/include/wx/string.h @@ -69,7 +69,9 @@ // use in DLL build under pre-Vista Windows so we disable this code for now, if // anybody really needs to use UTF-8 build under Windows with this optimization // it would have to be re-tested and probably corrected -#if wxUSE_UNICODE_UTF8 && !defined(__WXMSW__) +// CS: under OSX release builds the string destructor/cache cleanup sometimes +// crashes, disable until we find the true reason or a better workaround +#if wxUSE_UNICODE_UTF8 && !defined(__WXMSW__) && !defined(__WXOSX__) #define wxUSE_STRING_POS_CACHE 1 #else #define wxUSE_STRING_POS_CACHE 0 @@ -613,7 +615,7 @@ private: return wxTLS_VALUE(s_cache); } - + // this helper struct is used to ensure that GetCache() is called during // static initialization time, i.e. before any threads creation, as otherwise // the static s_cache construction inside GetCache() wouldn't be MT-safe @@ -673,7 +675,7 @@ private: // a lot of misses in this function...) Cache::Element * const cacheBegin = GetCacheBegin(); #ifndef wxHAS_COMPILER_TLS - // during destruction tls calls may return NULL, in this case return NULL + // during destruction tls calls may return NULL, in this case return NULL // immediately without accessing anything else if ( cacheBegin == NULL ) return NULL; @@ -987,7 +989,7 @@ public: iterator(wxString *str, underlying_iterator ptr) : m_cur(ptr), m_node(str, &m_cur) {} - wxString* str() const { return wx_const_cast(wxString*, m_node.m_str); } + wxString* str() const { return const_cast(m_node.m_str); } wxStringIteratorNode m_node; @@ -1808,7 +1810,7 @@ public: const wchar_t* t_str() const { return wx_str(); } #else const char* t_str() const { return wx_str(); } -#endif +#endif // overloaded assignment @@ -3955,7 +3957,7 @@ inline wxCStrData::wxCStrData(const wxCStrData& data) inline wxCStrData::~wxCStrData() { if ( m_owned ) - delete wx_const_cast(wxString*, m_str); // cast to silence warnings + delete const_cast(m_str); // cast to silence warnings } // simple cases for AsChar() and AsWChar(), the complicated ones are @@ -4078,7 +4080,7 @@ void wxStringIteratorNode::DoSet(const wxString *str, if ( str ) { m_next = str->m_iterators.ptr; - wx_const_cast(wxString*, m_str)->m_iterators.ptr = this; + const_cast(m_str)->m_iterators.ptr = this; if ( m_next ) m_next->m_prev = this; } @@ -4095,7 +4097,7 @@ void wxStringIteratorNode::clear() if ( m_prev ) m_prev->m_next = m_next; else if ( m_str ) // first in the list - wx_const_cast(wxString*, m_str)->m_iterators.ptr = m_next; + const_cast(m_str)->m_iterators.ptr = m_next; m_next = m_prev = NULL; m_citer = NULL; @@ -4112,4 +4114,19 @@ void wxStringIteratorNode::clear() #include "wx/crt.h" #endif +// ---------------------------------------------------------------------------- +// Checks on wxString characters +// ---------------------------------------------------------------------------- + +template + inline bool wxStringCheck(const wxString& val) + { + for ( wxString::const_iterator i = val.begin(); + i != val.end(); + ++i ) + if (T(*i) == 0) + return false; + return true; + } + #endif // _WX_WXSTRING_H_