Kaydet (Commit) 53491f8a authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:returnconstant in ucbhelper,drawinglayer

Change-Id: I4e84c570fe0e555a3aeb1f11632715de466d6e0e
Reviewed-on: https://gerrit.libreoffice.org/58192
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst e6538f5b
......@@ -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;
......
......@@ -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 );
......
......@@ -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:
......
......@@ -538,7 +538,7 @@ void Package::exportTo(
bool bOk=true;
try
{
bOk = destFolder.transferContent(
destFolder.transferContent(
sourceContent, ::ucbhelper::InsertOperation::Copy,
newTitle, nameClashAction);
}
......
......@@ -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)
{
......
......@@ -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:
......
......@@ -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);
......
......@@ -654,7 +654,7 @@ public:
* @throws css::uno::RuntimeException
* @throws css::uno::Exception
*/
bool
void
transferContent( const Content& rSourceContent,
InsertOperation eOperation,
const OUString & rTitle,
......
......@@ -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& )
{}
......
......@@ -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;
......
......@@ -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,
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment