summaryrefslogtreecommitdiff
path: root/xmlhelp
diff options
context:
space:
mode:
authorNoel <noelgrandin@gmail.com>2020-11-06 20:01:50 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-11-11 11:58:37 +0100
commit93c64a61f2c84e684050294a1391cd32425b7837 (patch)
tree00aad2cb8f3ee29ba4ac99e159e26fb8d71d2f33 /xmlhelp
parent1fde62018c8d3344a3408c7b6317120aefc778fb (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 'xmlhelp')
-rw-r--r--xmlhelp/source/cxxhelp/provider/databases.cxx2
-rw-r--r--xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx2
-rw-r--r--xmlhelp/source/cxxhelp/provider/urlparameter.cxx4
-rw-r--r--xmlhelp/source/treeview/tvread.cxx2
4 files changed, 5 insertions, 5 deletions
diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx
index 5353f6e82ac3..b422d74efef8 100644
--- a/xmlhelp/source/cxxhelp/provider/databases.cxx
+++ b/xmlhelp/source/cxxhelp/provider/databases.cxx
@@ -1633,7 +1633,7 @@ Reference< XHierarchicalNameAccess > JarFileIterator::implGetJarFromPackage
sal_Int32 nLastSlashInPath = rPath.lastIndexOf( '/', rPath.getLength() - 1 );
*o_pExtensionRegistryPath = xPackage->getURL();
- *o_pExtensionRegistryPath += rPath.copy( nLastSlashInPath);
+ *o_pExtensionRegistryPath += rPath.subView( nLastSlashInPath);
}
}
diff --git a/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx b/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx
index cb0d765c7ad5..6fa762de325e 100644
--- a/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx
+++ b/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx
@@ -298,7 +298,7 @@ ResultSetForQuery::ResultSetForQuery( const uno::Reference< uno::XComponentConte
for( int r = 0 ; r < nResultCount ; ++r )
{
OUString aURL = aCompleteResultVector[r];
- OUString aResultStr = replWith + aURL.copy(replIdx);
+ OUString aResultStr = replWith + aURL.subView(replIdx);
m_aPath.push_back( aResultStr );
}
diff --git a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx
index b43411df75ac..bb1a12bc8243 100644
--- a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx
+++ b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx
@@ -380,9 +380,9 @@ bool URLParameter::scheme()
m_aExpr.copy(sal::static_int_cast<sal_uInt32>(nLen) - 6);
if( aLastStr == "DbPAR=" )
{
- m_aExpr = m_aExpr.copy( 0, 20 ) +
+ m_aExpr = OUString::Concat(m_aExpr.subView( 0, 20 )) +
"shared" +
- m_aExpr.copy( 20 ) +
+ m_aExpr.subView( 20 ) +
"shared";
}
}
diff --git a/xmlhelp/source/treeview/tvread.cxx b/xmlhelp/source/treeview/tvread.cxx
index 08bbdf5dd1b4..83505b36608b 100644
--- a/xmlhelp/source/treeview/tvread.cxx
+++ b/xmlhelp/source/treeview/tvread.cxx
@@ -645,7 +645,7 @@ ConfigData TVChildTarget::init( const Reference< XComponentContext >& xContext )
ret = locale;
else if( ( ( idx = locale.indexOf( '-' ) ) != -1 ||
( idx = locale.indexOf( '_' ) ) != -1 ) &&
- osl::FileBase::E_None == osl::DirectoryItem::get( url + locale.copy( 0,idx ),
+ osl::FileBase::E_None == osl::DirectoryItem::get( url + locale.subView( 0,idx ),
aDirItem ) )
ret = locale.copy( 0,idx );
else