summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-07-28 09:01:19 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-07-28 16:52:06 +0200
commite8493f9349d18cbcb323930a9bf200c542a72d62 (patch)
treea682aeb0343b0379a2a9d2d9ea39a7f096115050
parentff41cf1b8dbeb36b8824257acb5c5ba272415108 (diff)
loplugin:collapseif
Change-Id: I69bfafa97c66ef944cc6ae35c7e2f66d0430d6a4 Reviewed-on: https://gerrit.libreoffice.org/76496 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--basic/source/sbx/sbxvalue.cxx63
-rw-r--r--sd/source/ui/dlg/sdtreelb.cxx17
-rw-r--r--sdext/source/presenter/PresenterToolBar.cxx5
-rw-r--r--svl/source/misc/inethist.cxx14
-rw-r--r--unotools/source/misc/fontdefs.cxx19
-rw-r--r--vcl/source/outdev/bitmap.cxx11
-rw-r--r--vcl/unx/generic/printer/jobdata.cxx31
7 files changed, 69 insertions, 91 deletions
diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx
index 1a011b6706d1..37f8cffbf413 100644
--- a/basic/source/sbx/sbxvalue.cxx
+++ b/basic/source/sbx/sbxvalue.cxx
@@ -976,43 +976,40 @@ bool SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
{
aL.eType = aR.eType = SbxDECIMAL;
bDecimal = true;
- if( rOp.Get( aR ) )
+ if( rOp.Get( aR ) && Get( aL ) )
{
- if( Get( aL ) )
+ if( aL.pDecimal && aR.pDecimal )
{
- if( aL.pDecimal && aR.pDecimal )
- {
- bool bOk = true;
- switch( eOp )
- {
- case SbxMUL:
- bOk = ( *(aL.pDecimal) *= *(aR.pDecimal) );
- break;
- case SbxDIV:
- if( aR.pDecimal->isZero() )
- SetError( ERRCODE_BASIC_ZERODIV );
- else
- bOk = ( *(aL.pDecimal) /= *(aR.pDecimal) );
- break;
- case SbxPLUS:
- bOk = ( *(aL.pDecimal) += *(aR.pDecimal) );
- break;
- case SbxMINUS:
- bOk = ( *(aL.pDecimal) -= *(aR.pDecimal) );
- break;
- case SbxNEG:
- bOk = ( aL.pDecimal->neg() );
- break;
- default:
- SetError( ERRCODE_BASIC_BAD_ARGUMENT );
- }
- if( !bOk )
- SetError( ERRCODE_BASIC_MATH_OVERFLOW );
- }
- else
+ bool bOk = true;
+ switch( eOp )
{
- SetError( ERRCODE_BASIC_CONVERSION );
+ case SbxMUL:
+ bOk = ( *(aL.pDecimal) *= *(aR.pDecimal) );
+ break;
+ case SbxDIV:
+ if( aR.pDecimal->isZero() )
+ SetError( ERRCODE_BASIC_ZERODIV );
+ else
+ bOk = ( *(aL.pDecimal) /= *(aR.pDecimal) );
+ break;
+ case SbxPLUS:
+ bOk = ( *(aL.pDecimal) += *(aR.pDecimal) );
+ break;
+ case SbxMINUS:
+ bOk = ( *(aL.pDecimal) -= *(aR.pDecimal) );
+ break;
+ case SbxNEG:
+ bOk = ( aL.pDecimal->neg() );
+ break;
+ default:
+ SetError( ERRCODE_BASIC_BAD_ARGUMENT );
}
+ if( !bOk )
+ SetError( ERRCODE_BASIC_MATH_OVERFLOW );
+ }
+ else
+ {
+ SetError( ERRCODE_BASIC_CONVERSION );
}
}
}
diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx
index 2d6b2ae0fe45..b17fb4546524 100644
--- a/sd/source/ui/dlg/sdtreelb.cxx
+++ b/sd/source/ui/dlg/sdtreelb.cxx
@@ -1128,18 +1128,15 @@ sal_Int8 SdPageObjsTLB::ExecuteDrop( const ExecuteDropEvent& rEvt )
try
{
- if( !bIsInDrag )
+ if( !bIsInDrag && mpNavigator)
{
- if (mpNavigator)
- {
- TransferableDataHelper aDataHelper( rEvt.maDropEvent.Transferable );
- OUString aFile;
+ TransferableDataHelper aDataHelper( rEvt.maDropEvent.Transferable );
+ OUString aFile;
- if( aDataHelper.GetString( SotClipboardFormatId::SIMPLE_FILE, aFile ) &&
- mpNavigator->InsertFile( aFile ) )
- {
- nRet = rEvt.mnAction;
- }
+ if( aDataHelper.GetString( SotClipboardFormatId::SIMPLE_FILE, aFile ) &&
+ mpNavigator->InsertFile( aFile ) )
+ {
+ nRet = rEvt.mnAction;
}
}
}
diff --git a/sdext/source/presenter/PresenterToolBar.cxx b/sdext/source/presenter/PresenterToolBar.cxx
index 5d065da4454e..e6e19f03e908 100644
--- a/sdext/source/presenter/PresenterToolBar.cxx
+++ b/sdext/source/presenter/PresenterToolBar.cxx
@@ -752,9 +752,8 @@ void PresenterToolBar::Layout (
nX+aPartSizes[nIndex].Width, nY+aTotalSize.Height);
// Add space for gaps between elements.
- if (rxPart->size() > 1)
- if (bIsHorizontal)
- aBoundingBox.X2 += (rxPart->size() - 1) * nGapWidth;
+ if (rxPart->size() > 1 && bIsHorizontal)
+ aBoundingBox.X2 += (rxPart->size() - 1) * nGapWidth;
LayoutPart(rxCanvas, rxPart, aBoundingBox, aPartSizes[nIndex], bIsHorizontal);
bIsHorizontal = !bIsHorizontal;
diff --git a/svl/source/misc/inethist.cxx b/svl/source/misc/inethist.cxx
index 5dafe30d2ce2..19cae51df5ad 100644
--- a/svl/source/misc/inethist.cxx
+++ b/svl/source/misc/inethist.cxx
@@ -254,16 +254,10 @@ void INetURLHistory_Impl::putUrl (const OUString &rUrl)
// Check source and destination.
sal_uInt16 nDI = std::min (k, sal_uInt16(capacity() - 1));
- if (nSI < nDI)
- {
- if (!(m_pHash[nDI] < h))
- nDI -= 1;
- }
- if (nDI < nSI)
- {
- if (m_pHash[nDI] < h)
- nDI += 1;
- }
+ if (nSI < nDI && !(m_pHash[nDI] < h))
+ nDI -= 1;
+ if (nDI < nSI && m_pHash[nDI] < h)
+ nDI += 1;
// Assign data.
m_pList[m_aHead.m_nNext].m_nHash = m_pHash[nSI].m_nHash = h;
diff --git a/unotools/source/misc/fontdefs.cxx b/unotools/source/misc/fontdefs.cxx
index f988b5f17759..c8c05c94fe59 100644
--- a/unotools/source/misc/fontdefs.cxx
+++ b/unotools/source/misc/fontdefs.cxx
@@ -527,19 +527,16 @@ OUString GetSubsFontName( const OUString& rName, SubsFontFlags nFlags )
return aName;
const utl::FontNameAttr* pAttr = utl::FontSubstConfiguration::get().getSubstInfo( aOrgName );
- if ( pAttr )
+ if ( pAttr && (nFlags & SubsFontFlags::MS) )
{
- if( nFlags & SubsFontFlags::MS )
+ for( const auto& rSubstitution : pAttr->MSSubstitutions )
+ if( ! ImplIsFontToken( rName, rSubstitution ) )
{
- for( const auto& rSubstitution : pAttr->MSSubstitutions )
- if( ! ImplIsFontToken( rName, rSubstitution ) )
- {
- ImplAppendFontToken( aName, rSubstitution );
- if( nFlags & SubsFontFlags::ONLYONE )
- {
- break;
- }
- }
+ ImplAppendFontToken( aName, rSubstitution );
+ if( nFlags & SubsFontFlags::ONLYONE )
+ {
+ break;
+ }
}
}
diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index acbd13e0a5ab..10b58b208db5 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -1569,15 +1569,12 @@ Bitmap OutputDevice::BlendBitmap(
BitmapScopedWriteAccess pB(aBmp);
bool bFastBlend = false;
- if( pP && pA && pB )
+ if( pP && pA && pB && !bHMirr && !bVMirr )
{
- if( !bHMirr && !bVMirr )
- {
- SalTwoRect aTR(aBmpRect.Left(), aBmpRect.Top(), aBmpRect.GetWidth(), aBmpRect.GetHeight(),
- nOffX, nOffY, aOutSz.Width(), aOutSz.Height());
+ SalTwoRect aTR(aBmpRect.Left(), aBmpRect.Top(), aBmpRect.GetWidth(), aBmpRect.GetHeight(),
+ nOffX, nOffY, aOutSz.Width(), aOutSz.Height());
- bFastBlend = ImplFastBitmapBlending( *pB,*pP,*pA, aTR );
- }
+ bFastBlend = ImplFastBitmapBlending( *pB,*pP,*pA, aTR );
}
if( pP && pA && pB && !bFastBlend )
diff --git a/vcl/unx/generic/printer/jobdata.cxx b/vcl/unx/generic/printer/jobdata.cxx
index 11f1b931ecaf..e95263e29c49 100644
--- a/vcl/unx/generic/printer/jobdata.cxx
+++ b/vcl/unx/generic/printer/jobdata.cxx
@@ -266,26 +266,23 @@ bool JobData::constructFromStreamBuffer( const void* pData, sal_uInt32 bytes, Jo
bPDFDevice = true;
rJobData.m_nPDFDevice = aLine.copy(RTL_CONSTASCII_LENGTH(pdfdeviceEquals)).toInt32();
}
- else if (aLine == "PPDContexData")
+ else if (aLine == "PPDContexData" && bPrinter)
{
- if( bPrinter )
+ PrinterInfoManager& rManager = PrinterInfoManager::get();
+ const PrinterInfo& rInfo = rManager.getPrinterInfo( rJobData.m_aPrinterName );
+ rJobData.m_pParser = PPDParser::getParser( rInfo.m_aDriverName );
+ if( rJobData.m_pParser )
{
- PrinterInfoManager& rManager = PrinterInfoManager::get();
- const PrinterInfo& rInfo = rManager.getPrinterInfo( rJobData.m_aPrinterName );
- rJobData.m_pParser = PPDParser::getParser( rInfo.m_aDriverName );
- if( rJobData.m_pParser )
+ rJobData.m_aContext.setParser( rJobData.m_pParser );
+ sal_uInt64 nBytes = bytes - aStream.Tell();
+ std::vector<char> aRemain(nBytes+1);
+ nBytes = aStream.ReadBytes(aRemain.data(), nBytes);
+ if (nBytes)
{
- rJobData.m_aContext.setParser( rJobData.m_pParser );
- sal_uInt64 nBytes = bytes - aStream.Tell();
- std::vector<char> aRemain(nBytes+1);
- nBytes = aStream.ReadBytes(aRemain.data(), nBytes);
- if (nBytes)
- {
- aRemain.resize(nBytes+1);
- aRemain[nBytes] = 0;
- rJobData.m_aContext.rebuildFromStreamBuffer(aRemain);
- bContext = true;
- }
+ aRemain.resize(nBytes+1);
+ aRemain[nBytes] = 0;
+ rJobData.m_aContext.rebuildFromStreamBuffer(aRemain);
+ bContext = true;
}
}
}