From 93c64a61f2c84e684050294a1391cd32425b7837 Mon Sep 17 00:00:00 2001 From: Noel Date: Fri, 6 Nov 2020 20:01:50 +0200 Subject: loplugin:stringview Add new methods "subView" to O(U)String to return substring views of the underlying data. Add a clang plugin to warn when replacing existing calls to copy() would be better to use subView(). Change-Id: I03a5732431ce60808946f2ce2c923b22845689ca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105420 Tested-by: Jenkins Reviewed-by: Noel Grandin --- ucb/source/ucp/file/filglob.cxx | 2 +- ucb/source/ucp/hierarchy/hierarchydata.cxx | 8 ++++---- ucb/source/ucp/package/pkgdatasupplier.cxx | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'ucb/source') diff --git a/ucb/source/ucp/file/filglob.cxx b/ucb/source/ucp/file/filglob.cxx index 429af573ce84..4c5ea1249e87 100644 --- a/ucb/source/ucp/file/filglob.cxx +++ b/ucb/source/ucp/file/filglob.cxx @@ -178,7 +178,7 @@ namespace fileaccess { { sal_Int32 srcL = aOldPrefix.getLength(); - return aNewPrefix + old_Name.copy( srcL ); + return aNewPrefix + old_Name.subView( srcL ); } diff --git a/ucb/source/ucp/hierarchy/hierarchydata.cxx b/ucb/source/ucp/hierarchy/hierarchydata.cxx index 07b5943f06ac..c0548cbe361b 100644 --- a/ucb/source/ucp/hierarchy/hierarchydata.cxx +++ b/ucb/source/ucp/hierarchy/hierarchydata.cxx @@ -277,7 +277,7 @@ bool HierarchyEntry::setData( const HierarchyEntryData& rData ) OSL_ENSURE( nPos != -1, "HierarchyEntry::setData - Wrong path!" ); - aParentPath += m_aPath.copy( 0, nPos ); + aParentPath += m_aPath.subView( 0, nPos ); bRoot = false; } @@ -510,7 +510,7 @@ bool HierarchyEntry::move( OSL_ENSURE( nPos != -1, "HierarchyEntry::move - Wrong path!" ); - aOldParentPath += m_aPath.copy( 0, nPos ); + aOldParentPath += m_aPath.subView( 0, nPos ); bOldRoot = false; } @@ -523,7 +523,7 @@ bool HierarchyEntry::move( OSL_ENSURE( nPos != -1, "HierarchyEntry::move - Wrong path!" ); - aNewParentPath += aNewPath.copy( 0, nPos ); + aNewParentPath += aNewPath.subView( 0, nPos ); bNewRoot = false; } @@ -771,7 +771,7 @@ bool HierarchyEntry::remove() OSL_ENSURE( nPos != -1, "HierarchyEntry::remove - Wrong path!" ); - aParentPath += m_aPath.copy( 0, nPos ); + aParentPath += m_aPath.subView( 0, nPos ); bRoot = false; } diff --git a/ucb/source/ucp/package/pkgdatasupplier.cxx b/ucb/source/ucp/package/pkgdatasupplier.cxx index 90e1b87a7bfd..4b097d021f59 100644 --- a/ucb/source/ucp/package/pkgdatasupplier.cxx +++ b/ucb/source/ucp/package/pkgdatasupplier.cxx @@ -436,7 +436,7 @@ OUString DataSupplier::assembleChildURL( const OUString& aName ) aURL += "/"; aURL += ::ucb_impl::urihelper::encodeSegment( aName ) + - aContURL.copy( nParam ); + aContURL.subView( nParam ); } else { -- cgit