[Libreoffice-commits] core.git: chart2/source filter/source sd/source sfx2/source svx/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Nov 5 12:28:46 UTC 2018


 chart2/source/view/charttypes/NetChart.cxx |   95 +++++++++++++----------------
 filter/source/msfilter/msvbahelper.cxx     |   20 ++----
 sd/source/ui/animations/motionpathtag.cxx  |   18 ++---
 sfx2/source/appl/newhelp.cxx               |    4 -
 svx/source/form/navigatortree.cxx          |    3 
 svx/source/items/numfmtsh.cxx              |   19 +----
 6 files changed, 69 insertions(+), 90 deletions(-)

New commits:
commit 6d1aafca5d13fa08371a3ff161d12c0f1213555c
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Sun Nov 4 20:17:29 2018 +0300
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Mon Nov 5 13:27:46 2018 +0100

    tdf#120703 PVS: V547 Expression is always true/false
    
    Change-Id: If748a205b328a23473152872c6d0ed87d0570cc1
    Reviewed-on: https://gerrit.libreoffice.org/62857
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/chart2/source/view/charttypes/NetChart.cxx b/chart2/source/view/charttypes/NetChart.cxx
index c5f38386bd3f..fb41194f0906 100644
--- a/chart2/source/view/charttypes/NetChart.cxx
+++ b/chart2/source/view/charttypes/NetChart.cxx
@@ -255,20 +255,18 @@ void NetChart::impl_createSeriesShapes()
             for( std::unique_ptr<VDataSeries> const & pSeries : rXSlot.m_aSeriesVector )
             {
                 sal_Int32 nAttachedAxisIndex = pSeries->getAttachedAxisIndex();
-                PlottingPositionHelper* pPosHelper = &(getPlottingPositionHelper( nAttachedAxisIndex ));
-                if(!pPosHelper)
-                    pPosHelper = m_pMainPosHelper.get();
-                PlotterBase::m_pPosHelper = pPosHelper;
+                m_pPosHelper = &getPlottingPositionHelper(nAttachedAxisIndex);
 
                 pSeriesPoly = &pSeries->m_aPolyPolygonShape3D;
                 if( m_bArea )
                 {
-                    if( !impl_createArea( pSeries.get(), pSeriesPoly, aPreviousSeriesPolyMap[nAttachedAxisIndex], pPosHelper ) )
+                    if (!impl_createArea(pSeries.get(), pSeriesPoly,
+                                         aPreviousSeriesPolyMap[nAttachedAxisIndex], m_pPosHelper))
                         continue;
                 }
                 if( m_bLine )
                 {
-                    if( !impl_createLine( pSeries.get(), pSeriesPoly, pPosHelper ) )
+                    if (!impl_createLine(pSeries.get(), pSeriesPoly, m_pPosHelper))
                         continue;
                 }
                 aPreviousSeriesPolyMap[nAttachedAxisIndex] = pSeriesPoly;
@@ -381,10 +379,7 @@ void NetChart::createShapes()
                     if( aLogicYSumMap.find(nAttachedAxisIndex)==aLogicYSumMap.end() )
                         aLogicYSumMap[nAttachedAxisIndex]=0.0;
 
-                    PlottingPositionHelper* pPosHelper = &(getPlottingPositionHelper( nAttachedAxisIndex ));
-                    if(!pPosHelper)
-                        pPosHelper = m_pMainPosHelper.get();
-                    PlotterBase::m_pPosHelper = pPosHelper;
+                    m_pPosHelper = &getPlottingPositionHelper(nAttachedAxisIndex);
 
                     double fAdd = pSeries->getYValue( nIndex );
                     if( !::rtl::math::isNan(fAdd) && !::rtl::math::isInf(fAdd) )
@@ -415,10 +410,7 @@ void NetChart::createShapes()
                     uno::Reference< drawing::XShapes > xSeriesGroupShape_Shapes = getSeriesGroupShapeFrontChild(pSeries.get(), m_xSeriesTarget);
 
                     sal_Int32 nAttachedAxisIndex = pSeries->getAttachedAxisIndex();
-                    PlottingPositionHelper* pPosHelper = &(getPlottingPositionHelper( nAttachedAxisIndex ));
-                    if(!pPosHelper)
-                        pPosHelper = m_pMainPosHelper.get();
-                    PlotterBase::m_pPosHelper = pPosHelper;
+                    m_pPosHelper = &getPlottingPositionHelper(nAttachedAxisIndex);
 
                     pSeries->m_fLogicZPos = fLogicZ;
 
@@ -434,16 +426,16 @@ void NetChart::createShapes()
                         {
                             if( rXSlot.m_aSeriesVector.size() == 1 || pSeries == rXSlot.m_aSeriesVector.front() )
                             {
-                                fLogicY = pPosHelper->getLogicMinY();
-                                if( !pPosHelper->isMathematicalOrientationY() )
-                                    fLogicY = pPosHelper->getLogicMaxY();
+                                fLogicY = m_pPosHelper->getLogicMinY();
+                                if (!m_pPosHelper->isMathematicalOrientationY())
+                                    fLogicY = m_pPosHelper->getLogicMaxY();
                             }
                             else
                                 fLogicY = 0.0;
                         }
                     }
 
