Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r79765 - in trunk/boost/xpressive: . traits
From: eric_at_[hidden]
Date: 2012-07-26 22:37:29


Author: eric_niebler
Date: 2012-07-26 22:37:28 EDT (Thu, 26 Jul 2012)
New Revision: 79765
URL: http://svn.boost.org/trac/boost/changeset/79765

Log:
work around buggy wide ctype facet on cygwin and mingw
Text files modified:
   trunk/boost/xpressive/traits/cpp_regex_traits.hpp | 11 +++++++++++
   trunk/boost/xpressive/xpressive_fwd.hpp | 2 +-
   2 files changed, 12 insertions(+), 1 deletions(-)

Modified: trunk/boost/xpressive/traits/cpp_regex_traits.hpp
==============================================================================
--- trunk/boost/xpressive/traits/cpp_regex_traits.hpp (original)
+++ trunk/boost/xpressive/traits/cpp_regex_traits.hpp 2012-07-26 22:37:28 EDT (Thu, 26 Jul 2012)
@@ -20,6 +20,7 @@
 #include <string>
 #include <locale>
 #include <sstream>
+#include <climits>
 #include <boost/config.hpp>
 #include <boost/assert.hpp>
 #include <boost/integer.hpp>
@@ -208,6 +209,16 @@
                 return true;
             }
 
+ // HACKHACK Cygwin and mingw have buggy ctype facets for wchar_t
+ #if defined(__CYGWIN__) || defined(__MINGW32_VERSION)
+ if (std::ctype_base::xdigit == ((std::ctype_base::mask)(umask_t)mask & std::ctype_base::xdigit))
+ {
+ typename std::char_traits<Char>::int_type i = std::char_traits<Char>::to_int_type(ch);
+ if(UCHAR_MAX >= i && std::isxdigit(static_cast<int>(i)))
+ return true;
+ }
+ #endif
+
             #else
 
             umaskex_t tmp = mask & ~non_std_ctype_masks;

Modified: trunk/boost/xpressive/xpressive_fwd.hpp
==============================================================================
--- trunk/boost/xpressive/xpressive_fwd.hpp (original)
+++ trunk/boost/xpressive/xpressive_fwd.hpp 2012-07-26 22:37:28 EDT (Thu, 26 Jul 2012)
@@ -31,7 +31,7 @@
 # define BOOST_XPRESSIVE_USE_C_TRAITS
 #endif
 
-#if defined(BOOST_NO_CWCHAR) | defined(BOOST_NO_CWCTYPE) | defined(BOOST_NO_STD_WSTRING)
+#if defined(BOOST_NO_CWCHAR) || defined(BOOST_NO_CWCTYPE) || defined(BOOST_NO_STD_WSTRING)
 # ifndef BOOST_XPRESSIVE_NO_WREGEX
 # define BOOST_XPRESSIVE_NO_WREGEX
 # endif


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk