[Libreoffice-commits] core.git: 2 commits - lotuswordpro/source reportdesign/source sc/source sd/source sfx2/source svx/source sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Feb 11 06:09:14 UTC 2019


 lotuswordpro/source/filter/xfilter/xfborders.cxx         |    2 -
 reportdesign/source/ui/report/ViewsWindow.cxx            |    4 +-
 sc/source/filter/excel/xiname.cxx                        |    2 -
 sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx   |    9 ++---
 sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx   |   12 +++----
 sd/source/ui/view/ViewShellImplementation.cxx            |    2 -
 sfx2/source/appl/workwin.cxx                             |    3 +
 svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx |    2 -
 sw/source/core/view/viewsh.cxx                           |    2 -
 sw/source/filter/html/wrthtml.cxx                        |    3 -
 sw/source/filter/ww8/wrtw8esh.cxx                        |    5 +--
 sw/source/filter/ww8/wrtw8nds.cxx                        |    9 ++---
 sw/source/filter/ww8/ww8graf.cxx                         |    3 -
 sw/source/filter/ww8/ww8par.cxx                          |    6 +--
 sw/source/filter/ww8/ww8par3.cxx                         |   23 +++------------
 sw/source/filter/ww8/ww8par6.cxx                         |    6 ---
 16 files changed, 36 insertions(+), 57 deletions(-)

New commits:
commit 2ded5f80b43f91fc1bcd8fbc17bafb0758de3f70
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Fri Feb 8 17:51:27 2019 +0300
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Mon Feb 11 07:09:02 2019 +0100

    tdf#120703 PVS: Check object type before static_cast
    
    V560 A part of conditional expression is always false:
         !pPrevActContent.
    
    Change-Id: Ief1b560ea8a4e1d85a693909b6a6a80566fa2f34
    Reviewed-on: https://gerrit.libreoffice.org/67547
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx
index d110d9290b81..35babb1de541 100644
--- a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx
+++ b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx
@@ -577,17 +577,15 @@ void ScXMLChangeTrackingImportHelper::SetMovementDependencies(ScMyMoveAction* pA
 
 void ScXMLChangeTrackingImportHelper::SetContentDependencies(const ScMyContentAction* pAction, ScChangeActionContent* pActContent)
 {
-    if (!pAction->nPreviousAction)
+    if (!pActContent || !pAction->nPreviousAction)
         return;
 
     OSL_ENSURE(pAction->nActionType == SC_CAT_CONTENT, "wrong action type");
     ScChangeAction* pPrevAct = pTrack->GetAction(pAction->nPreviousAction);
-    if (!pPrevAct)
+    if (!pPrevAct || pPrevAct->GetType() != SC_CAT_CONTENT)
         return;
 
     ScChangeActionContent* pPrevActContent = static_cast<ScChangeActionContent*>(pPrevAct);
-    if (!pPrevActContent || !pActContent)
-        return;
 
     pActContent->SetPrevContent(pPrevActContent);
     pPrevActContent->SetNextContent(pActContent);
commit 30c0134cd31c1409c374b9b0b38d2f2ac2f4bd03
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Fri Feb 8 17:41:36 2019 +0300
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Mon Feb 11 07:08:50 2019 +0100

    tdf#120703 PVS: V560 A part of conditional expression is always true/false
    
    Change-Id: I4449fead67459bdcbdc0e9320129e7a5b36aecd9
    Reviewed-on: https://gerrit.libreoffice.org/67545
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/lotuswordpro/source/filter/xfilter/xfborders.cxx b/lotuswordpro/source/filter/xfilter/xfborders.cxx
index e1a5554fdd8a..3be2c4e43455 100644
--- a/lotuswordpro/source/filter/xfilter/xfborders.cxx
+++ b/lotuswordpro/source/filter/xfilter/xfborders.cxx
@@ -80,7 +80,7 @@ void    XFBorder::SetWidth(double width)
         m_fWidthInner = width;
         m_bSameWidth = true;
     }
-    else if( m_bDouble && m_bSameWidth )
+    else if (m_bSameWidth)
     {
         m_fWidthInner = width;
         m_fWidthOuter = width;
diff --git a/reportdesign/source/ui/report/ViewsWindow.cxx b/reportdesign/source/ui/report/ViewsWindow.cxx
index 6e9c2e21a027..77fed84faa28 100644
--- a/reportdesign/source/ui/report/ViewsWindow.cxx
+++ b/reportdesign/source/ui/report/ViewsWindow.cxx
@@ -1581,10 +1581,10 @@ void OViewsWindow::handleKey(const vcl::KeyCode& _rCode)
                     }
                 }
             }
-            else
+            else // pHdl != nullptr
             {
                 // move the handle
-                if ( pHdl && ( nX || nY ) )
+                if (nX || nY)
                 {
                     const Point aStartPoint( pHdl->GetPos() );
                     const Point aEndPoint( pHdl->GetPos() + Point( nX, nY ) );
diff --git a/sc/source/filter/excel/xiname.cxx b/sc/source/filter/excel/xiname.cxx
index 4f168cf8fd95..67a0c193b315 100644
--- a/sc/source/filter/excel/xiname.cxx
+++ b/sc/source/filter/excel/xiname.cxx
@@ -175,7 +175,7 @@ XclImpName::XclImpName( XclImpStream& rStrm, sal_uInt16 nXclNameIdx ) :
         rFmlaConv.Convert( pTokArr, rStrm, nFmlaSize, false, FT_RangeName );
 
         // --- auto or advanced filter ---
-        if( (GetBiff() == EXC_BIFF8) && pTokArr && bBuiltIn )
+        if ((GetBiff() == EXC_BIFF8) && pTokArr)
         {
             ScRange aRange;
             if (pTokArr->IsReference(aRange, ScAddress()))
diff --git a/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx b/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx
index 9c21a593b627..51e45769ce4c 100644
--- a/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx
+++ b/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx
@@ -514,12 +514,11 @@ void ScChangeTrackingExportHelper::AddDeletionAttributes(const ScChangeActionDel
         if (pDelAction->IsMultiDelete() && !pDelAction->GetDx() && !pDelAction->GetDy())
         {
             const ScChangeAction* p = pDelAction->GetNext();
-            bool bAll(false);
             sal_Int32 nSlavesCount (1);
-            while (!bAll && p)
+            while (p)
             {
-                if ( !p || p->GetType() != pDelAction->GetType() )
-                    bAll = true;
+                if (p->GetType() != pDelAction->GetType())
+                    break;
                 else
                 {
                     const ScChangeActionDel* pDel = static_cast<const ScChangeActionDel*>(p);
@@ -530,7 +529,7 @@ void ScChangeTrackingExportHelper::AddDeletionAttributes(const ScChangeActionDel
                         p = p->GetNext();
                     }
                     else
-                        bAll = true;
+                        break;
                 }
             }
 
diff --git a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx
index 18ce8946e53c..d110d9290b81 100644
--- a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx
+++ b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx
@@ -524,7 +524,7 @@ void ScXMLChangeTrackingImportHelper::SetDeletionDependencies(ScMyDelAction* pAc
         if (pChangeAction && pChangeAction->IsInsertType())
         {
             ScChangeActionIns* pInsAction = static_cast<ScChangeActionIns*>(pChangeAction);
-            if (pInsAction && pDelAct)
+            if (pDelAct)
                 pDelAct->SetCutOffInsert(pInsAction, static_cast<sal_Int16>(pAction->pInsCutOff->nPosition));
         }
         else
@@ -543,7 +543,7 @@ void ScXMLChangeTrackingImportHelper::SetDeletionDependencies(ScMyDelAction* pAc
             if (pChangeAction && (pChangeAction->GetType() == SC_CAT_MOVE))
             {
                 ScChangeActionMove* pMoveAction = static_cast<ScChangeActionMove*>(pChangeAction);
-                if (pMoveAction && pDelAct)
+                if (pDelAct)
                     pDelAct->AddCutOffMove(pMoveAction, static_cast<sal_Int16>(rCutOff.nStartPosition),
                                         static_cast<sal_Int16>(rCutOff.nEndPosition));
             }
@@ -620,7 +620,7 @@ void ScXMLChangeTrackingImportHelper::SetDependencies(ScMyBaseAction* pAction)
                 if ((pDeletedAct->GetType() == SC_CAT_CONTENT) && rDeleted.pCellInfo)
                 {
                     ScChangeActionContent* pContentAct = static_cast<ScChangeActionContent*>(pDeletedAct);
-                    if (pContentAct && rDeleted.pCellInfo)
+                    if (rDeleted.pCellInfo)
                     {
                         const ScCellValue& rCell = rDeleted.pCellInfo->CreateCell(pDoc);
                         if (!rCell.equalsWithoutFormat(pContentAct->GetNewCell()))
diff --git a/sd/source/ui/view/ViewShellImplementation.cxx b/sd/source/ui/view/ViewShellImplementation.cxx
index 3f76080e9293..08fe5dbc8505 100644
--- a/sd/source/ui/view/ViewShellImplementation.cxx
+++ b/sd/source/ui/view/ViewShellImplementation.cxx
@@ -211,7 +211,7 @@ void ViewShell::Implementation::ProcessModifyPageSlot (
 
             bool bSetModified = true;
 
-            if (pArgs && pArgs->Count() == 1)
+            if (pArgs->Count() == 1)
             {
                 bSetModified = static_cast<const SfxBoolItem&>(pArgs->Get(SID_MODIFYPAGE)).GetValue();
             }
diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx
index d27a04d1a27a..a349a8084984 100644
--- a/sfx2/source/appl/workwin.cxx
+++ b/sfx2/source/appl/workwin.cxx
@@ -1291,7 +1291,8 @@ void SfxWorkWindow::UpdateChildWindows_Impl()
                     if ( pCW->pCli )
                     {
                         // The window is a direct Child
-                        if ( bAllChildrenVisible && ( (IsDockingAllowed() && bInternalDockingAllowed) || pCW->pCli->eAlign == SfxChildAlignment::NOALIGNMENT ) )
+                        if ((IsDockingAllowed() && bInternalDockingAllowed)
+                            || pCW->pCli->eAlign == SfxChildAlignment::NOALIGNMENT)
                             pCW->pCli->nVisible |= SfxChildVisibility::NOT_HIDDEN;
                     }
                     else
diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx b/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx
index a7af478edc10..573f0f585ffb 100644
--- a/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx
@@ -56,7 +56,7 @@ drawinglayer::primitive2d::Primitive2DContainer ViewObjectContactOfSdrOle2Obj::c
     const bool bIsInplaceActive((nState == embed::EmbedStates::INPLACE_ACTIVE) || (nState == embed::EmbedStates::UI_ACTIVE));
     bool bDone(false);
 
-    if(!bDone && bIsInplaceActive)
+    if (bIsInplaceActive)
     {
         if( !GetObjectContact().isOutputToPrinter() && !GetObjectContact().isOutputToRecordingMetaFile() )
         {
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index bab2ea90b4f3..006b33927a41 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -407,7 +407,7 @@ void SwViewShell::ImplEndAction( const bool bIdleEnd )
                     }
                     if ( bPaint )
                     {
-                        if (GetWin() && GetWin()->SupportsDoubleBuffering())
+                        if (GetWin()->SupportsDoubleBuffering())
                             InvalidateWindows(aRect.SVRect());
                         else
                         {
diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx
index 816c53726e3b..1e3afd632211 100644
--- a/sw/source/filter/html/wrthtml.cxx
+++ b/sw/source/filter/html/wrthtml.cxx
@@ -227,8 +227,7 @@ ErrCode SwHTMLWriter::WriteStream()
     if (pPasteEnv)
     {
         OUString aPasteStr;
-        if (pPasteEnv
-            && osl::FileBase::getFileURLFromSystemPath(OUString::fromUtf8(pPasteEnv), aPasteStr)
+        if (osl::FileBase::getFileURLFromSystemPath(OUString::fromUtf8(pPasteEnv), aPasteStr)
                    == osl::FileBase::E_None)
         {
             pPasteStream.reset(new SvFileStream(aPasteStr, StreamMode::WRITE));
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index b737fa123792..075849739ef3 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -2426,9 +2426,8 @@ bool WinwordAnchoring::ConvertPosition( SwFormatHoriOrient& _iorHoriOri,
     {
         SwTextNode& rAnchorTextNode =
             dynamic_cast<SwTextNode&>(_rFrameFormat.GetAnchor().GetContentAnchor()->nNode.GetNode());
-        const SvxFormatBreakItem* pBreak = &(ItemGet<SvxFormatBreakItem>(rAnchorTextNode, RES_BREAK));
-        if ( pBreak &&
-             pBreak->GetBreak() == SvxBreak::ColumnBefore )
+        const SvxFormatBreakItem& rBreak = ItemGet<SvxFormatBreakItem>(rAnchorTextNode, RES_BREAK);
+        if (rBreak.GetBreak() == SvxBreak::ColumnBefore)
         {
             bConvDueToAnchoredAtColBreakPara = true;
         }
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 2565e216e27b..0cf9e5a15f56 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -2826,16 +2826,15 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode )
             if ( !rNode.GetpSwAttrSet() ||
                  SfxItemState::SET != rNode.GetpSwAttrSet()->GetItemState(RES_BREAK, false) )
             {
-                const SvxFormatBreakItem* pBreakAtParaStyle =
-                    &(ItemGet<SvxFormatBreakItem>(rNode.GetSwAttrSet(), RES_BREAK));
-                if ( pBreakAtParaStyle &&
-                     pBreakAtParaStyle->GetBreak() == SvxBreak::PageAfter )
+                const SvxFormatBreakItem& rBreakAtParaStyle
+                    = ItemGet<SvxFormatBreakItem>(rNode.GetSwAttrSet(), RES_BREAK);
+                if (rBreakAtParaStyle.GetBreak() == SvxBreak::PageAfter)
                 {
                     if ( !pTmpSet )
                     {
                         pTmpSet = new SfxItemSet(rNode.GetSwAttrSet());
                     }
-                    pTmpSet->Put( *pBreakAtParaStyle );
+                    pTmpSet->Put(rBreakAtParaStyle);
                 }
                 else if( pTmpSet )
                 {   // Even a pagedesc item is set, the break item can be set 'NONE',
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index a0f0769c922b..87e2a54f0e5f 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -639,8 +639,7 @@ void SwWW8ImplReader::InsertAttrsAsDrawingAttrs(WW8_CP nStartCp, WW8_CP nEndCp,
                     break;
                 }
             }
-            else if ( aRes.nSprmId && (
-                (eFTN >  aRes.nSprmId) || (0x0800 <= aRes.nSprmId) ) )
+            else if ((eFTN > aRes.nSprmId) || (0x0800 <= aRes.nSprmId))
             {
                 // Here place them onto our usual stack and we will pop them
                 // off and convert them later
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index f5591d64d1e4..eb685c83edd0 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -2355,7 +2355,7 @@ void SwWW8ImplReader::Read_HdFt(int nSect, const SwPageDesc *pPrev,
                     else
                         Read_HdFtText(nStart, nLen, pHdFtFormat);
                 }
-                else if (!bOk && pPrev)
+                else if (pPrev)
                     CopyPageDescHdFt(pPrev, pPD, nI);
 
                 m_bIsHeader = m_bIsFooter = false;
@@ -5165,7 +5165,7 @@ ErrCode SwWW8ImplReader::CoreLoad(WW8Glossary const *pGloss)
     }
     else // ordinary case
     {
-        if (m_bNewDoc && m_pStg && !pGloss) /*meaningless for a glossary */
+        if (m_bNewDoc && m_pStg) /*meaningless for a glossary */
         {
             m_pDocShell->SetIsTemplate( m_xWwFib->m_fDot ); // point at tgc record
             uno::Reference<document::XDocumentPropertiesSupplier> const
@@ -6434,7 +6434,7 @@ bool SwMSDffManager::GetOLEStorageName(sal_uInt32 nOLEId, OUString& rStorageName
                             if( nLen < nSL )
                                 break; // Not enough Bytes left
 
-                            if( 0x6A03 == nId && 0 < nLen )
+                            if (0x6A03 == nId)
                             {
                                 nPictureId = SVBT32ToUInt32(pSprm +
                                     aSprmParser.DistanceToData(nId));
diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index 38a349fb5dc2..544f3785ddae 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -1742,18 +1742,11 @@ void SwWW8ImplReader::SetStylesList(sal_uInt16 nStyle, sal_uInt16 nCurrentLFO,
                 rStyleInf.m_nLFOIndex  = nCurrentLFO;
                 rStyleInf.m_nListLevel = nCurrentLevel;
 
-                if (
-                    (USHRT_MAX > nCurrentLFO) &&
-                    (WW8ListManager::nMaxLevel > nCurrentLevel)
-                   )
-                {
-                    std::vector<sal_uInt8> aParaSprms;
-                    SwNumRule *pNmRule =
-                        m_xLstManager->GetNumRuleForActivation(nCurrentLFO,
-                            nCurrentLevel, aParaSprms);
-                    if (pNmRule)
-                        UseListIndent(rStyleInf, pNmRule->Get(nCurrentLevel));
-                }
+                std::vector<sal_uInt8> aParaSprms;
+                SwNumRule* pNmRule = m_xLstManager->GetNumRuleForActivation(
+                    nCurrentLFO, nCurrentLevel, aParaSprms);
+                if (pNmRule)
+                    UseListIndent(rStyleInf, pNmRule->Get(nCurrentLevel));
             }
         }
     }
@@ -1942,11 +1935,7 @@ void SwWW8ImplReader::Read_ListLevel(sal_uInt16, const sal_uInt8* pData,
 
         if (WW8ListManager::nMaxLevel <= m_nListLevel )
             m_nListLevel = WW8ListManager::nMaxLevel;
-        else if
-           (
-             (USHRT_MAX > m_nLFOPosition) &&
-             (WW8ListManager::nMaxLevel > m_nListLevel)
-           )
+        else if (USHRT_MAX > m_nLFOPosition)
         {
             RegisterNumFormat(m_nLFOPosition, m_nListLevel);
             m_nLFOPosition = USHRT_MAX;
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index 1f2487dfa51b..deae6c38a6e2 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -787,10 +787,7 @@ void SwWW8ImplReader::HandleLineNumbering(const wwSection &rSection)
             m_bNoLnNumYet = false;
         }
 
-        if (
-            (0 < rSection.maSep.lnnMin) ||
-            (bRestartLnNumPerSection && !m_bNoLnNumYet)
-           )
+        if ((0 < rSection.maSep.lnnMin) || bRestartLnNumPerSection)
         {
             SwFormatLineNumber aLN;
             if (const SwFormatLineNumber* pLN
@@ -802,7 +799,6 @@ void SwWW8ImplReader::HandleLineNumbering(const wwSection &rSection)
             NewAttr(aLN);
             m_xCtrlStck->SetAttr(*m_pPaM->GetPoint(), RES_LINENUMBER);
         }
-        m_bNoLnNumYet = false;
     }
 }
 


More information about the Libreoffice-commits mailing list