[Libreoffice-commits] core.git: cui/source extensions/source filter/source framework/source linguistic/source lotuswordpro/source sc/source sd/source stoc/source svx/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sun Nov 4 15:58:42 UTC 2018


 cui/source/tabpages/measure.cxx                   |   65 +++----------------
 extensions/source/config/ldap/ldapaccess.cxx      |    8 +-
 filter/source/graphicfilter/ipict/ipict.cxx       |   10 +--
 framework/source/layoutmanager/layoutmanager.cxx  |    9 --
 linguistic/source/lngprophelp.cxx                 |    9 --
 lotuswordpro/source/filter/lwptablelayout.cxx     |   72 ++++++++++------------
 sc/source/filter/lotus/lotform.cxx                |    3 
 sd/source/ui/sidebar/LayoutMenu.cxx               |    5 -
 stoc/source/corereflection/lrucache.hxx           |   15 +---
 svx/source/sidebar/line/LinePropertyPanelBase.cxx |    8 +-
 10 files changed, 71 insertions(+), 133 deletions(-)

New commits:
commit 628e96ce1fce194b30a5c2912feb8b7ec0328db0
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Sun Nov 4 17:06:47 2018 +0300
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Sun Nov 4 16:57:59 2018 +0100

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

diff --git a/cui/source/tabpages/measure.cxx b/cui/source/tabpages/measure.cxx
index 977c9c253fc5..e27e1c8d9970 100644
--- a/cui/source/tabpages/measure.cxx
+++ b/cui/source/tabpages/measure.cxx
@@ -166,75 +166,39 @@ void SvxMeasurePage::Reset( const SfxItemSet* rAttrs )
     // SdrMeasureLineDistItem
     if( pItem == nullptr )
         pItem = &pPool->GetDefaultItem( SDRATTR_MEASURELINEDIST );
-    if( pItem )
-    {
-        long nValue = static_cast<const SdrMetricItem*>( pItem )->GetValue();
-        SetMetricValue( *m_xMtrFldLineDist, nValue, eUnit );
-    }
-    else
-    {
-        m_xMtrFldLineDist->set_text(OUString());
-    }
+    SetMetricValue(*m_xMtrFldLineDist, static_cast<const SdrMetricItem*>(pItem)->GetValue(), eUnit);
     m_xMtrFldLineDist->save_value();
 
     // SdrMeasureHelplineOverhangItem
     pItem = GetItem( *rAttrs, SDRATTR_MEASUREHELPLINEOVERHANG );
     if( pItem == nullptr )
         pItem = &pPool->GetDefaultItem( SDRATTR_MEASUREHELPLINEOVERHANG );
-    if( pItem )
-    {
-        long nValue = static_cast<const SdrMetricItem*>( pItem )->GetValue();
-        SetMetricValue( *m_xMtrFldHelplineOverhang, nValue, eUnit );
-    }
-    else
-    {
-        m_xMtrFldHelplineOverhang->set_text(OUString());
-    }
+    SetMetricValue(*m_xMtrFldHelplineOverhang, static_cast<const SdrMetricItem*>(pItem)->GetValue(),
+                   eUnit);
     m_xMtrFldHelplineOverhang->save_value();
 
     // SdrMeasureHelplineDistItem
     pItem = GetItem( *rAttrs, SDRATTR_MEASUREHELPLINEDIST );
     if( pItem == nullptr )
         pItem = &pPool->GetDefaultItem( SDRATTR_MEASUREHELPLINEDIST );
-    if( pItem )
-    {
-        long nValue = static_cast<const SdrMetricItem*>( pItem )->GetValue();
-        SetMetricValue( *m_xMtrFldHelplineDist, nValue, eUnit );
-    }
-    else
-    {
-        m_xMtrFldHelplineDist->set_text(OUString());
-    }
+    SetMetricValue(*m_xMtrFldHelplineDist, static_cast<const SdrMetricItem*>(pItem)->GetValue(),
+                   eUnit);
     m_xMtrFldHelplineDist->save_value();
 
     // SdrMeasureHelpline1LenItem
     pItem = GetItem( *rAttrs, SDRATTR_MEASUREHELPLINE1LEN );
     if( pItem == nullptr )
         pItem = &pPool->GetDefaultItem( SDRATTR_MEASUREHELPLINE1LEN );
