diff options
Diffstat (limited to '3rdParty/Boost/src/libs/regex')
6 files changed, 43 insertions, 11 deletions
diff --git a/3rdParty/Boost/src/libs/regex/src/c_regex_traits.cpp b/3rdParty/Boost/src/libs/regex/src/c_regex_traits.cpp index 6701020..23ec324 100644 --- a/3rdParty/Boost/src/libs/regex/src/c_regex_traits.cpp +++ b/3rdParty/Boost/src/libs/regex/src/c_regex_traits.cpp @@ -54,6 +54,19 @@ c_regex_traits<char>::string_type BOOST_REGEX_CALL c_regex_traits<char>::transfo std::string src(p1, p2); while(s < (r = std::strxfrm(&*result.begin(), src.c_str(), s))) { +#if defined(_CPPLIB_VER) + // + // A bug in VC11 and 12 causes the program to hang if we pass a null-string + // to std::strxfrm, but only for certain locales :-( + // Probably effects Intel and Clang or any compiler using the VC std library (Dinkumware). + // + if(r == INT_MAX) + { + result.erase(); + result.insert(result.begin(), static_cast<char>(0)); + return result; + } +#endif result.append(r - s + 3, ' '); s = result.size(); } diff --git a/3rdParty/Boost/src/libs/regex/src/posix_api.cpp b/3rdParty/Boost/src/libs/regex/src/posix_api.cpp index e59c19e..8a803b3 100644 --- a/3rdParty/Boost/src/libs/regex/src/posix_api.cpp +++ b/3rdParty/Boost/src/libs/regex/src/posix_api.cpp @@ -125,7 +125,7 @@ BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompA(regex_tA* expression, const char #endif expression->re_magic = magic_value; static_cast<c_regex_type*>(expression->guts)->set_expression(ptr, p2, flags); - expression->re_nsub = static_cast<c_regex_type*>(expression->guts)->mark_count() - 1; + expression->re_nsub = static_cast<c_regex_type*>(expression->guts)->mark_count(); result = static_cast<c_regex_type*>(expression->guts)->error_code(); #ifndef BOOST_NO_EXCEPTIONS } diff --git a/3rdParty/Boost/src/libs/regex/src/static_mutex.cpp b/3rdParty/Boost/src/libs/regex/src/static_mutex.cpp index d14feb1..d02b01f 100644 --- a/3rdParty/Boost/src/libs/regex/src/static_mutex.cpp +++ b/3rdParty/Boost/src/libs/regex/src/static_mutex.cpp @@ -18,6 +18,7 @@ #define BOOST_REGEX_SOURCE #include <boost/config.hpp> +#include <boost/assert.hpp> #ifdef BOOST_HAS_THREADS @@ -54,8 +55,8 @@ void scoped_static_mutex_lock::lock() { if(0 == m_have_lock) { - pthread_mutex_lock(&(m_mutex.m_mutex)); - m_have_lock = true; + // Client code will throw if this fails: + m_have_lock = (pthread_mutex_lock(&(m_mutex.m_mutex)) == 0); } } @@ -63,7 +64,10 @@ void scoped_static_mutex_lock::unlock() { if(m_have_lock) { - pthread_mutex_unlock(&(m_mutex.m_mutex)); + // If this fails there's nothing we can do except assert, + // exceptions are out of the question as this code is called + // from the lock's destructor: + BOOST_VERIFY(pthread_mutex_unlock(&(m_mutex.m_mutex)) == 0); m_have_lock = false; } } @@ -157,7 +161,7 @@ void scoped_static_mutex_lock::lock() { boost::call_once(static_mutex::m_once,&static_mutex::init); if(0 == m_plock) - m_plock = new boost::recursive_mutex::scoped_lock(*static_mutex::m_pmutex, boost::defer_lock); + m_plock = new boost::unique_lock<boost::recursive_mutex>(*static_mutex::m_pmutex, boost::defer_lock); m_plock->lock(); m_have_lock = true; } diff --git a/3rdParty/Boost/src/libs/regex/src/w32_regex_traits.cpp b/3rdParty/Boost/src/libs/regex/src/w32_regex_traits.cpp index 8c22214..cf4dc10 100644 --- a/3rdParty/Boost/src/libs/regex/src/w32_regex_traits.cpp +++ b/3rdParty/Boost/src/libs/regex/src/w32_regex_traits.cpp @@ -283,9 +283,11 @@ BOOST_REGEX_DECL std::string BOOST_REGEX_CALL w32_cat_get(const cat_type& cat, l if (r == 0) return def; - LPSTR buf = (LPSTR)_alloca( (r + 1) * 2 ); - if (::WideCharToMultiByte(CP_ACP, 0, wbuf, r, buf, (r + 1) * 2, NULL, NULL) == 0) - return def; + + int buf_size = 1 + ::WideCharToMultiByte(CP_ACP, 0, wbuf, r, NULL, 0, NULL, NULL); + LPSTR buf = (LPSTR)_alloca(buf_size); + if (::WideCharToMultiByte(CP_ACP, 0, wbuf, r, buf, buf_size, NULL, NULL) == 0) + return def; // failed conversion. #endif return std::string(buf); } @@ -485,7 +487,7 @@ BOOST_REGEX_DECL char BOOST_REGEX_CALL w32_tolower(char c, lcid_type idx) return c; if (::WideCharToMultiByte(code_page, 0, &wide_result, 1, result, 2, NULL, NULL) == 0) - return c; + return c; // No single byte lower case equivalent available #endif return result[0]; } @@ -556,7 +558,7 @@ BOOST_REGEX_DECL char BOOST_REGEX_CALL w32_toupper(char c, lcid_type idx) return c; if (::WideCharToMultiByte(code_page, 0, &wide_result, 1, result, 2, NULL, NULL) == 0) - return c; + return c; // No single byte upper case equivalent available. #endif return result[0]; } diff --git a/3rdParty/Boost/src/libs/regex/src/wc_regex_traits.cpp b/3rdParty/Boost/src/libs/regex/src/wc_regex_traits.cpp index b3d2c5a..7815a09 100644 --- a/3rdParty/Boost/src/libs/regex/src/wc_regex_traits.cpp +++ b/3rdParty/Boost/src/libs/regex/src/wc_regex_traits.cpp @@ -94,6 +94,19 @@ c_regex_traits<wchar_t>::string_type BOOST_REGEX_CALL c_regex_traits<wchar_t>::t std::wstring result(s, L' '); while(s < (r = std::wcsxfrm(&*result.begin(), src.c_str(), s))) { +#if defined(_CPPLIB_VER) + // + // A bug in VC11 and 12 causes the program to hang if we pass a null-string + // to std::strxfrm, but only for certain locales :-( + // Probably effects Intel and Clang or any compiler using the VC std library (Dinkumware). + // + if(r == INT_MAX) + { + result.erase(); + result.insert(result.begin(), static_cast<wchar_t>(0)); + return result; + } +#endif result.append(r - s + 3, L' '); s = result.size(); } diff --git a/3rdParty/Boost/src/libs/regex/src/wide_posix_api.cpp b/3rdParty/Boost/src/libs/regex/src/wide_posix_api.cpp index ff5c90d..41704cd 100644 --- a/3rdParty/Boost/src/libs/regex/src/wide_posix_api.cpp +++ b/3rdParty/Boost/src/libs/regex/src/wide_posix_api.cpp @@ -135,7 +135,7 @@ BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompW(regex_tW* expression, const wcha #endif expression->re_magic = wmagic_value; static_cast<wc_regex_type*>(expression->guts)->set_expression(ptr, p2, flags); - expression->re_nsub = static_cast<wc_regex_type*>(expression->guts)->mark_count() - 1; + expression->re_nsub = static_cast<wc_regex_type*>(expression->guts)->mark_count(); result = static_cast<wc_regex_type*>(expression->guts)->error_code(); #ifndef BOOST_NO_EXCEPTIONS } |