ucb/source/ucp/file/bc.cxx | 2 +- ucb/source/ucp/file/filglob.cxx | 14 +++++++------- ucb/source/ucp/file/filglob.hxx | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-)
New commits: commit 9798f8ad50602cf1313a2804b86e79fb80c1ec4d Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Thu Apr 14 13:46:47 2022 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Thu Apr 14 17:45:14 2022 +0200 use more string_view in ucb Change-Id: I0aa83a1496436d6fb77ad85d24ba088a7ff75f6e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133014 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/ucb/source/ucp/file/bc.cxx b/ucb/source/ucp/file/bc.cxx index fe6086160ac6..e4ed0f180333 100644 --- a/ucb/source/ucp/file/bc.cxx +++ b/ucb/source/ucp/file/bc.cxx @@ -1086,7 +1086,7 @@ void BaseContent::insert( sal_Int32 nMyCommandIdentifier, XInteractionRequestImpl aRequestImpl( rtl::Uri::decode( - getTitle(m_aUncPath), + OUString(getTitle(m_aUncPath)), rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8), static_cast<cppu::OWeakObject*>(this), diff --git a/ucb/source/ucp/file/filglob.cxx b/ucb/source/ucp/file/filglob.cxx index 5772934cd161..d93c41b514de 100644 --- a/ucb/source/ucp/file/filglob.cxx +++ b/ucb/source/ucp/file/filglob.cxx @@ -183,17 +183,17 @@ namespace fileaccess { } - OUString getTitle( const OUString& aPath ) + std::u16string_view getTitle( std::u16string_view aPath ) { - sal_Int32 lastIndex = aPath.lastIndexOf( '/' ); - return aPath.copy( lastIndex + 1 ); + size_t lastIndex = aPath.rfind( '/' ); + return aPath.substr( lastIndex + 1 ); } - OUString getParentName( const OUString& aFileName ) + OUString getParentName( std::u16string_view aFileName ) { - sal_Int32 lastIndex = aFileName.lastIndexOf( '/' ); - OUString aParent = aFileName.copy( 0,lastIndex ); + size_t lastIndex = aFileName.rfind( '/' ); + OUString aParent( aFileName.substr( 0,lastIndex ) ); if( aParent.endsWith(":") && aParent.getLength() == 6 ) aParent += "/"; @@ -561,7 +561,7 @@ namespace fileaccess { prop.Handle = -1; OUString aClashingName( rtl::Uri::decode( - getTitle(aUncPath), + OUString(getTitle(aUncPath)), rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8)); prop.Value <<= aClashingName; diff --git a/ucb/source/ucp/file/filglob.hxx b/ucb/source/ucp/file/filglob.hxx index 8d3412cdeb7b..b1235056ee18 100644 --- a/ucb/source/ucp/file/filglob.hxx +++ b/ucb/source/ucp/file/filglob.hxx @@ -50,12 +50,12 @@ namespace fileaccess { std::u16string_view old_Name ); // returns the last part of the given url as title - extern OUString getTitle( const OUString& aPath ); + extern std::u16string_view getTitle( std::u16string_view aPath ); // returns the url without last part as parentname // In case aFileName is root ( file:/// ) root is returned - extern OUString getParentName( const OUString& aFileName ); + extern OUString getParentName( std::u16string_view aFileName ); /** * special copy: