Compare commits

...

9 Commits

Author SHA1 Message Date
3a50c6828c Restrict fix to where we really need it. 2024-11-04 18:12:47 +00:00
be12f75b22 Tidy up code, add test. 2024-11-04 17:05:08 +00:00
39ee6e36b0 Tentative fix for #227. 2024-11-04 16:38:46 +00:00
bd0e76f42f Correct example/Jamfile.v2 so that grep gets valid command line argum… (#229)
* Correct example/Jamfile.v2 so that grep gets valid command line arguments.
2024-11-02 18:29:39 +00:00
bb9f2b1984 Merge pull request #224 from boostorg/pr/default-build-warnings
Move <warnings>all from requirements to default-build. Fixes #223.
2024-09-03 11:31:27 +01:00
49c4e8cb8f Merge pull request #221 from boostorg/pr/fix-clang-cl-2
Define _CRT_SECURE_NO_WARNINGS instead of using wcscpy_s. Fixes #219.
2024-09-03 11:29:56 +01:00
e61e5e111e Merge pull request #222 from boostorg/pr/add-verbatim
Add VERBATIM to the remaining add_custom_target as well
2024-09-03 11:28:11 +01:00
cff442b3e7 Add VERBATIM to the remaining add_custom_target as well 2024-09-02 10:23:02 +03:00
65726f3d2f Define _CRT_SECURE_NO_WARNINGS instead of using wcscpy_s. Fixes #219. 2024-09-02 10:07:29 +03:00
6 changed files with 27 additions and 15 deletions

View File

@ -44,7 +44,7 @@ path-constant HERE : . ;
test-suite regex-examples :
[ regex-test-run timer/regex_timer.cpp /boost/smart_ptr//boost_smart_ptr : $(HERE)/timer/input_script.txt ]
[ regex-test-run grep/grep.cpp /boost/program_options//boost_program_options/<link>static : -n -b $(HERE)/../include/boost/regex.hpp : test_grep ]
[ regex-test-run grep/grep.cpp /boost/program_options//boost_program_options/<link>static : -n -b -E include $(HERE)/../include/boost/regex.hpp : test_grep ]
[ regex-test-run snippets/credit_card_example.cpp ]
[ regex-test-run snippets/mfc_example.cpp ]
[ regex-test-run snippets/icu_example.cpp ]

View File

@ -1204,7 +1204,10 @@ bool perl_matcher<BidiIterator, Allocator, traits>::skip_until_paren(int index,
else if(pstate->type == syntax_element_startmark)
{
int idx = static_cast<const re_brace*>(pstate)->index;
pstate = pstate->next.p;
if(idx > 0)
match_startmark();
else
pstate = pstate->next.p;
skip_until_paren(idx, false);
continue;
}

View File

@ -16,6 +16,7 @@
* DESCRIPTION: Implements the wide character POSIX API wrappers.
*/
#define _CRT_SECURE_NO_WARNINGS // for std::wcscpy
#define BOOST_REGEX_SOURCE
#include <boost/regex/config.hpp>
@ -169,11 +170,7 @@ BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorW(int code, const regex_tW*
{
result = std::wcslen(wnames[code]) + 1;
if(buf_size >= result)
#if (BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(_WIN32_WCE) && !defined(UNDER_CE)) || (defined(BOOST_CLANG) && defined(_MSC_VER))
::wcscpy_s(buf, buf_size, wnames[code]);
#else
std::wcscpy(buf, wnames[code]);
#endif
return result;
}
return result;
@ -193,11 +190,7 @@ BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorW(int code, const regex_tW*
(boost::core::swprintf)(localbuf, 5, L"%d", i);
#endif
if(std::wcslen(localbuf) < buf_size)
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(_WIN32_WCE) && !defined(UNDER_CE)
::wcscpy_s(buf, buf_size, localbuf);
#else
std::wcscpy(buf, localbuf);
#endif
return std::wcslen(localbuf) + 1;
}
}
@ -207,11 +200,7 @@ BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorW(int code, const regex_tW*
(boost::core::swprintf)(localbuf, 5, L"%d", 0);
#endif
if(std::wcslen(localbuf) < buf_size)
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(_WIN32_WCE) && !defined(UNDER_CE)
::wcscpy_s(buf, buf_size, localbuf);
#else
std::wcscpy(buf, localbuf);
#endif
return std::wcslen(localbuf) + 1;
}
if(code <= (int)REG_E_UNKNOWN)

View File

@ -135,3 +135,4 @@ compile test_windows_defs_3.cpp ;
compile test_windows_defs_4.cpp ;
run issue153.cpp : : : "<toolset>msvc:<linkflags>-STACK:2097152" ;
run issue227.cpp ;

View File

@ -19,4 +19,4 @@ target_link_libraries(quick_icu Boost::regex_icu)
enable_testing()
add_test(quick_icu quick_icu)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
add_custom_target(check VERBATIM COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)

19
test/issue227.cpp Normal file
View File

@ -0,0 +1,19 @@
/*
* Copyright (c) 2024
* Christian Mazakas
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*
*/
#include <boost/regex.hpp>
#include <string>
int main() {
boost::regex rx("(*ACCEPT)*+\\1((*ACCEPT)*+\\K)");
std::string str = "Z";
boost::smatch what;
boost::regex_search(str, what, rx, boost::match_default | boost::match_partial);
}