diff options
author | Noel Grandin <noel@peralex.com> | 2021-06-21 13:00:07 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-06-22 08:41:58 +0200 |
commit | 990b2cb056788f7f412656a303456d90c003cf83 (patch) | |
tree | aa00fe681aa8d064621c37a5cfa0e6cb8b2019f7 /tools/source/fsys | |
parent | 949658028e722e5d2657b503eb20e16e41dbd8cf (diff) |
simplify and improve Wildcard
it is faster to just process OUString data, rather than perform
expensive conversion to OString and back again.
Change-Id: Ie007b872ee507ac5c6e8b55cc0a49ef3ac1f0139
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117608
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'tools/source/fsys')
-rw-r--r-- | tools/source/fsys/wldcrd.cxx | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/tools/source/fsys/wldcrd.cxx b/tools/source/fsys/wldcrd.cxx index 7608549665ca..6e0259696aca 100644 --- a/tools/source/fsys/wldcrd.cxx +++ b/tools/source/fsys/wldcrd.cxx @@ -25,7 +25,7 @@ * '?' in pWild mean match exactly one character. * */ -bool WildCard::ImpMatch( const char *pWild, const char *pStr ) +bool WildCard::ImpMatch( const sal_Unicode *pWild, const sal_Unicode *pStr ) { int pos=0; int flag=0; @@ -88,8 +88,7 @@ bool WildCard::ImpMatch( const char *pWild, const char *pStr ) bool WildCard::Matches( std::u16string_view rString ) const { - OString aTmpWild = aWildString; - OString aString(OUStringToOString(rString, osl_getThreadTextEncoding())); + OUString aTmpWild = aWildString; sal_Int32 nSepPos; @@ -98,13 +97,13 @@ bool WildCard::Matches( std::u16string_view rString ) const while ( (nSepPos = aTmpWild.indexOf(cSepSymbol)) != -1 ) { // Check all split wildcards - if ( ImpMatch( aTmpWild.copy( 0, nSepPos ).getStr(), aString.getStr() ) ) + if ( ImpMatch( aTmpWild.subView( 0, nSepPos ).data(), rString.data() ) ) return true; aTmpWild = aTmpWild.copy(nSepPos + 1); // remove separator } } - return ImpMatch( aTmpWild.getStr(), aString.getStr() ); + return ImpMatch( aTmpWild.getStr(), rString.data() ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |