From 52d2087dd370241cf10c4e41df77d38300e6a20c Mon Sep 17 00:00:00 2001 From: Fabian Boehm Date: Sat, 21 Jan 2023 10:48:02 +0100 Subject: [PATCH] re: Use the variable-width pcre2 type This was what we always did in string. It makes it match the annoyingly variable width of wchar_t. Fixes #9502 --- src/re.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/re.cpp b/src/re.cpp index 9dba0e18d..120473325 100644 --- a/src/re.cpp +++ b/src/re.cpp @@ -251,7 +251,8 @@ maybe_t regex_t::substitute(const wcstring &subject, const wcstring &r error_code_t rc = pcre2_substitute(get_code(code_), to_sptr(subject), subject.size(), start_idx, options, nullptr /* match_data */, nullptr /* context */, to_sptr(replacement), - replacement.size(), reinterpret_cast(buffer), &bufflen); + // (not using UCHAR32 here for cygwin's benefit) + replacement.size(), reinterpret_cast(buffer), &bufflen); if (out_repl_count) { *out_repl_count = std::max(rc, 0);