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 /xmlhelp/source/cxxhelp | |
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 'xmlhelp/source/cxxhelp')
-rw-r--r-- | xmlhelp/source/cxxhelp/provider/databases.cxx | 2 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx | 2 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/provider/urlparameter.cxx | 4 |
3 files changed, 4 insertions, 4 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"; } } |