[Libreoffice-commits] core.git: basctl/source basegfx/source basic/source chart2/source connectivity/source drawinglayer/source editeng/source sc/source sd/source sfx2/source svx/source

Julien Nabet serval2412 at yahoo.fr
Sun Jun 14 03:19:17 PDT 2015


 basctl/source/basicide/basidesh.cxx                                |    2 +-
 basctl/source/basicide/basobj2.cxx                                 |    4 ++--
 basegfx/source/range/b2drangeclipper.cxx                           |    3 +--
 basic/source/runtime/runtime.cxx                                   |    6 +++---
 chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx      |    3 +--
 chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx |    3 +--
 chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx |    3 +--
 chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx     |    3 +--
 connectivity/source/drivers/file/FDatabaseMetaData.cxx             |    4 ++--
 drawinglayer/source/processor3d/zbufferprocessor3d.cxx             |    2 +-
 editeng/source/items/numitem.cxx                                   |    2 +-
 sc/source/filter/oox/worksheetfragment.cxx                         |    2 +-
 sc/source/filter/xml/xmlexprt.cxx                                  |    2 +-
 sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx               |    2 +-
 sc/source/ui/view/viewfun2.cxx                                     |    2 +-
 sd/source/ui/annotations/annotationwindow.cxx                      |    2 +-
 sfx2/source/control/dispatch.cxx                                   |    2 +-
 svx/source/dialog/srchdlg.cxx                                      |    4 ++--
 svx/source/svdraw/gradtrns.cxx                                     |    6 +++---
 19 files changed, 26 insertions(+), 31 deletions(-)

New commits:
commit b226928c6d5d094359b970b64a063b243d4fc84c
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Sun Jun 14 12:17:55 2015 +0200

    cppcheck: redundantCondition [part1]
    
    Change-Id: I21c5340e7b5ec09248b08aa76f43acf883c56cd8

diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx
index 661a667..b31d18c 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 ce19f5c..1921afe 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 a62f44e..1b49294 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 8b92c8e..53a1078 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 0c2efa7..a56579c 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 74ebe3b..67f865c 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 fe94df3..05bc7fa 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 613193b..8750cd1 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 cde05f7..36cf6e4 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 6ccd174..f900a68 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 6b846e7..f99fff5 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 1eb803d..97539e6 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 3fb893f..c67090e 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 e46e6df..4a2b4e8 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 3fe6ade..40e85e9 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 f226d865..bf7fb8a 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 274db68..a70d6d9 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 02db7ea..76c43e5 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 72981d0..552ccb1 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);


More information about the Libreoffice-commits mailing list