diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2015-06-14 12:17:55 +0200 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2015-06-14 12:17:55 +0200 |
commit | b226928c6d5d094359b970b64a063b243d4fc84c (patch) | |
tree | 3ec0329c0f69fc4e9b57210135d51c2006853388 | |
parent | cppcheck: postfixOperator (diff) | |
download | core-b226928c6d5d094359b970b64a063b243d4fc84c.tar.gz core-b226928c6d5d094359b970b64a063b243d4fc84c.zip |
cppcheck: redundantCondition [part1]
Change-Id: I21c5340e7b5ec09248b08aa76f43acf883c56cd8
19 files changed, 26 insertions, 31 deletions
diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx index 661a667f1034..b31d18c2607c 100644 --- a/basctl/source/basicide/basidesh.cxx +++ b/basctl/source/basicide/basidesh.cxx @@ -831,7 +831,7 @@ void Shell::RemoveWindow( BaseWindow* pWindow_, bool bDestroy, bool bAllowChange if ( pWindow_->GetDocument().isInVBAMode() ) { SbModule* pMod = StarBASIC::GetActiveModule(); - if ( !pMod || ( pMod && ( !pMod->GetName().equals(pWindow_->GetName()) ) ) ) + if ( !pMod || !pMod->GetName().equals(pWindow_->GetName())) { bStop = false; } diff --git a/basctl/source/basicide/basobj2.cxx b/basctl/source/basicide/basobj2.cxx index ce19f5c3338e..1921afe4fb3c 100644 --- a/basctl/source/basicide/basobj2.cxx +++ b/basctl/source/basicide/basobj2.cxx @@ -382,7 +382,7 @@ Sequence< OUString > GetMethodNames( const ScriptDocument& rDocument, const OUSt SbModuleRef xModule; // Only reparse modules if ScriptDocument source is out of sync // with basic's Module - if ( !pMod || ( pMod && pMod->GetSource() != aOUSource ) ) + if ( !pMod || pMod->GetSource() != aOUSource ) { xModule = new SbModule( rModName ); xModule->SetSource32( aOUSource ); @@ -432,7 +432,7 @@ bool HasMethod ( SbModuleRef xModule; // Only reparse modules if ScriptDocument source is out of sync // with basic's Module - if ( !pMod || ( pMod && pMod->GetSource() != aOUSource )) + if ( !pMod || pMod->GetSource() != aOUSource ) { xModule = new SbModule( rModName ); xModule->SetSource32( aOUSource ); diff --git a/basegfx/source/range/b2drangeclipper.cxx b/basegfx/source/range/b2drangeclipper.cxx index a62f44e177e4..1b4929475364 100644 --- a/basegfx/source/range/b2drangeclipper.cxx +++ b/basegfx/source/range/b2drangeclipper.cxx @@ -302,8 +302,7 @@ namespace basegfx { OSL_PRECOND( !mbIsFinished, "ImplPolygon::intersect(): called on already finished polygon!" ); - OSL_PRECOND( !isFinishingEdge - || (isFinishingEdge && &rEvent.getRect() == &rActiveEdge.getRect()), + OSL_PRECOND( !isFinishingEdge || &rEvent.getRect() == &rActiveEdge.getRect(), "ImplPolygon::intersect(): inconsistent ending!" ); const B2DPoint aIntersectionPoint( rEvent.getPos(), diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx index 8b92c8e5cf26..53a10788f67b 100644 --- a/basic/source/runtime/runtime.cxx +++ b/basic/source/runtime/runtime.cxx @@ -1628,7 +1628,7 @@ inline bool checkUnoStructCopy( bool bVBA, SbxVariableRef& refVal, SbxVariableRe SbxDataType eVarType = refVar->GetType(); SbxDataType eValType = refVal->GetType(); - if ( !( !bVBA|| ( bVBA && refVar->GetType() != SbxEMPTY ) ) || !refVar->CanWrite() ) + if ( !( !bVBA || refVar->GetType() != SbxEMPTY ) || !refVar->CanWrite() ) return false; if ( eValType != SbxOBJECT ) @@ -1825,7 +1825,7 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b // Getting in here causes problems with objects with default properties // if they are SbxEMPTY I guess - if ( !bHandleDefaultProp || ( bHandleDefaultProp && eValType == SbxOBJECT ) ) + if ( !bHandleDefaultProp || eValType == SbxOBJECT ) { // activate GetOject for collections on refVal SbxBase* pObjVarObj = refVal->GetObject(); @@ -3842,7 +3842,7 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem ) } } // consider index-access for UnoObjects - else if( pElem->GetType() == SbxOBJECT && !pElem->ISA(SbxMethod) && ( !bVBAEnabled || ( bVBAEnabled && !pElem->ISA(SbxProperty) ) ) ) + else if( pElem->GetType() == SbxOBJECT && !pElem->ISA(SbxMethod) && ( !bVBAEnabled || !pElem->ISA(SbxProperty) ) ) { pPar = pElem->GetParameters(); if ( pPar ) diff --git a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx index 0c2efa7fb1ad..a56579c480d7 100644 --- a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx @@ -885,8 +885,7 @@ bool AxisItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet bool bPropExisted = ( GetPropertySet()->getPropertyValue( "TextRotation" ) >>= fOldVal ); - if( ! bPropExisted || - ( bPropExisted && fOldVal != fVal )) + if( ! bPropExisted || fOldVal != fVal ) { GetPropertySet()->setPropertyValue( "TextRotation" , uno::makeAny( fVal )); bChangedOtherwise = true; diff --git a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx index 74ebe3b0c714..67f865cb4d62 100644 --- a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx @@ -505,8 +505,7 @@ bool DataPointItemConverter::ApplySpecialItem( bool bPropExisted = ( GetPropertySet()->getPropertyValue( "TextRotation" ) >>= fOldValue ); - if( ! bPropExisted || - ( bPropExisted && fOldValue != fValue )) + if( ! bPropExisted || fOldValue != fValue ) { GetPropertySet()->setPropertyValue( "TextRotation" , uno::makeAny( fValue )); bChanged = true; diff --git a/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx b/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx index fe94df3f3dc2..05bc7fa9c5b3 100644 --- a/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx @@ -459,8 +459,7 @@ bool TextLabelItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxIte bool bPropExisted = (GetPropertySet()->getPropertyValue("TextRotation") >>= fOldValue); - if (!bPropExisted || - (bPropExisted && fOldValue != fValue)) + if (!bPropExisted || fOldValue != fValue) { GetPropertySet()->setPropertyValue("TextRotation", uno::makeAny(fValue)); bChanged = true; diff --git a/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx b/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx index 613193b9af95..8750cd1d5b77 100644 --- a/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx @@ -186,8 +186,7 @@ bool TitleItemConverter::ApplySpecialItem( bool bPropExisted = ( GetPropertySet()->getPropertyValue( "TextRotation" ) >>= fOldVal ); - if( ! bPropExisted || - ( bPropExisted && fOldVal != fVal )) + if( ! bPropExisted || fOldVal != fVal ) { GetPropertySet()->setPropertyValue( "TextRotation" , uno::makeAny( fVal )); bChanged = true; diff --git a/connectivity/source/drivers/file/FDatabaseMetaData.cxx b/connectivity/source/drivers/file/FDatabaseMetaData.cxx index cde05f7e5659..36cf6e4f540f 100644 --- a/connectivity/source/drivers/file/FDatabaseMetaData.cxx +++ b/connectivity/source/drivers/file/FDatabaseMetaData.cxx @@ -265,7 +265,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables( { aName = aName.copy(0, (aName.getLength()-(aFilenameExtension.getLength()+1))); sal_Unicode nChar = aName.toChar(); - if ( match(tableNamePattern,aName,'\0') && ( !bCheckEnabled || ( bCheckEnabled && ((nChar < '0' || nChar > '9')))) ) + if ( match(tableNamePattern,aName,'\0') && ( !bCheckEnabled || (nChar < '0' || nChar > '9')) ) { aRow.push_back(new ORowSetValueDecorator(aName)); bNewRow = true; @@ -280,7 +280,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables( if (aURL.getExtension().isEmpty()) { sal_Unicode nChar = aURL.getBase()[0]; - if(match(tableNamePattern,aURL.getBase(),'\0') && ( !bCheckEnabled || ( bCheckEnabled && ((nChar < '0' || nChar > '9')))) ) + if(match(tableNamePattern,aURL.getBase(),'\0') && ( !bCheckEnabled || (nChar < '0' || nChar > '9') ) ) { aRow.push_back(new ORowSetValueDecorator(OUString(aURL.getBase()))); bNewRow = true; diff --git a/drawinglayer/source/processor3d/zbufferprocessor3d.cxx b/drawinglayer/source/processor3d/zbufferprocessor3d.cxx index 6ccd174df2dc..f900a68e85c4 100644 --- a/drawinglayer/source/processor3d/zbufferprocessor3d.cxx +++ b/drawinglayer/source/processor3d/zbufferprocessor3d.cxx @@ -296,7 +296,7 @@ private: const bool bTextureActive(mrProcessor.getGeoTexSvx().get() || mrProcessor.getTransparenceGeoTexSvx().get()); mbUseTex = bTextureActive && (mbHasTexCoor || mbHasInvTexCoor || mrProcessor.getSimpleTextureActive()); const bool bUseColorTex(mbUseTex && mrProcessor.getGeoTexSvx().get()); - const bool bNeedNrmOrCol(!bUseColorTex || (bUseColorTex && mrProcessor.getModulate())); + const bool bNeedNrmOrCol(!bUseColorTex || mrProcessor.getModulate()); mbUseNrm = bNeedNrmOrCol && SCANLINE_EMPTY_INDEX != rA.getNormalIndex() && SCANLINE_EMPTY_INDEX != rB.getNormalIndex(); mbUseCol = !mbUseNrm && bNeedNrmOrCol && SCANLINE_EMPTY_INDEX != rA.getColorIndex() && SCANLINE_EMPTY_INDEX != rB.getColorIndex(); diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx index 6b846e74491f..f99fff5f9203 100644 --- a/editeng/source/items/numitem.cxx +++ b/editeng/source/items/numitem.cxx @@ -398,7 +398,7 @@ void SvxNumberFormat::SetGraphicBrush( const SvxBrushItem* pBrushItem, delete pGraphicBrush; pGraphicBrush = 0; } - else if ( !pGraphicBrush || (pGraphicBrush && !(*pBrushItem == *pGraphicBrush)) ) + else if ( !pGraphicBrush || !(*pBrushItem == *pGraphicBrush) ) { delete pGraphicBrush; pGraphicBrush = static_cast<SvxBrushItem*>(pBrushItem->Clone()); diff --git a/sc/source/filter/oox/worksheetfragment.cxx b/sc/source/filter/oox/worksheetfragment.cxx index 1eb803d678e5..97539e686044 100644 --- a/sc/source/filter/oox/worksheetfragment.cxx +++ b/sc/source/filter/oox/worksheetfragment.cxx @@ -320,7 +320,7 @@ ContextHandlerRef WorksheetFragment::onCreateContext( sal_Int32 nElement, const case XLS_TOKEN( oleObjects ): if ( getCurrentElement() == XLS_TOKEN( controls ) ) { - if( aMceState.empty() || ( !aMceState.empty() && aMceState.back() == MCE_STARTED ) ) + if( aMceState.empty() || aMceState.back() == MCE_STARTED ) { if ( getCurrentElement() == XLS_TOKEN( oleObjects ) ) importOleObject( rAttribs ); else diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index 3fb893f37502..c67090eb880b 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -3107,7 +3107,7 @@ void ScXMLExport::WriteCell(ScMyCell& aCell, sal_Int32 nEqualCellCount) if (aCell.maBaseCell.meType == CELLTYPE_FORMULA) { ScFormulaCell* pFormulaCell = aCell.maBaseCell.mpFormula; - if (!bIsMatrix || (bIsMatrix && bIsFirstMatrixCell)) + if (!bIsMatrix || bIsFirstMatrixCell) { if (!mpCompileFormulaCxt) { diff --git a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx index e46e6df7444e..4a2b4e8a124d 100644 --- a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx +++ b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx @@ -556,7 +556,7 @@ void ScAccessibleSpreadsheet::Notify( SfxBroadcaster& rBC, const SfxHint& rHint { ScRange aDelRange; bool bIsDel = rViewData.GetDelMark( aDelRange ); - if ( (!bIsDel || (bIsDel && aMarkRange != aDelRange)) && + if ( (!bIsDel || aMarkRange != aDelRange) && bNewMarked && nNewMarkCount > 0 && !IsSameMarkCell() ) diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index 3fe6ade40744..40e85e942c09 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -545,7 +545,7 @@ bool ScViewFunc::AutoSum( const ScRange& rRange, bool bSubTotal, bool bSetCursor const bool bEndRowEmpty = pDoc->IsBlockEmpty( nTab, nStartCol, nEndRow, nEndCol, nEndRow ); const bool bEndColEmpty = pDoc->IsBlockEmpty( nTab, nEndCol, nStartRow, nEndCol, nEndRow ); - bool bRow = ( ( nStartRow != nEndRow ) && ( bEndRowEmpty || ( !bEndRowEmpty && !bEndColEmpty ) ) ); + bool bRow = ( ( nStartRow != nEndRow ) && ( bEndRowEmpty || !bEndColEmpty ) ); bool bCol = ( ( nStartCol != nEndCol ) && ( bEndColEmpty || nStartRow == nEndRow ) ); // find an empty row for entering the result diff --git a/sd/source/ui/annotations/annotationwindow.cxx b/sd/source/ui/annotations/annotationwindow.cxx index f226d86505ad..bf7fb8a41efe 100644 --- a/sd/source/ui/annotations/annotationwindow.cxx +++ b/sd/source/ui/annotations/annotationwindow.cxx @@ -175,7 +175,7 @@ void AnnotationTextWindow::KeyInput( const KeyEvent& rKeyEvt ) if ( !( (nKey == KEY_Z || nKey == KEY_Y) && rKeyCode.IsMod1()) ) { bool bIsProtected = mpAnnotationWindow->IsProtected(); - if (!bIsProtected || (bIsProtected && !EditEngine::DoesKeyChangeText(rKeyEvt)) ) + if (!bIsProtected || !EditEngine::DoesKeyChangeText(rKeyEvt) ) bDone = mpOutlinerView->PostKeyEvent( rKeyEvt ); } diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index 274db68a1287..a70d6d9f8536 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -717,7 +717,7 @@ void SfxDispatcher::DoDeactivate_Impl(bool bMDI, SfxViewFrame* pNew) for (size_t n=0; n<xImp->aChildWins.size();) { SfxChildWindow *pWin = pWorkWin->GetChildWindow_Impl( (sal_uInt16) ( xImp->aChildWins[n] & 0xFFFF ) ); - if (!pWin || (pWin && pWin->GetAlignment() == SfxChildAlignment::NOALIGNMENT)) + if (!pWin || pWin->GetAlignment() == SfxChildAlignment::NOALIGNMENT) xImp->aChildWins.erase(xImp->aChildWins.begin()+n); else n++; diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx index 02db7eabc03e..76c43e5054a8 100644 --- a/svx/source/dialog/srchdlg.cxx +++ b/svx/source/dialog/srchdlg.cxx @@ -1016,7 +1016,7 @@ void SvxSearchDialog::Init_Impl( bool bSearchPattern ) { EnableControl_Impl(m_pSearchBtn); EnableControl_Impl(m_pReplaceBtn); - if (!bWriter || (bWriter && !m_pNotesBtn->IsChecked())) + if (!bWriter || !m_pNotesBtn->IsChecked()) { EnableControl_Impl(m_pSearchAllBtn); EnableControl_Impl(m_pReplaceAllBtn); @@ -1416,7 +1416,7 @@ IMPL_LINK( SvxSearchDialog, ModifyHdl_Impl, ComboBox *, pEd ) { EnableControl_Impl(m_pSearchBtn); EnableControl_Impl(m_pReplaceBtn); - if (!bWriter || (bWriter && !m_pNotesBtn->IsChecked())) + if (!bWriter || !m_pNotesBtn->IsChecked()) { EnableControl_Impl(m_pSearchAllBtn); EnableControl_Impl(m_pReplaceAllBtn); diff --git a/svx/source/svdraw/gradtrns.cxx b/svx/source/svdraw/gradtrns.cxx index 72981d02ae96..552ccb1f9145 100644 --- a/svx/source/svdraw/gradtrns.cxx +++ b/svx/source/svdraw/gradtrns.cxx @@ -209,7 +209,7 @@ void GradTransformer::VecToGrad(GradTransVector& rV, GradTransGradient& rG, Grad { case css::awt::GradientStyle_LINEAR : { - if(!bMoveSingle || (bMoveSingle && !bMoveFirst)) + if(!bMoveSingle || !bMoveFirst) { basegfx::B2DVector aFullVec(aEndPos - aStartPos); @@ -245,7 +245,7 @@ void GradTransformer::VecToGrad(GradTransVector& rV, GradTransGradient& rG, Grad } } - if(!bMoveSingle || (bMoveSingle && bMoveFirst)) + if(!bMoveSingle || bMoveFirst) { const basegfx::B2DVector aFullVec(aEndPos - aStartPos); const basegfx::B2DPoint aBottomLeft(aRange.getMinX(), aRange.getMaximum().getY()); @@ -278,7 +278,7 @@ void GradTransformer::VecToGrad(GradTransVector& rV, GradTransGradient& rG, Grad } case css::awt::GradientStyle_AXIAL : { - if(!bMoveSingle || (bMoveSingle && !bMoveFirst)) + if(!bMoveSingle || !bMoveFirst) { basegfx::B2DVector aFullVec(aEndPos - aCenter); const basegfx::B2DVector aOldVec(basegfx::B2DPoint(aCenter.getX(), aRange.getMaximum().getY()) - aCenter); |