1) Disabled recursive implementation for VC8: stack overflows can't be reliably detected unless the whole program is compiled with asynchronous exceptions.

2) Changed std::copy calls on VC8 to avoid "dangerous code" warnings.
3) Moved backreference and octal escape code into line with POSIX-extended requirements.
4) Changed match_results leftmost-longest rules to stop unnecessary std::distance computations (an optimisation for non-random access iterators).
5) Changed C lib calls to use "safe" versions of string API's where available.
6) Added many new POSIX-extended leftmost-longest tests, to verify the above.


[SVN r27880]
This commit is contained in:
John Maddock
2005-03-30 11:38:51 +00:00
parent ca144bb2b3
commit de28eb9b18
17 changed files with 361 additions and 106 deletions

View File

@ -131,7 +131,7 @@ BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorA(int code, const regex_tA*
{
result = std::strlen(names[code]) + 1;
if(buf_size >= result)
std::strcpy(buf, names[code]);
re_detail::strcpy_s(buf, buf_size, names[code]);
return result;
}
return result;
@ -145,15 +145,23 @@ BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorA(int code, const regex_tA*
{
if(std::strcmp(e->re_endp, names[i]) == 0)
{
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
(::sprintf_s)(localbuf, 5, "%d", i);
#else
(std::sprintf)(localbuf, "%d", i);
#endif
if(std::strlen(localbuf) < buf_size)
std::strcpy(buf, localbuf);
re_detail::strcpy_s(buf, buf_size, localbuf);
return std::strlen(localbuf) + 1;
}
}
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
(::sprintf_s)(localbuf, 5, "%d", 0);
#else
(std::sprintf)(localbuf, "%d", 0);
#endif
if(std::strlen(localbuf) < buf_size)
std::strcpy(buf, localbuf);
re_detail::strcpy_s(buf, buf_size, localbuf);
return std::strlen(localbuf) + 1;
}
if(code <= (int)REG_E_UNKNOWN)
@ -168,7 +176,7 @@ BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorA(int code, const regex_tA*
std::size_t len = p.size();
if(len < buf_size)
{
std::strcpy(buf, p.c_str());
re_detail::strcpy_s(buf, buf_size, p.c_str());
}
return len + 1;
}