-    if( pItem )
-    {
-        long nValue = static_cast<const SdrMetricItem*>( pItem )->GetValue();
-        SetMetricValue( *m_xMtrFldHelpline1Len, nValue, eUnit );
-    }
-    else
-    {
-        m_xMtrFldHelpline1Len->set_text(OUString());
-    }
+    SetMetricValue(*m_xMtrFldHelpline1Len, static_cast<const SdrMetricItem*>(pItem)->GetValue(),
+                   eUnit);
     m_xMtrFldHelpline1Len->save_value();
 
     // SdrMeasureHelpline2LenItem
     pItem = GetItem( *rAttrs, SDRATTR_MEASUREHELPLINE2LEN );
     if( pItem == nullptr )
         pItem = &pPool->GetDefaultItem( SDRATTR_MEASUREHELPLINE2LEN );
-    if( pItem )
-    {
-        long nValue = static_cast<const SdrMetricItem*>( pItem )->GetValue();
-        SetMetricValue( *m_xMtrFldHelpline2Len, nValue, eUnit );
-    }
-    else
-    {
-        m_xMtrFldHelpline2Len->set_text(OUString());
-    }
+    SetMetricValue(*m_xMtrFldHelpline2Len, static_cast<const SdrMetricItem*>(pItem)->GetValue(),
+                   eUnit);
     m_xMtrFldHelpline2Len->save_value();
 
     // SdrMeasureBelowRefEdgeItem
@@ -253,15 +217,8 @@ void SvxMeasurePage::Reset( const SfxItemSet* rAttrs )
     pItem = GetItem( *rAttrs, SDRATTR_MEASUREDECIMALPLACES );
     if( pItem == nullptr )
         pItem = &pPool->GetDefaultItem( SDRATTR_MEASUREDECIMALPLACES );
-    if( pItem )
-    {
-        sal_Int16 nValue = static_cast<const SdrMeasureDecimalPlacesItem*>( pItem )->GetValue();
-        m_xMtrFldDecimalPlaces->set_value(nValue);
-    }
-    else
-    {
-        m_xMtrFldDecimalPlaces->set_text(OUString());
-    }
+    m_xMtrFldDecimalPlaces->set_value(
+      static_cast<const SdrMeasureDecimalPlacesItem*>(pItem)->GetValue());
     m_xMtrFldDecimalPlaces->save_value();
 
     // SdrMeasureTextRota90Item
diff --git a/extensions/source/config/ldap/ldapaccess.cxx b/extensions/source/config/ldap/ldapaccess.cxx
index caece9d1cde5..e6a44aa1b0c1 100644
--- a/extensions/source/config/ldap/ldapaccess.cxx
+++ b/extensions/source/config/ldap/ldapaccess.cxx
@@ -73,11 +73,10 @@ static void checkLdapReturnCode(const sal_Char *aOperation,
         message += OUString::createFromAscii(aOperation) + ": ";
     }
     message += OUString::createFromAscii(ldap_err2string(aRetCode)) + " (" ;
-    sal_Char *stub = nullptr ;
 
 #ifndef LDAP_OPT_SIZELIMIT // for use with OpenLDAP
+    sal_Char* stub = nullptr;
     ldap_get_lderrno(aConnection, NULL, &stub) ;
-#endif
     if (stub != nullptr)
     {
         message += OUString::createFromAscii(stub) ;
@@ -88,7 +87,10 @@ static void checkLdapReturnCode(const sal_Char *aOperation,
         // This call is thus disabled for the moment.
         //ldap_memfree(stub) ;
     }
-    else { message += "No additional information" ; }
+    else
+#endif
+    { message += "No additional information"; }
+
     message += ")" ;
     throw ldap::LdapGenericException(message, nullptr, aRetCode) ;
 }
