From 4ac48ae4b02b8e0e3ae7e4833893f9ad40d4d14d Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Fri, 28 Feb 2020 14:20:24 +0300 Subject: Use icu::UnicodeString's readonly-aliasing char16_t* constructor Then it stores a pointer to the passed const UTF-16 string, so avoids extra overhead (both memory and CPU) to copy the data Change-Id: I561998d5534f76ae450577ce6fcbd9c08207f2fe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89698 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- i18npool/source/search/textsearch.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'i18npool') diff --git a/i18npool/source/search/textsearch.cxx b/i18npool/source/search/textsearch.cxx index 0efa67bcf33a..da4d9cada678 100644 --- a/i18npool/source/search/textsearch.cxx +++ b/i18npool/source/search/textsearch.cxx @@ -930,7 +930,7 @@ SearchResult TextSearch::RESrchFrwrd( const OUString& searchStr, // use the ICU RegexMatcher to find the matches UErrorCode nIcuErr = U_ZERO_ERROR; - const IcuUniString aSearchTargetStr(reinterpret_cast(searchStr.getStr()), + const IcuUniString aSearchTargetStr(false, reinterpret_cast(searchStr.getStr()), searchStr.getLength()); pRegexMatcher->reset( aSearchTargetStr); // search until there is a valid match @@ -985,7 +985,7 @@ SearchResult TextSearch::RESrchBkwrd( const OUString& searchStr, // TODO: use ICU's backward searching once it becomes available // as its replacement using forward search is not as good as the real thing UErrorCode nIcuErr = U_ZERO_ERROR; - const IcuUniString aSearchTargetStr(reinterpret_cast(searchStr.getStr()), + const IcuUniString aSearchTargetStr(false, reinterpret_cast(searchStr.getStr()), searchStr.getLength()); pRegexMatcher->reset( aSearchTargetStr); if (!lcl_findRegex( pRegexMatcher, endPos, startPos, nIcuErr)) -- cgit