mirror of
https://github.com/boostorg/regex.git
synced 2025-07-22 16:47:17 +02:00
Merge fixes from Trunk.
[SVN r81819]
This commit is contained in:
@ -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
|
||||
|
@ -20,6 +20,7 @@
|
||||
#define BOOST_CPP_REGEX_TRAITS_HPP_INCLUDED
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/integer.hpp>
|
||||
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
|
||||
@ -107,12 +108,14 @@ template<class charT, class traits>
|
||||
typename parser_buf<charT, traits>::pos_type
|
||||
parser_buf<charT, traits>::seekoff(off_type off, ::std::ios_base::seekdir way, ::std::ios_base::openmode which)
|
||||
{
|
||||
typedef typename boost::int_t<sizeof(way) * CHAR_BIT>::least cast_type;
|
||||
|
||||
if(which & ::std::ios_base::out)
|
||||
return pos_type(off_type(-1));
|
||||
std::ptrdiff_t size = this->egptr() - this->eback();
|
||||
std::ptrdiff_t pos = this->gptr() - this->eback();
|
||||
charT* g = this->eback();
|
||||
switch(way)
|
||||
switch(static_cast<cast_type>(way))
|
||||
{
|
||||
case ::std::ios_base::beg:
|
||||
if((off < 0) || (off > size))
|
||||
|
@ -121,7 +121,7 @@ template class BOOST_REGEX_TEMPLATE_DECL ::boost::re_detail::perl_matcher< std::
|
||||
|
||||
#undef BOOST_REGEX_TEMPLATE_DECL
|
||||
|
||||
#elif (defined(__GNUC__) && (__GNUC__ >= 3)) || !defined(BOOST_NO_EXTERN_TEMPLATE)
|
||||
#elif (defined(__GNUC__) && (__GNUC__ >= 3)) || !defined(BOOST_NO_CXX11_EXTERN_TEMPLATE)
|
||||
|
||||
# ifndef BOOST_REGEX_INSTANTIATE
|
||||
# ifdef __GNUC__
|
||||
|
@ -1268,6 +1268,9 @@ bool perl_matcher<BidiIterator, Allocator, traits>::unwind_fast_dot_repeat(bool
|
||||
}while((count < rep->max) && (position != last) && !can_start(*position, rep->_map, mask_skip));
|
||||
}
|
||||
|
||||
// remember where we got to if this is a leading repeat:
|
||||
if((rep->leading) && (count < rep->max))
|
||||
restart = position;
|
||||
if(position == last)
|
||||
{
|
||||
// can't repeat any more, remove the pushed state:
|
||||
|
Reference in New Issue
Block a user