summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '3rdParty/Boost/src/boost/regex/pending')
-rw-r--r--3rdParty/Boost/src/boost/regex/pending/static_mutex.hpp32
-rw-r--r--3rdParty/Boost/src/boost/regex/pending/unicode_iterator.hpp40
2 files changed, 50 insertions, 22 deletions
diff --git a/3rdParty/Boost/src/boost/regex/pending/static_mutex.hpp b/3rdParty/Boost/src/boost/regex/pending/static_mutex.hpp
index 9c10050..344926f 100644
--- a/3rdParty/Boost/src/boost/regex/pending/static_mutex.hpp
+++ b/3rdParty/Boost/src/boost/regex/pending/static_mutex.hpp
@@ -36,14 +36,7 @@
//
namespace boost{
-class BOOST_REGEX_DECL scoped_static_mutex_lock;
-
-class static_mutex
-{
-public:
- typedef scoped_static_mutex_lock scoped_lock;
- pthread_mutex_t m_mutex;
-};
+class static_mutex;
#define BOOST_STATIC_MUTEX_INIT { PTHREAD_MUTEX_INITIALIZER, }
@@ -67,6 +60,12 @@ private:
bool m_have_lock;
};
+class static_mutex
+{
+public:
+ typedef scoped_static_mutex_lock scoped_lock;
+ pthread_mutex_t m_mutex;
+};
} // namespace boost
#elif defined(BOOST_HAS_WINTHREADS)
@@ -126,12 +125,15 @@ private:
// Since this preprocessor path is almost never taken, we hide these header
// dependencies so that build tools don't find them.
//
-#define B1 <boost/thread/once.hpp>
-#define B2 <boost/thread/recursive_mutex.hpp>
-#include B1
-#include B2
-#undef B1
-#undef B2
+#define BOOST_REGEX_H1 <boost/thread/once.hpp>
+#define BOOST_REGEX_H2 <boost/thread/recursive_mutex.hpp>
+#define BOOST_REGEX_H3 <boost/thread/lock_types.hpp>
+#include BOOST_REGEX_H1
+#include BOOST_REGEX_H2
+#include BOOST_REGEX_H3
+#undef BOOST_REGEX_H1
+#undef BOOST_REGEX_H2
+#undef BOOST_REGEX_H3
namespace boost{
@@ -159,7 +161,7 @@ public:
void lock();
void unlock();
private:
- boost::recursive_mutex::scoped_lock* m_plock;
+ boost::unique_lock<boost::recursive_mutex>* m_plock;
bool m_have_lock;
};
diff --git a/3rdParty/Boost/src/boost/regex/pending/unicode_iterator.hpp b/3rdParty/Boost/src/boost/regex/pending/unicode_iterator.hpp
index e6399b5..b84cfa0 100644
--- a/3rdParty/Boost/src/boost/regex/pending/unicode_iterator.hpp
+++ b/3rdParty/Boost/src/boost/regex/pending/unicode_iterator.hpp
@@ -141,7 +141,7 @@ class u32_to_u16_iterator
{
typedef boost::iterator_facade<u32_to_u16_iterator<BaseIterator, U16Type>, U16Type, std::bidirectional_iterator_tag, const U16Type> base_type;
-#if !defined(BOOST_NO_STD_ITERATOR_TRAITS) && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
+#if !defined(BOOST_NO_STD_ITERATOR_TRAITS)
typedef typename std::iterator_traits<BaseIterator>::value_type base_value_type;
BOOST_STATIC_ASSERT(sizeof(base_value_type)*CHAR_BIT == 32);
@@ -256,7 +256,7 @@ class u16_to_u32_iterator
// special values for pending iterator reads:
BOOST_STATIC_CONSTANT(U32Type, pending_read = 0xffffffffu);
-#if !defined(BOOST_NO_STD_ITERATOR_TRAITS) && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
+#if !defined(BOOST_NO_STD_ITERATOR_TRAITS)
typedef typename std::iterator_traits<BaseIterator>::value_type base_value_type;
BOOST_STATIC_ASSERT(sizeof(base_value_type)*CHAR_BIT == 16);
@@ -371,7 +371,7 @@ class u32_to_u8_iterator
{
typedef boost::iterator_facade<u32_to_u8_iterator<BaseIterator, U8Type>, U8Type, std::bidirectional_iterator_tag, const U8Type> base_type;
-#if !defined(BOOST_NO_STD_ITERATOR_TRAITS) && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
+#if !defined(BOOST_NO_STD_ITERATOR_TRAITS)
typedef typename std::iterator_traits<BaseIterator>::value_type base_value_type;
BOOST_STATIC_ASSERT(sizeof(base_value_type)*CHAR_BIT == 32);
@@ -499,7 +499,7 @@ class u8_to_u32_iterator
// special values for pending iterator reads:
BOOST_STATIC_CONSTANT(U32Type, pending_read = 0xffffffffu);
-#if !defined(BOOST_NO_STD_ITERATOR_TRAITS) && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
+#if !defined(BOOST_NO_STD_ITERATOR_TRAITS)
typedef typename std::iterator_traits<BaseIterator>::value_type base_value_type;
BOOST_STATIC_ASSERT(sizeof(base_value_type)*CHAR_BIT == 8);
@@ -520,9 +520,26 @@ public:
}
void increment()
{
+ // We must not start with a continuation character:
+ if((static_cast<boost::uint8_t>(*m_position) & 0xC0) == 0x80)
+ invalid_sequence();
// skip high surrogate first if there is one:
unsigned c = detail::utf8_byte_count(*m_position);
- std::advance(m_position, c);
+ if(m_value == pending_read)
+ {
+ // Since we haven't read in a value, we need to validate the code points:
+ for(unsigned i = 0; i < c; ++i)
+ {
+ ++m_position;
+ // We must have a continuation byte:
+ if((i != c - 1) && ((static_cast<boost::uint8_t>(*m_position) & 0xC0) != 0x80))
+ invalid_sequence();
+ }
+ }
+ else
+ {
+ std::advance(m_position, c);
+ }
m_value = pending_read;
}
void decrement()
@@ -589,7 +606,7 @@ private:
// we must not have a continuation character:
if((m_value & 0xC0u) == 0x80u)
invalid_sequence();
- // see how many extra byts we have:
+ // see how many extra bytes we have:
unsigned extra = detail::utf8_trailing_byte_count(*m_position);
// extract the extra bits, 6 from each extra byte:
BaseIterator next(m_position);
@@ -597,6 +614,9 @@ private:
{
++next;
m_value <<= 6;
+ // We must have a continuation byte:
+ if((static_cast<boost::uint8_t>(*next) & 0xC0) != 0x80)
+ invalid_sequence();
m_value += static_cast<boost::uint8_t>(*next) & 0x3Fu;
}
// we now need to remove a few of the leftmost bits, but how many depends
@@ -609,9 +629,15 @@ private:
0x1FFFFFu,
};
m_value &= masks[extra];
- // check the result:
+ // check the result is in range:
if(m_value > static_cast<U32Type>(0x10FFFFu))
invalid_sequence();
+ // The result must not be a surrogate:
+ if((m_value >= static_cast<U32Type>(0xD800)) && (m_value <= static_cast<U32Type>(0xDFFF)))
+ invalid_sequence();
+ // We should not have had an invalidly encoded UTF8 sequence:
+ if((extra > 0) && (m_value <= static_cast<U32Type>(masks[extra - 1])))
+ invalid_sequence();
}
BaseIterator m_position;
mutable U32Type m_value;