-                    if( pPosHelper->isPercentY() && aLogicYSumMap[nAttachedAxisIndex] != 0.0 )
+                    if (m_pPosHelper->isPercentY() && aLogicYSumMap[nAttachedAxisIndex] != 0.0)
                     {
                         fLogicY = fabs( fLogicY )/aLogicYSumMap[nAttachedAxisIndex];
                     }
@@ -473,7 +465,7 @@ void NetChart::createShapes()
                     fLogicY += aLogicYForNextSeriesMap[nAttachedAxisIndex];
                     aLogicYForNextSeriesMap[nAttachedAxisIndex] = fLogicY;
 
-                    bool bIsVisible = pPosHelper->isLogicVisible( fLogicX, fLogicY, fLogicZ );
+                    bool bIsVisible = m_pPosHelper->isLogicVisible(fLogicX, fLogicY, fLogicZ);
 
                     //remind minimal and maximal x values for area 'grounding' points
                     //only for filled area
@@ -488,17 +480,18 @@ void NetChart::createShapes()
 
                     drawing::Position3D aUnscaledLogicPosition( fLogicX, fLogicY, fLogicZ );
                     drawing::Position3D aScaledLogicPosition(aUnscaledLogicPosition);
-                    pPosHelper->doLogicScaling( aScaledLogicPosition );
+                    m_pPosHelper->doLogicScaling(aScaledLogicPosition);
 
                     //transformation 3) -> 4)
-                    drawing::Position3D aScenePosition( pPosHelper->transformLogicToScene( fLogicX,fLogicY,fLogicZ, false ) );
+                    drawing::Position3D aScenePosition(
+                        m_pPosHelper->transformLogicToScene(fLogicX, fLogicY, fLogicZ, false));
 
                     //better performance for big data
                     FormerPoint aFormerPoint( aSeriesFormerPointMap[pSeries.get()] );
-                    pPosHelper->setCoordinateSystemResolution( m_aCoordinateSystemResolution );
+                    m_pPosHelper->setCoordinateSystemResolution(m_aCoordinateSystemResolution);
                     if( !pSeries->isAttributedDataPoint(nIndex)
-                            &&
-                        pPosHelper->isSameForGivenResolution( aFormerPoint.m_fX, aFormerPoint.m_fY, aFormerPoint.m_fZ
+                            && m_pPosHelper->isSameForGivenResolution(
+                               aFormerPoint.m_fX, aFormerPoint.m_fY, aFormerPoint.m_fZ
                                                             , aScaledLogicPosition.PositionX, aScaledLogicPosition.PositionY, aScaledLogicPosition.PositionZ ) )
                     {
                         ++nSkippedPoints;
@@ -517,8 +510,11 @@ void NetChart::createShapes()
                         if( !bIsVisible && m_bArea )
                         {
                             drawing::Position3D aClippedPos(aScaledLogicPosition);
-                            pPosHelper->clipScaledLogicValues( nullptr, &aClippedPos.PositionY, nullptr );
-                            if( pPosHelper->isLogicVisible( aClippedPos.PositionX, aClippedPos.PositionY, aClippedPos.PositionZ ) )
+                            m_pPosHelper->clipScaledLogicValues(nullptr, &aClippedPos.PositionY,
+                                                                nullptr);
+                            if (m_pPosHelper->isLogicVisible(aClippedPos.PositionX,
+                                                             aClippedPos.PositionY,
+                                                             aClippedPos.PositionZ))
                             {
                                 AddPointToPoly( pSeries->m_aPolyPolygonShape3D, aClippedPos, pSeries->m_nPolygonIndex );
                                 AddPointToPoly( pSeries->m_aPolyPolygonShape3D, aScaledLogicPosition, pSeries->m_nPolygonIndex );
@@ -550,33 +546,28 @@ void NetChart::createShapes()
 
                         //create data point
                         drawing::Direction3D aSymbolSize(0,0,0);
-                        if( bCreateSymbol )
+                        if (bCreateSymbol) // implies pSymbolProperties
                         {
-                            if( pSymbolProperties )
+                            if (pSymbolProperties->Style != SymbolStyle_NONE)
                             {
-                                if( pSymbolProperties->Style != SymbolStyle_NONE )
-                                {
-                                    aSymbolSize.DirectionX = pSymbolProperties->Size.Width;
-                                    aSymbolSize.DirectionY = pSymbolProperties->Size.Height;
-                                }
+                                aSymbolSize.DirectionX = pSymbolProperties->Size.Width;
+                                aSymbolSize.DirectionY = pSymbolProperties->Size.Height;
+                            }
 
-                                if( pSymbolProperties->Style == SymbolStyle_STANDARD )
-                                {
-                                    sal_Int32 nSymbol = pSymbolProperties->StandardSymbol;
-                                    m_pShapeFactory->createSymbol2D( xPointGroupShape_Shapes
-                                            , aScenePosition, aSymbolSize
-                                            , nSymbol
-                                            , pSymbolProperties->BorderColor
-                                            , pSymbolProperties->FillColor );
-                                }
-                                else if( pSymbolProperties->Style == SymbolStyle_GRAPHIC )
-                                {
-                                    m_pShapeFactory->createGraphic2D( xPointGroupShape_Shapes
-                                            , aScenePosition , aSymbolSize
-                                            , pSymbolProperties->Graphic );
-                                }
-                                //@todo other symbol styles
+                            if (pSymbolProperties->Style == SymbolStyle_STANDARD)
+                            {
+                                sal_Int32 nSymbol = pSymbolProperties->StandardSymbol;
+                                m_pShapeFactory->createSymbol2D(
+                                    xPointGroupShape_Shapes, aScenePosition, aSymbolSize, nSymbol,
+                                    pSymbolProperties->BorderColor, pSymbolProperties->FillColor);
+                            }
+                            else if (pSymbolProperties->Style == SymbolStyle_GRAPHIC)
+                            {
+                                m_pShapeFactory->createGraphic2D(xPointGroupShape_Shapes,
+                                                                 aScenePosition, aSymbolSize,
+                                                                 pSymbolProperties->Graphic);
                             }
+                            //@todo other symbol styles
                         }
 
                         //create data point label
@@ -587,7 +578,8 @@ void NetChart::createShapes()
                                         , aScenePosition.PositionY
                                         , aScenePosition.PositionZ+getTransformedDepth() );
 
-                            sal_Int32 nLabelPlacement = pSeries->getLabelPlacement( nIndex, m_xChartTypeModel, pPosHelper->isSwapXAndY() );
+                            sal_Int32 nLabelPlacement = pSeries->getLabelPlacement(
+                                nIndex, m_xChartTypeModel, m_pPosHelper->isSwapXAndY());
 
                             switch(nLabelPlacement)
                             {
@@ -622,7 +614,8 @@ void NetChart::createShapes()
                             sal_Int32 nOffset = 100; //todo maybe calculate this font height dependent
                             if( nLabelPlacement == css::chart::DataLabelPlacement::OUTSIDE )
                             {
-                                PolarPlottingPositionHelper* pPolarPosHelper = dynamic_cast<PolarPlottingPositionHelper*>(pPosHelper);
+                                PolarPlottingPositionHelper* pPolarPosHelper
+                                    = dynamic_cast<PolarPlottingPositionHelper*>(m_pPosHelper);
                                 if( pPolarPosHelper )
                                 {
                                     PolarLabelPositionHelper aPolarLabelPositionHelper(pPolarPosHelper,m_nDimension,m_xLogicTarget,m_pShapeFactory);
diff --git a/filter/source/msfilter/msvbahelper.cxx b/filter/source/msfilter/msvbahelper.cxx
index 90c23a0797b3..8e7cfec8267c 100644
--- a/filter/source/msfilter/msvbahelper.cxx
+++ b/filter/source/msfilter/msvbahelper.cxx
@@ -482,20 +482,16 @@ bool executeMacro( SfxObjectShell* pShell, const OUString& sMacroName, uno::Sequ
     uno::Sequence< uno::Any > aOutArgs;
 
     try
-    {   ErrCode nErr( ERRCODE_BASIC_INTERNAL_ERROR );
-        if ( pShell )
+    {
+        ErrCode nErr = pShell->CallXScript(sUrl, aArgs, aRet, aOutArgsIndex, aOutArgs, false);
+        sal_Int32 nLen = aOutArgs.getLength();
+        // convert any out params to seem like they were inputs
+        if (nLen)
         {
-            nErr = pShell->CallXScript( sUrl,
-                               aArgs, aRet, aOutArgsIndex, aOutArgs, false );
-            sal_Int32 nLen = aOutArgs.getLength();
-            // convert any out params to seem like they were inputs
-            if ( nLen )
+            for (sal_Int32 index = 0; index < nLen; ++index)
             {
-                for ( sal_Int32 index=0; index < nLen; ++index )
-                {
-                    sal_Int32 nOutIndex = aOutArgsIndex[ index ];
-                    aArgs[ nOutIndex ] = aOutArgs[ index ];
-                }
+                sal_Int32 nOutIndex = aOutArgsIndex[index];
+                aArgs[nOutIndex] = aOutArgs[index];
             }
         }
         bRes = ( nErr == ERRCODE_NONE );
diff --git a/sd/source/ui/animations/motionpathtag.cxx b/sd/source/ui/animations/motionpathtag.cxx
index aa9bfe2e3dae..130775dfea49 100644
--- a/sd/source/ui/animations/motionpathtag.cxx
+++ b/sd/source/ui/animations/motionpathtag.cxx
@@ -947,16 +947,16 @@ void MotionPathTag::addCustomHandles( SdrHdlList& rHandlerList )
                         rHandlerList.AddHdl(o3tl::make_unique<SmartHdl>( xThis, mpPathObj, aRect.TopLeft()    ,SdrHdlKind::UpperLeft));
                         rHandlerList.AddHdl(o3tl::make_unique<SmartHdl>( xThis, mpPathObj, aRect.BottomRight(),SdrHdlKind::LowerRight));
                     }
-                    else
+                    else // !bWdt0 && !bHgt0
                     {
-                        if (!bWdt0 && !bHgt0) rHandlerList.AddHdl(o3tl::make_unique<SmartHdl>( xThis, mpPathObj, aRect.TopLeft()     ,SdrHdlKind::UpperLeft));
-                        if (          !bHgt0) rHandlerList.AddHdl(o3tl::make_unique<SmartHdl>( xThis, mpPathObj, aRect.TopCenter()   ,SdrHdlKind::Upper));
-                        if (!bWdt0 && !bHgt0) rHandlerList.AddHdl(o3tl::make_unique<SmartHdl>( xThis, mpPathObj, aRect.TopRight()    ,SdrHdlKind::UpperRight));
-                        if (!bWdt0          ) rHandlerList.AddHdl(o3tl::make_unique<SmartHdl>( xThis, mpPathObj, aRect.LeftCenter()  ,SdrHdlKind::Left ));
-                        if (!bWdt0          ) rHandlerList.AddHdl(o3tl::make_unique<SmartHdl>( xThis, mpPathObj, aRect.RightCenter() ,SdrHdlKind::Right));
-                        if (!bWdt0 && !bHgt0) rHandlerList.AddHdl(o3tl::make_unique<SmartHdl>( xThis, mpPathObj, aRect.BottomLeft()  ,SdrHdlKind::LowerLeft));
-                        if (          !bHgt0) rHandlerList.AddHdl(o3tl::make_unique<SmartHdl>( xThis, mpPathObj, aRect.BottomCenter(),SdrHdlKind::Lower));
-                        if (!bWdt0 && !bHgt0) rHandlerList.AddHdl(o3tl::make_unique<SmartHdl>( xThis, mpPathObj, aRect.BottomRight() ,SdrHdlKind::LowerRight));
+                        rHandlerList.AddHdl(o3tl::make_unique<SmartHdl>( xThis, mpPathObj, aRect.TopLeft()     ,SdrHdlKind::UpperLeft));
+                        rHandlerList.AddHdl(o3tl::make_unique<SmartHdl>( xThis, mpPathObj, aRect.TopCenter()   ,SdrHdlKind::Upper));
+                        rHandlerList.AddHdl(o3tl::make_unique<SmartHdl>( xThis, mpPathObj, aRect.TopRight()    ,SdrHdlKind::UpperRight));
+                        rHandlerList.AddHdl(o3tl::make_unique<SmartHdl>( xThis, mpPathObj, aRect.LeftCenter()  ,SdrHdlKind::Left ));
+                        rHandlerList.AddHdl(o3tl::make_unique<SmartHdl>( xThis, mpPathObj, aRect.RightCenter() ,SdrHdlKind::Right));
+                        rHandlerList.AddHdl(o3tl::make_unique<SmartHdl>( xThis, mpPathObj, aRect.BottomLeft()  ,SdrHdlKind::LowerLeft));
+                        rHandlerList.AddHdl(o3tl::make_unique<SmartHdl>( xThis, mpPathObj, aRect.BottomCenter(),SdrHdlKind::Lower));
+                        rHandlerList.AddHdl(o3tl::make_unique<SmartHdl>( xThis, mpPathObj, aRect.BottomRight() ,SdrHdlKind::LowerRight));
                     }
 
                     while( nCount < rHandlerList.GetHdlCount() )
diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx
index 7f52b252ea8a..d372b47298e5 100644
--- a/sfx2/source/appl/newhelp.cxx
+++ b/sfx2/source/appl/newhelp.cxx
@@ -3065,10 +3065,8 @@ void SfxHelpWindow_Impl::DoAction( sal_uInt16 nActionId )
                     aURL.Complete = ".uno:SourceView";
                 else if ( TBI_COPY == nActionId )
                     aURL.Complete = ".uno:Copy";
-                else if ( TBI_SELECTIONMODE == nActionId )
+                else // TBI_SELECTIONMODE == nActionId
                     aURL.Complete = ".uno:SelectTextMode";
-                else
-                    aURL.Complete = ".uno:SearchDialog";
                 Reference< util::XURLTransformer > xTrans( util::URLTransformer::create( ::comphelper::getProcessComponentContext() ) );
                 xTrans->parseStrict(aURL);
                 Reference < XDispatch > xDisp = xProv->queryDispatch( aURL, OUString(), 0 );
diff --git a/svx/source/form/navigatortree.cxx b/svx/source/form/navigatortree.cxx
index 82747e00acf0..72ca4f43a4bf 100644
--- a/svx/source/form/navigatortree.cxx
+++ b/svx/source/form/navigatortree.cxx
@@ -660,8 +660,7 @@ namespace svxform
         // but because I disabled SelectionHandling, I have to do it later
         sal_uIntPtr nExpectedSelectionCount = GetSelectionCount();
 
-        if( pEntry )
-            GetModel()->Remove( pEntry );
+        GetModel()->Remove(pEntry);
 
         if (nExpectedSelectionCount != GetSelectionCount())
             SynchronizeSelection();
diff --git a/svx/source/items/numfmtsh.cxx b/svx/source/items/numfmtsh.cxx
index a870053d54fd..923a0db04f4b 100644
--- a/svx/source/items/numfmtsh.cxx
+++ b/svx/source/items/numfmtsh.cxx
@@ -1548,25 +1548,18 @@ bool SvxNumberFormatShell::IsInTable(sal_uInt16 const nPos, bool const bTmpBanki
     if (nPos != sal_uInt16(-1))
     {
         const NfCurrencyTable& rCurrencyTable = SvNumberFormatter::GetTheCurrencyTable();
-        sal_uInt16 nCount = rCurrencyTable.size();
 
-        if (nPos < nCount)
+        if (nPos < rCurrencyTable.size())
         {
             NfWSStringsDtor aWSStringsDtor;
+            pFormatter->GetCurrencyFormatStrings(aWSStringsDtor, rCurrencyTable[nPos], bTmpBanking);
 
-            const NfCurrencyEntry* pTmpCurrencyEntry = &rCurrencyTable[nPos];
-
-            if (pTmpCurrencyEntry != nullptr)
+            for (const OUString& s : aWSStringsDtor)
             {
-                pFormatter->GetCurrencyFormatStrings(aWSStringsDtor, *pTmpCurrencyEntry, bTmpBanking);
-
-                for (const OUString& s : aWSStringsDtor)
+                if (s == rFmtString)
                 {
-                    if (s == rFmtString)
-                    {
-                        bFlag = true;
-                        break;
-                    }
+                    bFlag = true;
+                    break;
                 }
             }
         }


More information about the Libreoffice-commits mailing list