From ba74c925a5ef872c291613d4be589e1ab4b4e9e1 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 15 Apr 2022 16:39:27 +0200 Subject: use more string_view in fpicker Change-Id: I2568dfa05082bbd2d3a433c54b47039455d91153 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133071 Tested-by: Jenkins Reviewed-by: Noel Grandin --- fpicker/source/office/contentenumeration.cxx | 4 ++-- fpicker/source/office/contentenumeration.hxx | 2 +- fpicker/source/office/iodlg.cxx | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/fpicker/source/office/contentenumeration.cxx b/fpicker/source/office/contentenumeration.cxx index 737808e10b62..5b74719a3f6e 100644 --- a/fpicker/source/office/contentenumeration.cxx +++ b/fpicker/source/office/contentenumeration.cxx @@ -306,9 +306,9 @@ namespace svt } - bool FileViewContentEnumerator::URLOnDenyList ( const OUString& sRealURL ) + bool FileViewContentEnumerator::URLOnDenyList ( std::u16string_view sRealURL ) { - OUString entryName = sRealURL.copy( sRealURL.lastIndexOf( '/' ) + 1 ); + std::u16string_view entryName = sRealURL.substr( sRealURL.rfind( '/' ) + 1 ); return comphelper::findValue(m_rDenyList, entryName) != -1; } diff --git a/fpicker/source/office/contentenumeration.hxx b/fpicker/source/office/contentenumeration.hxx index bc2180c53c47..68277e6a4830 100644 --- a/fpicker/source/office/contentenumeration.hxx +++ b/fpicker/source/office/contentenumeration.hxx @@ -172,7 +172,7 @@ namespace svt css::uno::Sequence< OUString > m_rDenyList; - bool URLOnDenyList ( const OUString& sRealURL ); + bool URLOnDenyList ( std::u16string_view sRealURL ); public: /** constructs an enumerator instance diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx index 4090189a3cf6..d41bbab8b252 100644 --- a/fpicker/source/office/iodlg.cxx +++ b/fpicker/source/office/iodlg.cxx @@ -127,18 +127,18 @@ namespace } - OUString GetFsysExtension_Impl( const OUString& rFile, const OUString& rLastFilterExt ) + OUString GetFsysExtension_Impl( std::u16string_view rFile, const OUString& rLastFilterExt ) { - sal_Int32 nDotPos = rFile.lastIndexOf( '.' ); - if ( nDotPos != -1 ) + size_t nDotPos = rFile.rfind( '.' ); + if ( nDotPos != std::u16string_view::npos ) { if ( !rLastFilterExt.isEmpty() ) { - if ( o3tl::equalsIgnoreAsciiCase(rFile.subView( nDotPos + 1 ), rLastFilterExt ) ) + if ( o3tl::equalsIgnoreAsciiCase(rFile.substr( nDotPos + 1 ), rLastFilterExt ) ) return rLastFilterExt; } else - return rFile.copy( nDotPos ); + return OUString(rFile.substr( nDotPos )); } return OUString(); } -- cgit