Merge collected bug fixes from Trunk:

Refs #589.
Refs #7032.
Refs #7084.
Refs #6346.

[SVN r79556]
This commit is contained in:
John Maddock
2012-07-16 08:38:23 +00:00
parent 8aa4a1225a
commit a26d66b688
16 changed files with 64 additions and 10 deletions

View File

@ -15,7 +15,7 @@ local disable-icu = [ MATCH (--disable-icu) : [ modules.peek : ARGV ] ] ;
rule path_options ( properties * ) rule path_options ( properties * )
{ {
local result ; local result ;
if <address-model>64 in $(properties) if <address-model>64 in $(properties) && <toolset>msvc in $(properties)
{ {
result = <search>$(ICU_PATH)/bin64 <search>$(ICU_PATH)/lib64 ; result = <search>$(ICU_PATH)/bin64 <search>$(ICU_PATH)/lib64 ;
} }

View File

@ -15,6 +15,12 @@ Currently open issues can be viewed [@https://svn.boost.org/trac/boost/query?sta
All issues including closed ones can be viewed [@https://svn.boost.org/trac/boost/query?status=assigned&status=closed&status=new&status=reopened&component=regex&order=priority&col=id&col=summary&col=status&col=type&col=milestone&col=component here]. All issues including closed ones can be viewed [@https://svn.boost.org/trac/boost/query?status=assigned&status=closed&status=new&status=reopened&component=regex&order=priority&col=id&col=summary&col=status&col=type&col=milestone&col=component here].
[h4 Boost-1.51]
Fixed issues:
[@https://svn.boost.org/trac/boost/ticket/589 #589], [@https://svn.boost.org/trac/boost/ticket/7084 #7084],
[@https://svn.boost.org/trac/boost/ticket/7032 #7032], [@https://svn.boost.org/trac/boost/ticket/6346 #6346].
[h4 Boost-1.50] [h4 Boost-1.50]
Fixed issue with `(?!)` not being a valid expression, and updated docs on what constitutes a valid conditional expression. Fixed issue with `(?!)` not being a valid expression, and updated docs on what constitutes a valid conditional expression.

View File

@ -170,7 +170,10 @@
# define BOOST_REGEX_HAS_OTHER_WCHAR_T # define BOOST_REGEX_HAS_OTHER_WCHAR_T
# ifdef BOOST_MSVC # ifdef BOOST_MSVC
# pragma warning(push) # pragma warning(push)
# pragma warning(disable : 4251 4231 4660) # pragma warning(disable : 4251 4231)
# if BOOST_MSVC < 1600
# pragma warning(disable : 4660)
# endif
# endif # endif
# if defined(_DLL) && defined(BOOST_MSVC) && (BOOST_MSVC < 1600) # if defined(_DLL) && defined(BOOST_MSVC) && (BOOST_MSVC < 1600)
# include <string> # include <string>

View File

@ -36,7 +36,10 @@
namespace boost{ namespace boost{
#ifdef BOOST_MSVC #ifdef BOOST_MSVC
#pragma warning(push) #pragma warning(push)
#pragma warning(disable : 4251 4231 4660 4800) #pragma warning(disable : 4251 4231 4800)
#if BOOST_MSVC < 1600
#pragma warning(disable : 4660)
#endif
#endif #endif
namespace re_detail{ namespace re_detail{
@ -243,11 +246,11 @@ public:
// begin, end: // begin, end:
const_iterator BOOST_REGEX_CALL begin()const const_iterator BOOST_REGEX_CALL begin()const
{ {
return (!this->m_status ? 0 : this->m_expression); return (this->m_status ? 0 : this->m_expression);
} }
const_iterator BOOST_REGEX_CALL end()const const_iterator BOOST_REGEX_CALL end()const
{ {
return (!this->m_status ? 0 : this->m_expression + this->m_expression_len); return (this->m_status ? 0 : this->m_expression + this->m_expression_len);
} }
flag_type BOOST_REGEX_CALL flags()const flag_type BOOST_REGEX_CALL flags()const
{ {

View File

@ -191,6 +191,7 @@ void basic_regex_parser<charT, traits>::fail(regex_constants::error_type error_c
this->m_pdata->m_status = error_code; this->m_pdata->m_status = error_code;
m_position = m_end; // don't bother parsing anything else m_position = m_end; // don't bother parsing anything else
#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
// //
// Augment error message with the regular expression text: // Augment error message with the regular expression text:
// //
@ -211,6 +212,7 @@ void basic_regex_parser<charT, traits>::fail(regex_constants::error_type error_c
} }
message += "'."; message += "'.";
} }
#endif
#ifndef BOOST_NO_EXCEPTIONS #ifndef BOOST_NO_EXCEPTIONS
if(0 == (this->flags() & regex_constants::no_except)) if(0 == (this->flags() & regex_constants::no_except))
@ -660,6 +662,11 @@ template <class charT, class traits>
bool basic_regex_parser<charT, traits>::parse_extended_escape() bool basic_regex_parser<charT, traits>::parse_extended_escape()
{ {
++m_position; ++m_position;
if(m_position == m_end)
{
fail(regex_constants::error_escape, m_position - m_base, "Incomplete escape sequence found.");
return false;
}
bool negate = false; // in case this is a character class escape: \w \d etc bool negate = false; // in case this is a character class escape: \w \d etc
switch(this->m_traits.escape_syntax_type(*m_position)) switch(this->m_traits.escape_syntax_type(*m_position))
{ {
@ -2089,6 +2096,14 @@ insert_recursion:
return false; return false;
} }
v = this->m_traits.toi(m_position, m_end, 10); v = this->m_traits.toi(m_position, m_end, 10);
if(m_position == m_end)
{
// Rewind to start of (? sequence:
--m_position;
while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
fail(regex_constants::error_perl_extension, m_position - m_base);
return false;
}
if(*m_position == charT('R')) if(*m_position == charT('R'))
{ {
if(++m_position == m_end) if(++m_position == m_end)

View File

@ -84,7 +84,10 @@ template class BOOST_REGEX_DECL ::boost::re_detail::perl_matcher<BOOST_REGEX_CHA
# ifdef BOOST_MSVC # ifdef BOOST_MSVC
# pragma warning(push) # pragma warning(push)
# pragma warning(disable : 4251 4231 4660) # pragma warning(disable : 4251 4231)
# if BOOST_MSVC < 1600
# pragma warning(disable : 4660)
# endif
# endif # endif
template class BOOST_REGEX_TEMPLATE_DECL basic_regex< BOOST_REGEX_CHAR_T BOOST_REGEX_TRAITS_T >; template class BOOST_REGEX_TEMPLATE_DECL basic_regex< BOOST_REGEX_CHAR_T BOOST_REGEX_TRAITS_T >;

View File

@ -33,7 +33,10 @@
namespace boost{ namespace boost{
#ifdef BOOST_MSVC #ifdef BOOST_MSVC
#pragma warning(push) #pragma warning(push)
#pragma warning(disable : 4251 4231 4660) #pragma warning(disable : 4251 4231)
# if BOOST_MSVC < 1600
# pragma warning(disable : 4660)
# endif
#endif #endif
namespace re_detail{ namespace re_detail{

View File

@ -344,7 +344,10 @@ struct recursion_info
#ifdef BOOST_MSVC #ifdef BOOST_MSVC
#pragma warning(push) #pragma warning(push)
#pragma warning(disable : 4251 4231 4660) #pragma warning(disable : 4251 4231)
# if BOOST_MSVC < 1600
# pragma warning(disable : 4660)
# endif
#endif #endif
template <class BidiIterator, class Allocator, class traits> template <class BidiIterator, class Allocator, class traits>

View File

@ -68,7 +68,7 @@ public:
// flags |= match_prev_avail; // flags |= match_prev_avail;
BidirectionalIterator next_start = what[0].second; BidirectionalIterator next_start = what[0].second;
match_flag_type f(flags); match_flag_type f(flags);
if(!what.length()) if(!what.length() || (f & regex_constants::match_posix))
f |= regex_constants::match_not_initial_null; f |= regex_constants::match_not_initial_null;
//if(base != next_start) //if(base != next_start)
// f |= regex_constants::match_not_bob; // f |= regex_constants::match_not_bob;

View File

@ -19,6 +19,7 @@
#define BOOST_REGEX_SOURCE #define BOOST_REGEX_SOURCE
#include <boost/config.hpp>
#include <climits> #include <climits>
#include <stdexcept> #include <stdexcept>
#include <string> #include <string>
@ -876,6 +877,7 @@ _fi_find_handle _fi_FindFirstFile(const char* lpFileName, _fi_find_data* lpFindF
{ {
if(_fi_FindNextFile(dat, lpFindFileData)) if(_fi_FindNextFile(dat, lpFindFileData))
return dat; return dat;
closedir(h);
} }
delete dat; delete dat;
return 0; return 0;

View File

@ -18,6 +18,7 @@
#define BOOST_REGEX_SOURCE #define BOOST_REGEX_SOURCE
#include <boost/config.hpp>
#include <cstdio> #include <cstdio>
#include <boost/regex.hpp> #include <boost/regex.hpp>
#include <boost/cregex.hpp> #include <boost/cregex.hpp>

View File

@ -19,6 +19,7 @@
#define BOOST_REGEX_SOURCE #define BOOST_REGEX_SOURCE
#include <boost/config.hpp>
#include <new> #include <new>
#include <boost/regex.hpp> #include <boost/regex.hpp>
#include <boost/throw_exception.hpp> #include <boost/throw_exception.hpp>

View File

@ -18,6 +18,7 @@
#define BOOST_REGEX_SOURCE #define BOOST_REGEX_SOURCE
#include <boost/config.hpp>
#include <memory> #include <memory>
#include <cstring> #include <cstring>
#include <boost/assert.hpp> #include <boost/assert.hpp>
@ -45,7 +46,8 @@ void BOOST_REGEX_CALL raw_storage::resize(size_type n)
// allocate and copy data: // allocate and copy data:
register pointer ptr = static_cast<pointer>(::operator new(newsize)); register pointer ptr = static_cast<pointer>(::operator new(newsize));
BOOST_REGEX_NOEH_ASSERT(ptr) BOOST_REGEX_NOEH_ASSERT(ptr)
std::memcpy(ptr, start, datasize); if(start)
std::memcpy(ptr, start, datasize);
// get rid of old buffer: // get rid of old buffer:
::operator delete(start); ::operator delete(start);

View File

@ -48,6 +48,10 @@ void test_empty(boost::basic_regex<charT, traits>& r)
{ {
BOOST_REGEX_TEST_ERROR("Invalid value returned from basic_regex<>::status().", charT); BOOST_REGEX_TEST_ERROR("Invalid value returned from basic_regex<>::status().", charT);
} }
if(r.begin() != r.end())
{
BOOST_REGEX_TEST_ERROR("Invalid value returned from basic_regex<>::begin().", charT);
}
} }
template<class charT, class traits> template<class charT, class traits>

View File

@ -482,6 +482,10 @@ void test(boost::basic_regex<charT, traits>& r, const test_regex_search_tag&)
{ {
BOOST_REGEX_TEST_ERROR("Expression did not compile when it should have done, error code = " << r.status(), charT); BOOST_REGEX_TEST_ERROR("Expression did not compile when it should have done, error code = " << r.status(), charT);
} }
if(expression != std::basic_string<charT>(r.begin(), r.end()))
{
BOOST_REGEX_TEST_ERROR("Stored expression string was incorrect", charT);
}
test_simple_search(r); test_simple_search(r);
test_regex_iterator(r); test_regex_iterator(r);
test_regex_token_iterator(r); test_regex_token_iterator(r);

View File

@ -190,5 +190,9 @@ void test_replace()
TEST_REGEX_REPLACE("(?:(?<one>a)|(?<one>b))", perl, " ...b,,", match_default, "$1.$2.$+{one}", " ....b.b,,"); TEST_REGEX_REPLACE("(?:(?<one>a)|(?<one>b))", perl, " ...b,,", match_default, "$1.$2.$+{one}", " ....b.b,,");
TEST_REGEX_REPLACE("(?:(?<one>a)(?<one>b))", perl, " ...ab,,", match_default, "$1.$2.$+{one}", " ...a.b.a,,"); TEST_REGEX_REPLACE("(?:(?<one>a)(?<one>b))", perl, " ...ab,,", match_default, "$1.$2.$+{one}", " ...a.b.a,,");
// See https://svn.boost.org/trac/boost/ticket/589
TEST_REGEX_REPLACE("(a*)", perl, "aabb", match_default, "{$1}", "{aa}{}b{}b{}");
TEST_REGEX_REPLACE("(a*)", extended, "aabb", match_default, "{$1}", "{aa}{}b{}b{}");
TEST_REGEX_REPLACE("(a*)", extended, "aabb", match_default|match_posix, "{$1}", "{aa}b{}b{}");
} }