diff options
author | Noel <noelgrandin@gmail.com> | 2020-11-06 20:01:50 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-11-11 11:58:37 +0100 |
commit | 93c64a61f2c84e684050294a1391cd32425b7837 (patch) | |
tree | 00aad2cb8f3ee29ba4ac99e159e26fb8d71d2f33 /ucb/source | |
parent | 1fde62018c8d3344a3408c7b6317120aefc778fb (diff) |
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 <noel.grandin@collabora.co.uk>
Diffstat (limited to 'ucb/source')
-rw-r--r-- | ucb/source/ucp/file/filglob.cxx | 2 | ||||
-rw-r--r-- | ucb/source/ucp/hierarchy/hierarchydata.cxx | 8 | ||||
-rw-r--r-- | ucb/source/ucp/package/pkgdatasupplier.cxx | 2 |
3 files changed, 6 insertions, 6 deletions
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 { |