diff --git a/filter/source/graphicfilter/ipict/ipict.cxx b/filter/source/graphicfilter/ipict/ipict.cxx
index 8b99ccbd1aa8..01e6fe296685 100644
--- a/filter/source/graphicfilter/ipict/ipict.cxx
+++ b/filter/source/graphicfilter/ipict/ipict.cxx
@@ -923,7 +923,7 @@ sal_uLong PictReader::ReadPixMapEtc( BitmapEx &rBitmap, bool bBaseAddr, bool bCo
 
         if (nRowBytes < 8 || nPackType == 1)
         {
-            if (nWidth && nHeight > pPict->remainingSize() / (sizeof(sal_uInt16) * nWidth))
+            if (nHeight > pPict->remainingSize() / (sizeof(sal_uInt16) * nWidth))
                 return 0xffffffff;
         }
         else
@@ -1021,10 +1021,10 @@ sal_uLong PictReader::ReadPixMapEtc( BitmapEx &rBitmap, bool bBaseAddr, bool bCo
         if ( nRowBytes < 8 || nPackType == 1 )
         {
             const size_t nMaxPixels = pPict->remainingSize() / 4;
-            const size_t nMaxRows = nWidth ? nMaxPixels / nWidth : SAL_MAX_UINT16;
+            const size_t nMaxRows = nMaxPixels / nWidth;
             if (nHeight > nMaxRows)
                 return 0xffffffff;
-            const size_t nMaxCols = nHeight ? nMaxPixels / nHeight : SAL_MAX_UINT16;
+            const size_t nMaxCols = nMaxPixels / nHeight;
             if (nWidth > nMaxCols)
                 return 0xffffffff;
 
@@ -1044,10 +1044,10 @@ sal_uLong PictReader::ReadPixMapEtc( BitmapEx &rBitmap, bool bBaseAddr, bool bCo
         else if ( nPackType == 2 )
         {
             const size_t nMaxPixels = pPict->remainingSize() / 3;
-            const size_t nMaxRows = nWidth ? nMaxPixels / nWidth : SAL_MAX_UINT16;
+            const size_t nMaxRows = nMaxPixels / nWidth;
             if (nHeight > nMaxRows)
                 return 0xffffffff;
-            const size_t nMaxCols = nHeight ? nMaxPixels / nHeight : SAL_MAX_UINT16;
+            const size_t nMaxCols = nMaxPixels / nHeight;
             if (nWidth > nMaxCols)
                 return 0xffffffff;
 
diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx
index d11dc8eb2cd5..b33f92557fd9 100644
--- a/framework/source/layoutmanager/layoutmanager.cxx
+++ b/framework/source/layoutmanager/layoutmanager.cxx
@@ -1238,7 +1238,6 @@ void SAL_CALL LayoutManager::setDockingAreaAcceptor( const Reference< ui::XDocki
         m_aAsyncLayoutTimer.Stop();
 
     bool bAutomaticToolbars( m_bAutomaticToolbars );
-    std::vector< Reference< awt::XWindow > > oldDockingAreaWindows;
 
     ToolbarLayoutManager* pToolbarManager = m_xToolbarManager.get();
 
@@ -1261,7 +1260,6 @@ void SAL_CALL LayoutManager::setDockingAreaAcceptor( const Reference< ui::XDocki
             pContainerWindow->RemoveChildEventListener( LINK( this, LayoutManager, WindowEventListener ) );
     }
 
-    Reference< ui::XDockingAreaAcceptor > xOldDockingAreaAcceptor( m_xDockingAreaAcceptor );
     m_xDockingAreaAcceptor = xDockingAreaAcceptor;
     if ( m_xDockingAreaAcceptor.is() )
     {
@@ -1302,13 +1300,6 @@ void SAL_CALL LayoutManager::setDockingAreaAcceptor( const Reference< ui::XDocki
     else
         implts_destroyElements(); // remove all elements
 
-    if ( !oldDockingAreaWindows.empty() )
-    {
-        // Reset docking area size for our old docking area acceptor
-        awt::Rectangle aEmptyRect;
-        xOldDockingAreaAcceptor->setDockingAreaSpace( aEmptyRect );
-    }
-
     if ( pToolbarManager && xDockingAreaAcceptor.is() )
     {
         if ( bAutomaticToolbars )
diff --git a/linguistic/source/lngprophelp.cxx b/linguistic/source/lngprophelp.cxx
index fd633f4671f5..7c061be2a621 100644
--- a/linguistic/source/lngprophelp.cxx
+++ b/linguistic/source/lngprophelp.cxx
@@ -584,8 +584,6 @@ bool PropertyHelper_Hyphen::propertyChange_Impl( const PropertyChangeEvent& rEvt
 
     if (!bRes  &&  GetPropSet().is()  &&  rEvt.Source == GetPropSet())
     {
-        sal_Int16 nLngSvcFlags = LinguServiceEventFlags::HYPHENATE_AGAIN;
-
         sal_Int16   *pnVal = nullptr;
         switch (rEvt.PropertyHandle)
         {
@@ -601,11 +599,8 @@ bool PropertyHelper_Hyphen::propertyChange_Impl( const PropertyChangeEvent& rEvt
         bRes = (pnVal != nullptr);
         if (bRes)
         {
-            if (nLngSvcFlags)
-            {
-                LinguServiceEvent aEvt( GetEvtObj(), nLngSvcFlags );
-                LaunchEvent( aEvt );
-            }
+            LinguServiceEvent aEvt(GetEvtObj(), LinguServiceEventFlags::HYPHENATE_AGAIN);
+            LaunchEvent(aEvt);
         }
     }
 
diff --git a/lotuswordpro/source/filter/lwptablelayout.cxx b/lotuswordpro/source/filter/lwptablelayout.cxx
index b88a23bcdf1b..b595dc152c6a 100644
--- a/lotuswordpro/source/filter/lwptablelayout.cxx
+++ b/lotuswordpro/source/filter/lwptablelayout.cxx
@@ -1204,54 +1204,52 @@ void LwpTableLayout::PostProcessParagraph(XFCell *pCell, sal_uInt16 nRowID, sal_
             return;
         XFColor aNullColor = XFColor();
 
-        if ( pXFPara)
+        OUString sNumfmt = pCellLayout->GetNumfmtName();
+        bool bColorMod = false;
+        XFNumberStyle* pNumStyle = nullptr;
+        XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+        if (!sNumfmt.isEmpty())
         {
-            OUString sNumfmt = pCellLayout->GetNumfmtName();
-            bool bColorMod = false;
-            XFNumberStyle* pNumStyle = nullptr;
-            XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
-            if (!sNumfmt.isEmpty())
-            {
-                pNumStyle = static_cast<XFNumberStyle*>(pXFStyleManager->FindStyle( sNumfmt));
-                XFColor aColor = pNumStyle->GetColor();
-                if ( aColor != aNullColor )
-                    bColorMod = true;//end
-            }
+            pNumStyle = static_cast<XFNumberStyle*>(pXFStyleManager->FindStyle(sNumfmt));
+            XFColor aColor = pNumStyle->GetColor();
+            if ( aColor != aNullColor )
+                bColorMod = true;//end
+        }
 
-            XFParaStyle * pStyle = pXFStyleManager->FindParaStyle(pXFPara->GetStyleName());
-            if ((pStyle && pStyle->GetNumberRight()) || bColorMod)
-            {
-                std::unique_ptr<XFParaStyle> xOverStyle(new XFParaStyle);
+        XFParaStyle * pStyle = pXFStyleManager->FindParaStyle(pXFPara->GetStyleName());
+        if ((pStyle && pStyle->GetNumberRight()) || bColorMod)
+        {
+            std::unique_ptr<XFParaStyle> xOverStyle(new XFParaStyle);
 
-                if (pStyle)
-                {
-                    *xOverStyle = *pStyle;
+            if (pStyle)
+            {
+                *xOverStyle = *pStyle;
 
-                    if (pStyle->GetNumberRight())
-                        xOverStyle->SetAlignType(enumXFAlignEnd);
-                }
+                if (pStyle->GetNumberRight())
+                    xOverStyle->SetAlignType(enumXFAlignEnd);
+            }
 
-                if (bColorMod)
+            if (bColorMod)
+            {
+                rtl::Reference<XFFont> xFont = xOverStyle->GetFont();
+                if (xFont.is())
                 {
-                    rtl::Reference<XFFont> xFont = xOverStyle->GetFont();
-                    if (xFont.is())
+                    XFColor aColor = xFont->GetColor();
+                    if (aColor == aNullColor)
                     {
-                        XFColor aColor = xFont->GetColor();
-                        if ( aColor == aNullColor )
-                        {
-                            rtl::Reference<XFFont> pNewFont(new XFFont);
-                            aColor = pNumStyle->GetColor();
-                            pNewFont->SetColor(aColor);
-                            xOverStyle->SetFont(pNewFont);
-                        }
+                        rtl::Reference<XFFont> pNewFont(new XFFont);
+                        aColor = pNumStyle->GetColor();
+                        pNewFont->SetColor(aColor);
+                        xOverStyle->SetFont(pNewFont);
                     }
                 }
+            }
 
-                xOverStyle->SetStyleName("");
-                OUString StyleName = pXFStyleManager->AddStyle(std::move(xOverStyle)).m_pStyle->GetStyleName();
+            xOverStyle->SetStyleName("");
+            OUString StyleName
+                = pXFStyleManager->AddStyle(std::move(xOverStyle)).m_pStyle->GetStyleName();
 
-                pXFPara->SetStyleName(StyleName);
-            }
+            pXFPara->SetStyleName(StyleName);
         }
     }
 }
diff --git a/sc/source/filter/lotus/lotform.cxx b/sc/source/filter/lotus/lotform.cxx
index f696c063e6d0..2c745ca9c398 100644
--- a/sc/source/filter/lotus/lotform.cxx
+++ b/sc/source/filter/lotus/lotform.cxx
@@ -219,8 +219,7 @@ void LotusToSc::DoFunc( DefTokenId eOc, sal_uInt8 nCnt, const sal_Char* pExtStri
 
             for( nLauf = nLast - 1 ; nLauf >= 0 ; nLauf-- )
             {
-                if( nLauf != -1 ) // lists the parameter to be excluded
-                    aPool << ocSep << eParam[ nLauf ];
+                aPool << ocSep << eParam[nLauf];
             }
         }
     }
diff --git a/sd/source/ui/sidebar/LayoutMenu.cxx b/sd/source/ui/sidebar/LayoutMenu.cxx
index 13c554acd919..e0da346e9d6a 100644
--- a/sd/source/ui/sidebar/LayoutMenu.cxx
+++ b/sd/source/ui/sidebar/LayoutMenu.cxx
@@ -383,9 +383,8 @@ void LayoutMenu::AssignLayoutToSelectedSlides (AutoLayout aLayout)
             case ViewShell::ST_IMPRESS:
             {
                 DrawViewShell* pDrawViewShell = static_cast<DrawViewShell*>(pMainViewShell);
-                if (pDrawViewShell != nullptr)
-                    if (pDrawViewShell->GetEditMode() == EditMode::MasterPage)
-                        bMasterPageMode = true;
+                if (pDrawViewShell->GetEditMode() == EditMode::MasterPage)
+                    bMasterPageMode = true;
                 break;
             }
             default:
diff --git a/stoc/source/corereflection/lrucache.hxx b/stoc/source/corereflection/lrucache.hxx
index e9a89bebd66f..b52a05fe1213 100644
--- a/stoc/source/corereflection/lrucache.hxx
+++ b/stoc/source/corereflection/lrucache.hxx
@@ -90,16 +90,13 @@ inline LRU_Cache< t_Key, t_Val, t_KeyHash >::LRU_Cache()
     , _pHead( nullptr )
     , _pTail( nullptr )
 {
-    if (_nCachedElements > 0)
+    _pBlock.reset(new CacheEntry[_nCachedElements]);
+    _pHead = _pBlock.get();
+    _pTail = _pBlock.get() + _nCachedElements - 1;
+    for (sal_Int32 nPos = _nCachedElements; nPos--;)
     {
-        _pBlock.reset(new CacheEntry[_nCachedElements]);
-        _pHead  = _pBlock.get();
-        _pTail  = _pBlock.get() + _nCachedElements -1;
-        for ( sal_Int32 nPos = _nCachedElements; nPos--; )
-        {
-            _pBlock[nPos].pPred = _pBlock.get() + nPos -1;
-            _pBlock[nPos].pSucc = _pBlock.get() + nPos +1;
-        }
+        _pBlock[nPos].pPred = _pBlock.get() + nPos - 1;
+        _pBlock[nPos].pSucc = _pBlock.get() + nPos + 1;
     }
 }
 
diff --git a/svx/source/sidebar/line/LinePropertyPanelBase.cxx b/svx/source/sidebar/line/LinePropertyPanelBase.cxx
index 10dad0365a1d..9b1b8152321f 100644
--- a/svx/source/sidebar/line/LinePropertyPanelBase.cxx
+++ b/svx/source/sidebar/line/LinePropertyPanelBase.cxx
@@ -792,7 +792,7 @@ void LinePropertyPanelBase::SelectLineStyle()
         return;
     }
 
-    const drawing::LineStyle eXLS(mpStyleItem ? mpStyleItem->GetValue() : drawing::LineStyle_NONE);
+    const drawing::LineStyle eXLS(mpStyleItem->GetValue());
     bool bSelected(false);
 
     switch(eXLS)
@@ -804,7 +804,7 @@ void LinePropertyPanelBase::SelectLineStyle()
             bSelected = true;
             break;
         default:
-            if(mpDashItem && mxLineStyleList.is())
+            if(mxLineStyleList.is())
             {
                 const XDash& rDash = mpDashItem->GetDashValue();
                 for(long a(0);!bSelected &&  a < mxLineStyleList->Count(); a++)
@@ -840,7 +840,7 @@ void LinePropertyPanelBase::SelectEndStyle(bool bStart)
             return;
         }
 
-        if (mpStartItem && mxLineEndList.is())
+        if (mxLineEndList.is())
         {
             const basegfx::B2DPolyPolygon& rItemPolygon = mpStartItem->GetLineStartValue();
             for(long a(0);!bSelected &&  a < mxLineEndList->Count(); a++)
@@ -869,7 +869,7 @@ void LinePropertyPanelBase::SelectEndStyle(bool bStart)
             return;
         }
 
-        if (mpEndItem && mxLineEndList.is())
+        if (mxLineEndList.is())
         {
             const basegfx::B2DPolyPolygon& rItemPolygon = mpEndItem->GetLineEndValue();
             for(long a(0);!bSelected &&  a < mxLineEndList->Count(); a++)


More information about the Libreoffice-commits mailing list