From 3d236177be255b2027a997bfc12fe0833ca9a2f7 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Tue, 11 Oct 2022 10:23:28 +0300 Subject: Deduplicate O(U)StringConcatenation And use an overloaded helper function with a better (?) unified name to show that the result is not an O(U)String. Change-Id: I8956338b05d02bf46a6185828130ea8ef145d46b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141203 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- shell/source/backends/desktopbe/desktopbackend.cxx | 2 +- shell/source/win32/jumplist/JumpList.cxx | 46 +++++++++++----------- 2 files changed, 23 insertions(+), 25 deletions(-) (limited to 'shell') diff --git a/shell/source/backends/desktopbe/desktopbackend.cxx b/shell/source/backends/desktopbe/desktopbackend.cxx index c14c679a608a..b6f49e37ed24 100644 --- a/shell/source/backends/desktopbe/desktopbackend.cxx +++ b/shell/source/backends/desktopbe/desktopbackend.cxx @@ -201,7 +201,7 @@ OUString xdg_user_dir_lookup (const char *type, bool bAllowHomeDir) { aDocumentsDirURL = aUserDirBuf.makeStringAndClear(); if ( bAllowHomeDir || - (aDocumentsDirURL != aHomeDirURL && aDocumentsDirURL != OUStringConcatenation(aHomeDirURL + "/")) ) + (aDocumentsDirURL != aHomeDirURL && aDocumentsDirURL != Concat2View(aHomeDirURL + "/")) ) { osl::Directory aDocumentsDir( aDocumentsDirURL ); if( osl::FileBase::E_None == aDocumentsDir.open() ) diff --git a/shell/source/win32/jumplist/JumpList.cxx b/shell/source/win32/jumplist/JumpList.cxx index 06a62a11038d..114c6f4e95b5 100644 --- a/shell/source/win32/jumplist/JumpList.cxx +++ b/shell/source/win32/jumplist/JumpList.cxx @@ -201,21 +201,20 @@ void SAL_CALL JumpListImpl::appendCategory(const OUString& sCategory, PropVariantClear(&propvar); } - ThrowIfFailed(pShellLinkItem->SetDescription(o3tl::toW(item.description.getStr())), - OStringConcatenation("Setting description '" - + item.description.toUtf8() + "' failed.")); - ThrowIfFailed( - pShellLinkItem->SetPath(o3tl::toW(sofficePath.getStr())), - OStringConcatenation("Setting path '" + sofficePath.toUtf8() + "' failed.")); + pShellLinkItem->SetDescription(o3tl::toW(item.description.getStr())), + Concat2View("Setting description '" + item.description.toUtf8() + "' failed.")); + + ThrowIfFailed(pShellLinkItem->SetPath(o3tl::toW(sofficePath.getStr())), + Concat2View("Setting path '" + sofficePath.toUtf8() + "' failed.")); - ThrowIfFailed(pShellLinkItem->SetArguments(o3tl::toW(item.arguments.getStr())), - OStringConcatenation("Setting arguments '" + item.arguments.toUtf8() - + "' failed.")); + ThrowIfFailed( + pShellLinkItem->SetArguments(o3tl::toW(item.arguments.getStr())), + Concat2View("Setting arguments '" + item.arguments.toUtf8() + "' failed.")); - ThrowIfFailed(pShellLinkItem->SetIconLocation(o3tl::toW(item.iconPath.getStr()), 0), - OStringConcatenation("Setting icon path '" + item.iconPath.toUtf8() - + "' failed.")); + ThrowIfFailed( + pShellLinkItem->SetIconLocation(o3tl::toW(item.iconPath.getStr()), 0), + Concat2View("Setting icon path '" + item.iconPath.toUtf8() + "' failed.")); if (lcl_isItemInArray(pShellLinkItem, m_aRemoved)) { @@ -300,21 +299,20 @@ void SAL_CALL JumpListImpl::addTasks(const Sequence& aJumpListItem PropVariantClear(&propvar); } - ThrowIfFailed(pShellLinkItem->SetDescription(o3tl::toW(item.description.getStr())), - OStringConcatenation("Setting description '" - + item.description.toUtf8() + "' failed.")); - ThrowIfFailed( - pShellLinkItem->SetPath(o3tl::toW(sofficePath.getStr())), - OStringConcatenation("Setting path '" + sofficePath.toUtf8() + "' failed.")); + pShellLinkItem->SetDescription(o3tl::toW(item.description.getStr())), + Concat2View("Setting description '" + item.description.toUtf8() + "' failed.")); + + ThrowIfFailed(pShellLinkItem->SetPath(o3tl::toW(sofficePath.getStr())), + Concat2View("Setting path '" + sofficePath.toUtf8() + "' failed.")); - ThrowIfFailed(pShellLinkItem->SetArguments(o3tl::toW(item.arguments.getStr())), - OStringConcatenation("Setting arguments '" + item.arguments.toUtf8() - + "' failed.")); + ThrowIfFailed( + pShellLinkItem->SetArguments(o3tl::toW(item.arguments.getStr())), + Concat2View("Setting arguments '" + item.arguments.toUtf8() + "' failed.")); - ThrowIfFailed(pShellLinkItem->SetIconLocation(o3tl::toW(item.iconPath.getStr()), 0), - OStringConcatenation("Setting icon path '" + item.iconPath.toUtf8() - + "' failed.")); + ThrowIfFailed( + pShellLinkItem->SetIconLocation(o3tl::toW(item.iconPath.getStr()), 0), + Concat2View("Setting icon path '" + item.iconPath.toUtf8() + "' failed.")); aCollection->AddObject(pShellLinkItem); } -- cgit