diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-29 11:06:33 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-05-01 08:30:18 +0200 |
commit | 5200a73627d13e2997f81b53f61e143e77e328ee (patch) | |
tree | f95c8346d061ecd0ad33d574895d18e169662785 /desktop/source | |
parent | b90d3d316dd9c720c83180b31f6bbd7003fead78 (diff) |
use more string_view in various
found by examining uses of OUString::copy() for likely places
Change-Id: I6ff20e7b273ad6005410b82719183c1122f8c018
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133617
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'desktop/source')
5 files changed, 12 insertions, 12 deletions
diff --git a/desktop/source/deployment/registry/component/dp_component.cxx b/desktop/source/deployment/registry/component/dp_component.cxx index 8bee3d4ee0b3..9cb4846c6ee8 100644 --- a/desktop/source/deployment/registry/component/dp_component.cxx +++ b/desktop/source/deployment/registry/component/dp_component.cxx @@ -1304,10 +1304,10 @@ BackendImpl::ComponentPackageImpl::isRegistered_( { //try to match only the file name OUString thisUrl(getURL()); - OUString thisFileName(thisUrl.copy(thisUrl.lastIndexOf('/'))); + std::u16string_view thisFileName(thisUrl.subView(thisUrl.lastIndexOf('/'))); - OUString locationFileName(location.copy(location.lastIndexOf('/'))); - if (locationFileName.equalsIgnoreAsciiCase(thisFileName)) + std::u16string_view locationFileName(location.subView(location.lastIndexOf('/'))); + if (o3tl::equalsIgnoreAsciiCase(locationFileName, thisFileName)) bAmbiguousComponentName = true; } } diff --git a/desktop/source/deployment/registry/help/dp_help.cxx b/desktop/source/deployment/registry/help/dp_help.cxx index 834f829ad35b..f039d27250d9 100644 --- a/desktop/source/deployment/registry/help/dp_help.cxx +++ b/desktop/source/deployment/registry/help/dp_help.cxx @@ -31,6 +31,7 @@ #include <svl/inettype.hxx> #include <unotools/pathoptions.hxx> #include <cppuhelper/supportsservice.hxx> +#include <o3tl/string_view.hxx> #if HAVE_FEATURE_XMLHELP #include <helpcompiler/compilehelp.hxx> @@ -447,9 +448,8 @@ void BackendImpl::implProcessHelp( implCollectXhpFiles( aSubFolderURL, aXhpFileVector ); // Copy to package (later: move?) - OUString aDestPath = aDestBasePath; - OUString aPureFolderName = aSubFolderURL.copy( nLenLangFolderURL ); - aDestPath += aPureFolderName; + std::u16string_view aPureFolderName = aSubFolderURL.subView( nLenLangFolderURL ); + OUString aDestPath = aDestBasePath + aPureFolderName; xSFA->copy( aSubFolderURL, aDestPath ); } @@ -580,8 +580,8 @@ void BackendImpl::implCollectXhpFiles( const OUString& aDir, sal_Int32 nLastDot = aURL.lastIndexOf( '.' ); if( nLastDot != -1 ) { - OUString aExt = aURL.copy( nLastDot + 1 ); - if( aExt.equalsIgnoreAsciiCase( "xhp" ) ) + std::u16string_view aExt = aURL.subView( nLastDot + 1 ); + if( o3tl::equalsIgnoreAsciiCase( aExt, u"xhp" ) ) o_rXhpFileVector.push_back( aURL ); } } diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx index 0fbca8565634..25579a979dbc 100644 --- a/desktop/source/migration/migration.cxx +++ b/desktop/source/migration/migration.cxx @@ -839,9 +839,9 @@ std::vector< MigrationModuleInfo > MigrationImpl::detectUIChangesForAllModules() aModuleInfo.sModuleShortName = sModuleShortName; sal_Int32 nIndex = sToolbarName.lastIndexOf('.'); if (nIndex > 0) { - OUString sExtension(sToolbarName.copy(nIndex)); + std::u16string_view sExtension(sToolbarName.subView(nIndex)); OUString sToolbarResourceName(sToolbarName.copy(0, nIndex)); - if (!sToolbarResourceName.isEmpty() && sExtension == ".xml") + if (!sToolbarResourceName.isEmpty() && sExtension == u".xml") aModuleInfo.m_vToolbars.push_back(sToolbarResourceName); } } diff --git a/desktop/source/migration/services/basicmigration.cxx b/desktop/source/migration/services/basicmigration.cxx index 8076dada5cb0..94e8677de786 100644 --- a/desktop/source/migration/services/basicmigration.cxx +++ b/desktop/source/migration/services/basicmigration.cxx @@ -108,7 +108,7 @@ namespace migration TStringVectorPtr aFileList = getFiles( m_sSourceDir ); for (auto const& elem : *aFileList) { - OUString sLocalName = elem.copy( m_sSourceDir.getLength() ); + std::u16string_view sLocalName = elem.subView( m_sSourceDir.getLength() ); OUString sTargetName = sTargetDir + sLocalName; INetURLObject aURL( sTargetName ); aURL.removeSegment(); diff --git a/desktop/source/migration/services/wordbookmigration.cxx b/desktop/source/migration/services/wordbookmigration.cxx index 83f687703e9f..a3fff8823925 100644 --- a/desktop/source/migration/services/wordbookmigration.cxx +++ b/desktop/source/migration/services/wordbookmigration.cxx @@ -138,7 +138,7 @@ static bool IsUserWordbook( const OUString& rFile ) { if (IsUserWordbook(elem) ) { - OUString sSourceLocalName = elem.copy( m_sSourceDir.getLength() ); + std::u16string_view sSourceLocalName = elem.subView( m_sSourceDir.getLength() ); OUString sTargetName = sTargetDir + sSourceLocalName; INetURLObject aURL( sTargetName ); aURL.removeSegment(); |