From d7d38da27fd3f56707cd7448007db2891fb16b79 Mon Sep 17 00:00:00 2001 From: John Maddock Date: Thu, 5 Jun 2008 17:07:42 +0000 Subject: [PATCH] Changed POSIX API functions to use the global C locale. Fixes #1446. [SVN r46170] --- src/posix_api.cpp | 16 +++++++++------- src/wide_posix_api.cpp | 16 +++++++++------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/posix_api.cpp b/src/posix_api.cpp index 907c60c3..1564cedb 100644 --- a/src/posix_api.cpp +++ b/src/posix_api.cpp @@ -62,6 +62,8 @@ const char* names[] = { }; } // namespace +typedef boost::basic_regex > c_regex_type; + BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompA(regex_tA* expression, const char* ptr, int f) { if(expression->re_magic != magic_value) @@ -70,7 +72,7 @@ BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompA(regex_tA* expression, const char #ifndef BOOST_NO_EXCEPTIONS try{ #endif - expression->guts = new regex(); + expression->guts = new c_regex_type(); #ifndef BOOST_NO_EXCEPTIONS } catch(...) { @@ -120,9 +122,9 @@ BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompA(regex_tA* expression, const char try{ #endif expression->re_magic = magic_value; - static_cast(expression->guts)->set_expression(ptr, p2, flags); - expression->re_nsub = static_cast(expression->guts)->mark_count() - 1; - result = static_cast(expression->guts)->error_code(); + static_cast(expression->guts)->set_expression(ptr, p2, flags); + expression->re_nsub = static_cast(expression->guts)->mark_count() - 1; + result = static_cast(expression->guts)->error_code(); #ifndef BOOST_NO_EXCEPTIONS } catch(const boost::regex_error& be) @@ -187,7 +189,7 @@ BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorA(int code, const regex_tA* { std::string p; if((e) && (e->re_magic == magic_value)) - p = static_cast(e->guts)->get_traits().error_string(static_cast< ::boost::regex_constants::error_type>(code)); + p = static_cast(e->guts)->get_traits().error_string(static_cast< ::boost::regex_constants::error_type>(code)); else { p = re_detail::get_default_error_string(static_cast< ::boost::regex_constants::error_type>(code)); @@ -236,7 +238,7 @@ BOOST_REGEX_DECL int BOOST_REGEX_CCALL regexecA(const regex_tA* expression, cons #endif if(expression->re_magic == magic_value) { - result = regex_search(start, end, m, *static_cast(expression->guts), flags); + result = regex_search(start, end, m, *static_cast(expression->guts), flags); } else return result; @@ -274,7 +276,7 @@ BOOST_REGEX_DECL void BOOST_REGEX_CCALL regfreeA(regex_tA* expression) { if(expression->re_magic == magic_value) { - delete static_cast(expression->guts); + delete static_cast(expression->guts); } expression->re_magic = 0; } diff --git a/src/wide_posix_api.cpp b/src/wide_posix_api.cpp index 184b1cea..83d651b8 100644 --- a/src/wide_posix_api.cpp +++ b/src/wide_posix_api.cpp @@ -69,6 +69,8 @@ const wchar_t* wnames[] = { }; } +typedef boost::basic_regex > c_regex_type; + BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompW(regex_tW* expression, const wchar_t* ptr, int f) { if(expression->re_magic != wmagic_value) @@ -77,7 +79,7 @@ BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompW(regex_tW* expression, const wcha #ifndef BOOST_NO_EXCEPTIONS try{ #endif - expression->guts = new wregex(); + expression->guts = new c_regex_type(); #ifndef BOOST_NO_EXCEPTIONS } catch(...) { @@ -127,9 +129,9 @@ BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompW(regex_tW* expression, const wcha try{ #endif expression->re_magic = wmagic_value; - static_cast(expression->guts)->set_expression(ptr, p2, flags); - expression->re_nsub = static_cast(expression->guts)->mark_count() - 1; - result = static_cast(expression->guts)->error_code(); + static_cast(expression->guts)->set_expression(ptr, p2, flags); + expression->re_nsub = static_cast(expression->guts)->mark_count() - 1; + result = static_cast(expression->guts)->error_code(); #ifndef BOOST_NO_EXCEPTIONS } catch(const boost::regex_error& be) @@ -208,7 +210,7 @@ BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorW(int code, const regex_tW* { std::string p; if((e) && (e->re_magic == wmagic_value)) - p = static_cast(e->guts)->get_traits().error_string(static_cast< ::boost::regex_constants::error_type>(code)); + p = static_cast(e->guts)->get_traits().error_string(static_cast< ::boost::regex_constants::error_type>(code)); else { p = re_detail::get_default_error_string(static_cast< ::boost::regex_constants::error_type>(code)); @@ -257,7 +259,7 @@ BOOST_REGEX_DECL int BOOST_REGEX_CCALL regexecW(const regex_tW* expression, cons #endif if(expression->re_magic == wmagic_value) { - result = regex_search(start, end, m, *static_cast(expression->guts), flags); + result = regex_search(start, end, m, *static_cast(expression->guts), flags); } else return result; @@ -294,7 +296,7 @@ BOOST_REGEX_DECL void BOOST_REGEX_CCALL regfreeW(regex_tW* expression) { if(expression->re_magic == wmagic_value) { - delete static_cast(expression->guts); + delete static_cast(expression->guts); } expression->re_magic = 0; }