diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2020-02-28 14:20:24 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2020-02-28 21:43:48 +0100 |
commit | 4ac48ae4b02b8e0e3ae7e4833893f9ad40d4d14d (patch) | |
tree | cd155c7269f1797a1350392ec5c7b1bf6e2ac075 /i18npool | |
parent | 43e6b55fd8b739cff834fe5551b4581a88af2d4f (diff) |
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 <mike.kaganski@collabora.com>
Diffstat (limited to 'i18npool')
-rw-r--r-- | i18npool/source/search/textsearch.cxx | 4 |
1 files changed, 2 insertions, 2 deletions
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<const UChar*>(searchStr.getStr()), + const IcuUniString aSearchTargetStr(false, reinterpret_cast<const UChar*>(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<const UChar*>(searchStr.getStr()), + const IcuUniString aSearchTargetStr(false, reinterpret_cast<const UChar*>(searchStr.getStr()), searchStr.getLength()); pRegexMatcher->reset( aSearchTargetStr); if (!lcl_findRegex( pRegexMatcher, endPos, startPos, nIcuErr)) |