[Libreoffice-commits] core.git: desktop/source drawinglayer/source include/ucbhelper sfx2/source ucbhelper/source ucb/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Jul 27 19:17:50 UTC 2018
desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx | 5 -
desktop/source/deployment/manager/dp_manager.cxx | 10 --
desktop/source/deployment/registry/component/dp_component.cxx | 13 --
desktop/source/deployment/registry/dp_backend.cxx | 2
desktop/source/deployment/registry/package/dp_package.cxx | 14 +--
drawinglayer/source/processor2d/vclpixelprocessor2d.cxx | 12 +-
drawinglayer/source/processor2d/vclpixelprocessor2d.hxx | 2
include/ucbhelper/content.hxx | 2
sfx2/source/doc/docfile.cxx | 44 +++-------
sfx2/source/doc/doctemplates.cxx | 11 +-
ucb/source/core/FileAccess.cxx | 2
ucbhelper/source/client/content.cxx | 3
12 files changed, 48 insertions(+), 72 deletions(-)
New commits:
commit 53491f8a66d72176aab332983f9aff47ecd3d654
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri Jul 27 14:15:41 2018 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Jul 27 21:17:20 2018 +0200
loplugin:returnconstant in ucbhelper,drawinglayer
Change-Id: I4e84c570fe0e555a3aeb1f11632715de466d6e0e
Reviewed-on: https://gerrit.libreoffice.org/58192
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx
index 4a0090456217..8ab299c8b46a 100644
--- a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx
+++ b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx
@@ -598,9 +598,10 @@ bool UpdateInstallDialog::Thread::download(OUString const & sDownloadURL, Update
const OUString sTitle( StrTitle::getTitle( sourceContent ) );
- if (destFolderContent.transferContent(
+ destFolderContent.transferContent(
sourceContent, ::ucbhelper::InsertOperation::Copy,
- sTitle, css::ucb::NameClash::OVERWRITE ))
+ sTitle, css::ucb::NameClash::OVERWRITE );
+
{
//the user may have cancelled the dialog because downloading took to long
SolarMutexGuard g;
diff --git a/desktop/source/deployment/manager/dp_manager.cxx b/desktop/source/deployment/manager/dp_manager.cxx
index 3618ec5cd4eb..3b6e66598c81 100644
--- a/desktop/source/deployment/manager/dp_manager.cxx
+++ b/desktop/source/deployment/manager/dp_manager.cxx
@@ -635,10 +635,9 @@ OUString PackageManagerImpl::insertToActivationLayer(
sourceContent = ::ucbhelper::Content(
buf.makeStringAndClear(), xCmdEnv, m_xComponentContext );
}
- if (! destFolderContent.transferContent(
+ destFolderContent.transferContent(
sourceContent, ::ucbhelper::InsertOperation::Copy,
- title, NameClash::OVERWRITE ))
- throw RuntimeException( "UCB transferContent() failed!", nullptr );
+ title, NameClash::OVERWRITE );
// write to DB:
@@ -746,11 +745,10 @@ Reference<deployment::XPackage> PackageManagerImpl::addPackage(
::ucbhelper::Content docFolderContent;
create_folder( &docFolderContent, m_context, xCmdEnv );
// copy into document, first:
- if (! docFolderContent.transferContent(
+ docFolderContent.transferContent(
sourceContent, ::ucbhelper::InsertOperation::Copy,
OUString(),
- NameClash::ASK /* xxx todo: ASK not needed? */))
- throw RuntimeException("UCB transferContent() failed!", nullptr );
+ NameClash::ASK /* xxx todo: ASK not needed? */);
// set media-type:
::ucbhelper::Content docContent(
makeURL( m_context, title_enc ), xCmdEnv, m_xComponentContext );
diff --git a/desktop/source/deployment/registry/component/dp_component.cxx b/desktop/source/deployment/registry/component/dp_component.cxx
index 40ccfd8f6bef..e92dffe5c52d 100644
--- a/desktop/source/deployment/registry/component/dp_component.cxx
+++ b/desktop/source/deployment/registry/component/dp_component.cxx
@@ -425,13 +425,9 @@ void BackendImpl::initServiceRdbFiles()
m_commonRDB = m_commonRDB_orig == "common.rdb" ? OUString("common_.rdb") : OUString("common.rdb");
if (oldRDB.get().is())
{
- if (! cacheDir.transferContent(
+ cacheDir.transferContent(
oldRDB, ::ucbhelper::InsertOperation::Copy,
- m_commonRDB, NameClash::OVERWRITE ))
- {
-
- throw RuntimeException( "UCB transferContent() failed!", nullptr );
- }
+ m_commonRDB, NameClash::OVERWRITE );
oldRDB = ::ucbhelper::Content();
}
// switch native rdb:
@@ -446,10 +442,9 @@ void BackendImpl::initServiceRdbFiles()
m_nativeRDB = (m_nativeRDB_orig == plt_rdb ) ? plt_rdb_ : plt_rdb;
if (oldRDB.get().is())
{
- if (! cacheDir.transferContent(
+ cacheDir.transferContent(
oldRDB, ::ucbhelper::InsertOperation::Copy,
- m_nativeRDB, NameClash::OVERWRITE ))
- throw RuntimeException( "UCB transferContent() failed!", nullptr );
+ m_nativeRDB, NameClash::OVERWRITE );
}
// UNO is bootstrapped, flush for next process start:
diff --git a/desktop/source/deployment/registry/dp_backend.cxx b/desktop/source/deployment/registry/dp_backend.cxx
index 31ad83643550..98029f2a2bb2 100644
--- a/desktop/source/deployment/registry/dp_backend.cxx
+++ b/desktop/source/deployment/registry/dp_backend.cxx
@@ -538,7 +538,7 @@ void Package::exportTo(
bool bOk=true;
try
{
- bOk = destFolder.transferContent(
+ destFolder.transferContent(
sourceContent, ::ucbhelper::InsertOperation::Copy,
newTitle, nameClashAction);
}
diff --git a/desktop/source/deployment/registry/package/dp_package.cxx b/desktop/source/deployment/registry/package/dp_package.cxx
index ff7a245f6519..efe49cdb50fb 100644
--- a/desktop/source/deployment/registry/package/dp_package.cxx
+++ b/desktop/source/deployment/registry/package/dp_package.cxx
@@ -1027,11 +1027,9 @@ void BackendImpl::PackageImpl::exportTo(
Reference<ucb::XContentAccess>(
xResultSet, UNO_QUERY_THROW )->queryContent(),
xCmdEnv, getMyBackend()->getComponentContext() );
- if (! destFolderContent.transferContent(
+ destFolderContent.transferContent(
subContent, ::ucbhelper::InsertOperation::Copy,
- OUString(), ucb::NameClash::OVERWRITE ))
- throw RuntimeException( "UCB transferContent() failed!",
- static_cast<OWeakObject *>(this) );
+ OUString(), ucb::NameClash::OVERWRITE );
progress.update( Any() ); // animating progress bar
}
}
@@ -1131,12 +1129,10 @@ void BackendImpl::PackageImpl::exportTo(
return;
}
- if (metainfFolderContent.transferContent(
+ metainfFolderContent.transferContent(
manifestContent, ::ucbhelper::InsertOperation::Copy,
- OUString(), ucb::NameClash::OVERWRITE ))
- {
- bSuccess = true;
- }
+ OUString(), ucb::NameClash::OVERWRITE );
+ bSuccess = true;
}
catch (const css::ucb::ContentCreationException &e)
{
diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index e363baf032d3..aae85f6d0e06 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -105,14 +105,14 @@ namespace drawinglayer
mpOutputDevice->SetAntialiasing(m_pImpl->m_nOrigAntiAliasing);
}
- bool VclPixelProcessor2D::tryDrawPolyPolygonColorPrimitive2DDirect(const drawinglayer::primitive2d::PolyPolygonColorPrimitive2D& rSource, double fTransparency)
+ void VclPixelProcessor2D::tryDrawPolyPolygonColorPrimitive2DDirect(const drawinglayer::primitive2d::PolyPolygonColorPrimitive2D& rSource, double fTransparency)
{
basegfx::B2DPolyPolygon aLocalPolyPolygon(rSource.getB2DPolyPolygon());
if(!aLocalPolyPolygon.count())
{
// no geometry, done
- return true;
+ return;
}
const basegfx::BColor aPolygonColor(maBColorModifierStack.getModifiedColor(rSource.getBColor()));
@@ -123,8 +123,6 @@ namespace drawinglayer
mpOutputDevice->DrawTransparent(
aLocalPolyPolygon,
fTransparency);
-
- return true;
}
bool VclPixelProcessor2D::tryDrawPolygonHairlinePrimitive2DDirect(const drawinglayer::primitive2d::PolygonHairlinePrimitive2D& rSource, double fTransparency)
@@ -443,8 +441,9 @@ namespace drawinglayer
basegfx::B2DPolyPolygon aLocalPolyPolygon;
static bool bAllowed(true);
- if(bAllowed && tryDrawPolyPolygonColorPrimitive2DDirect(rPolyPolygonColorPrimitive2D, 0.0))
+ if(bAllowed)
{
+ tryDrawPolyPolygonColorPrimitive2DDirect(rPolyPolygonColorPrimitive2D, 0.0);
// okay, done. In this case no gaps should have to be repaired, too
}
else
@@ -555,7 +554,8 @@ namespace drawinglayer
// single transparent tools::PolyPolygon identified, use directly
const primitive2d::PolyPolygonColorPrimitive2D* pPoPoColor = static_cast< const primitive2d::PolyPolygonColorPrimitive2D* >(pBasePrimitive);
OSL_ENSURE(pPoPoColor, "OOps, PrimitiveID and PrimitiveType do not match (!)");
- bDrawTransparentUsed = tryDrawPolyPolygonColorPrimitive2DDirect(*pPoPoColor, rUniTransparenceCandidate.getTransparence());
+ bDrawTransparentUsed = true;
+ tryDrawPolyPolygonColorPrimitive2DDirect(*pPoPoColor, rUniTransparenceCandidate.getTransparence());
break;
}
case PRIMITIVE2D_ID_POLYGONHAIRLINEPRIMITIVE2D:
diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.hxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.hxx
index 0190fed7dfe7..216abc70c331 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.hxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.hxx
@@ -58,7 +58,7 @@ namespace drawinglayer
virtual void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate) override;
// some helpers to try direct paints (shortcuts)
- bool tryDrawPolyPolygonColorPrimitive2DDirect(const drawinglayer::primitive2d::PolyPolygonColorPrimitive2D& rSource, double fTransparency);
+ void tryDrawPolyPolygonColorPrimitive2DDirect(const drawinglayer::primitive2d::PolyPolygonColorPrimitive2D& rSource, double fTransparency);
bool tryDrawPolygonHairlinePrimitive2DDirect(const drawinglayer::primitive2d::PolygonHairlinePrimitive2D& rSource, double fTransparency);
bool tryDrawPolygonStrokePrimitive2DDirect(const drawinglayer::primitive2d::PolygonStrokePrimitive2D& rSource, double fTransparency);
diff --git a/include/ucbhelper/content.hxx b/include/ucbhelper/content.hxx
index 3d48b70915f0..363cd45a61f1 100644
--- a/include/ucbhelper/content.hxx
+++ b/include/ucbhelper/content.hxx
@@ -654,7 +654,7 @@ public:
* @throws css::uno::RuntimeException
* @throws css::uno::Exception
*/
- bool
+ void
transferContent( const Content& rSourceContent,
InsertOperation eOperation,
const OUString & rTitle,
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index ced74fa616e2..4426c889af82 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -2205,19 +2205,16 @@ void SfxMedium::Transfer_Impl()
sComment = pComments->GetValue( );
}
OUString sResultURL;
- bool isTransferOK = aTransferContent.transferContent(
+ aTransferContent.transferContent(
aSourceContent, eOperation,
aFileName, nNameClash, aMimeType, bMajor, sComment,
&sResultURL, sObjectId );
- if ( !isTransferOK )
- pImpl->m_eError = ERRCODE_IO_GENERAL;
- else if ( !sResultURL.isEmpty( ) ) // Likely to happen only for checkin
+ if ( !sResultURL.isEmpty( ) ) // Likely to happen only for checkin
SwitchDocumentToFile( sResultURL );
try
{
if ( GetURLObject().isAnyKnownWebDAVScheme() &&
- isTransferOK &&
eOperation == ::ucbhelper::InsertOperation::Copy )
{
// tdf#95272 try to re-issue a lock command when a new file is created.
@@ -2300,15 +2297,13 @@ void SfxMedium::DoInternalBackup_Impl( const ::ucbhelper::Content& aOriginalCont
try
{
OUString sMimeType = pImpl->getFilterMimeType();
- if( aBackupCont.transferContent( aOriginalContent,
+ aBackupCont.transferContent( aOriginalContent,
::ucbhelper::InsertOperation::Copy,
aBackupName,
NameClash::OVERWRITE,
- sMimeType ) )
- {
- pImpl->m_aBackupURL = aBackObj.GetMainURL( INetURLObject::DecodeMechanism::NONE );
- pImpl->m_bRemoveBackup = true;
- }
+ sMimeType );
+ pImpl->m_aBackupURL = aBackObj.GetMainURL( INetURLObject::DecodeMechanism::NONE );
+ pImpl->m_bRemoveBackup = true;
}
catch( const Exception& )
{}
@@ -2389,16 +2384,14 @@ void SfxMedium::DoBackup_Impl()
{
// do the transfer ( copy source file to backup dir )
OUString sMimeType = pImpl->getFilterMimeType();
- bSuccess = aContent.transferContent( aSourceContent,
+ aContent.transferContent( aSourceContent,
::ucbhelper::InsertOperation::Copy,
aFileName,
NameClash::OVERWRITE,
sMimeType );
- if( bSuccess )
- {
- pImpl->m_aBackupURL = aDest.GetMainURL( INetURLObject::DecodeMechanism::NONE );
- pImpl->m_bRemoveBackup = false;
- }
+ pImpl->m_aBackupURL = aDest.GetMainURL( INetURLObject::DecodeMechanism::NONE );
+ pImpl->m_bRemoveBackup = false;
+ bSuccess = true;
}
catch ( const css::uno::Exception& )
{
@@ -3574,11 +3567,9 @@ void SfxMedium::CreateTempFile( bool bReplace )
{
::ucbhelper::Content aTargetContent( aTmpURLObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ), xComEnv, comphelper::getProcessComponentContext() );
OUString sMimeType = pImpl->getFilterMimeType();
- if ( aTargetContent.transferContent( pImpl->aContent, ::ucbhelper::InsertOperation::Copy, aFileName, NameClash::OVERWRITE, sMimeType ) )
- {
- SetWritableForUserOnly( aTmpURL );
- bTransferSuccess = true;
- }
+ aTargetContent.transferContent( pImpl->aContent, ::ucbhelper::InsertOperation::Copy, aFileName, NameClash::OVERWRITE, sMimeType );
+ SetWritableForUserOnly( aTmpURL );
+ bTransferSuccess = true;
}
}
catch( const uno::Exception& )
@@ -3872,14 +3863,11 @@ OUString SfxMedium::CreateTempCopyWithExt( const OUString& aURL )
uno::Reference< css::ucb::XCommandEnvironment > xComEnv;
::ucbhelper::Content aTargetContent( aDest.GetMainURL( INetURLObject::DecodeMechanism::NONE ), xComEnv, comphelper::getProcessComponentContext() );
::ucbhelper::Content aSourceContent( aSource.GetMainURL( INetURLObject::DecodeMechanism::NONE ), xComEnv, comphelper::getProcessComponentContext() );
- if ( aTargetContent.transferContent( aSourceContent,
+ aTargetContent.transferContent( aSourceContent,
::ucbhelper::InsertOperation::Copy,
aFileName,
- NameClash::OVERWRITE ) )
- {
- // Success
- aResult = aNewTempFileURL;
- }
+ NameClash::OVERWRITE );
+ aResult = aNewTempFileURL;
}
catch( const uno::Exception& )
{}
diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx
index 7a8143e5efbf..4db2cd02e2fe 100644
--- a/sfx2/source/doc/doctemplates.cxx
+++ b/sfx2/source/doc/doctemplates.cxx
@@ -1957,12 +1957,11 @@ bool SfxDocTplService_Impl::addTemplate( const OUString& rGroupName,
// transfer source file
try
{
- if( ! aTargetGroup.transferContent( aSourceContent,
- InsertOperation::Copy,
- aNewTemplateTargetName,
- NameClash::OVERWRITE,
- aType ) )
- return false;
+ aTargetGroup.transferContent( aSourceContent,
+ InsertOperation::Copy,
+ aNewTemplateTargetName,
+ NameClash::OVERWRITE,
+ aType );
// allow to edit the added template
Content aResultContent;
diff --git a/ucb/source/core/FileAccess.cxx b/ucb/source/core/FileAccess.cxx
index 9d7de62bfc56..803eb520981c 100644
--- a/ucb/source/core/FileAccess.cxx
+++ b/ucb/source/core/FileAccess.cxx
@@ -261,7 +261,7 @@ void OFileAccess::transferImpl( const OUString& rSource,
try
{
- (void)aDestPath.transferContent(aSrc,
+ aDestPath.transferContent(aSrc,
bMoveData
? ucbhelper::InsertOperation::Move
: ucbhelper::InsertOperation::Copy,
diff --git a/ucbhelper/source/client/content.cxx b/ucbhelper/source/client/content.cxx
index 8b5591dfcd58..d0479ecfa81d 100644
--- a/ucbhelper/source/client/content.cxx
+++ b/ucbhelper/source/client/content.cxx
@@ -936,7 +936,7 @@ bool Content::insertNewContent( const OUString& rContentType,
}
-bool Content::transferContent( const Content& rSourceContent,
+void Content::transferContent( const Content& rSourceContent,
InsertOperation eOperation,
const OUString & rTitle,
const sal_Int32 nNameClashAction,
@@ -996,7 +996,6 @@ bool Content::transferContent( const Content& rSourceContent,
Any aRet = pBroker->execute( aCommand, 0, m_xImpl->getEnvironment() );
if ( pResultURL != nullptr )
aRet >>= *pResultURL;
- return true;
}
More information about the Libreoffice-commits
mailing list