[Libreoffice-commits] core.git: 5 commits - oox/source sw/source vcl/source

Caolán McNamara caolanm at redhat.com
Sun Jul 23 21:05:41 UTC 2017


 oox/source/drawingml/diagram/diagramlayoutatoms.cxx |    4 +++-
 sw/source/core/docnode/ndtbl.cxx                    |    2 +-
 sw/source/core/inc/UndoTable.hxx                    |    2 +-
 sw/source/core/layout/sectfrm.cxx                   |    5 ++---
 sw/source/core/undo/untbl.cxx                       |    8 ++++----
 vcl/source/gdi/bitmap3.cxx                          |    2 ++
 6 files changed, 13 insertions(+), 10 deletions(-)

New commits:
commit e0e50eff21545cbfdd594f5b4474aba2f5b0405e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Jul 23 21:52:50 2017 +0100

    coverity#1415514 Dereference after null check
    
    Change-Id: If51d0a4540f63f87b5ba2aece10ed73e416ae783

diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx
index cd0d3002cddc..eb2af5feec80 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -1744,7 +1744,7 @@ SwLayoutFrame *SwFrame::GetPrevSctLeaf()
     // have applied, also when the section has a pPrev.
     // Now we even consider an empty column...
     OSL_ENSURE( pSect, "GetNextSctLeaf: Missing SectionFrame" );
-    if( ( IsInTab() && !IsTabFrame() ) || FindFooterOrHeader() )
+    if (!pSect || (IsInTab() && !IsTabFrame()) || FindFooterOrHeader())
         return pCol;
 
     // === IMPORTANT ===
commit f54ca31d2900e6592ffc22888d0f2475a75630dc
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Jul 23 21:50:24 2017 +0100

    make this more readable
    
    Change-Id: I617e7a120aa14794c7391969b3edd6e3c4f50077

diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx
index 23b547f64ec1..cd0d3002cddc 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -1763,8 +1763,7 @@ SwLayoutFrame *SwFrame::GetPrevSctLeaf()
     }
 
     {
-        SwFrame *pPrv;
-        if( nullptr != ( pPrv = pSect->GetIndPrev() ) )
+        if (SwFrame *pPrv = pSect->GetIndPrev())
         {
             // Mooching, half dead SectionFrames shouldn't confuse us
             while( pPrv && pPrv->IsSctFrame() && !static_cast<SwSectionFrame*>(pPrv)->GetSection() )
commit 13f80252de289b666b5df126e1ec8a9c99445bac
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Jul 23 21:47:02 2017 +0100

    pQLine2 will be non-zero in any case that nHeight is non-zero
    
    Change-Id: I5c836552df2122049dc88ca724444b29ae2c74e9

diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx
index db9943048e13..95525fe61cff 100644
--- a/vcl/source/gdi/bitmap3.cxx
+++ b/vcl/source/gdi/bitmap3.cxx
@@ -627,6 +627,8 @@ bool Bitmap::ImplConvertDown(sal_uInt16 nBitCount, Color const * pExtColor)
                 }
             }
 
+            assert(pQLine2 || nHeight == 0);
+
             for (long nY = 0; nY < nHeight; nY++, nYTmp++)
             {
                 // first pixel in the line
commit bc2552fa3197617ec909e90996076ea45a27ce5c
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Jul 23 21:39:38 2017 +0100

    coverity#1415611 Result is not floating-point
    
    Change-Id: Icaeeb835e9a3c8ab6917fe15297ad884db792299

diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
index 80f99673243b..d1c172862541 100644
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
@@ -261,7 +261,9 @@ void AlgAtom::layoutShape( const ShapePtr& rShape,
             for ( ; nCol<nCount; nCol++)
             {
                 nRow = (nCount+nCol-1) / nCol;
-                if ((rShape->getSize().Height / nRow) / (rShape->getSize().Width / nCol) >= fAspectRatio)
+                const double fShapeHeight = rShape->getSize().Height;
+                const double fShapeWidth = rShape->getSize().Width;
+                if ((fShapeHeight / nRow) / (fShapeWidth / nCol) >= fAspectRatio)
                     break;
             }
             SAL_INFO("oox.drawingml", "Snake layout grid: " << nCol << "x" << nRow);
commit dbe73c8df874d0970e3d05159c796dfe67b81e8e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Jul 23 21:34:36 2017 +0100

    coverity#1415615 avoid Dereference null return value warning
    
    Change-Id: I248dcafbb2cfdd7a8dd9270ef56bcccc1b9b0ee5

diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 2ad58d1081be..e65d24c2692b 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -4705,7 +4705,7 @@ void SwDoc::ChgTableStyle(const OUString& rName, const SwTableAutoFormat& rNewFo
 
         if (GetIDocumentUndoRedo().DoesUndo())
         {
-            SwUndo * pUndo = new SwUndoTableStyleUpdate(rName, aOldFormat, this);
+            SwUndo * pUndo = new SwUndoTableStyleUpdate(*pFormat, aOldFormat, this);
 
             GetIDocumentUndoRedo().AppendUndo(pUndo);
         }
diff --git a/sw/source/core/inc/UndoTable.hxx b/sw/source/core/inc/UndoTable.hxx
index a83434660497..2cd09342f408 100644
--- a/sw/source/core/inc/UndoTable.hxx
+++ b/sw/source/core/inc/UndoTable.hxx
@@ -419,7 +419,7 @@ class SwUndoTableStyleUpdate : public SwUndo
 {
     std::unique_ptr<SwTableAutoFormat> m_pOldFormat, m_pNewFormat;
 public:
-    SwUndoTableStyleUpdate(const OUString& rName, const SwTableAutoFormat& rOldFormat, const SwDoc* pDoc);
+    SwUndoTableStyleUpdate(const SwTableAutoFormat& rNewFormat, const SwTableAutoFormat& rOldFormat, const SwDoc* pDoc);
 
     virtual ~SwUndoTableStyleUpdate() override;
 
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index 7c16abe9b9b3..3da877ae390a 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -3215,10 +3215,10 @@ SwRewriter SwUndoTableStyleDelete::GetRewriter() const
     return aResult;
 }
 
-SwUndoTableStyleUpdate::SwUndoTableStyleUpdate(const OUString& rName, const SwTableAutoFormat& rOldFormat, const SwDoc* pDoc)
-    : SwUndo(SwUndoId::TBLSTYLE_UPDATE, pDoc),
-    m_pOldFormat(new SwTableAutoFormat(rOldFormat)),
-    m_pNewFormat(new SwTableAutoFormat(*pDoc->GetTableStyles().FindAutoFormat(rName)))
+SwUndoTableStyleUpdate::SwUndoTableStyleUpdate(const SwTableAutoFormat& rNewFormat, const SwTableAutoFormat& rOldFormat, const SwDoc* pDoc)
+    : SwUndo(SwUndoId::TBLSTYLE_UPDATE, pDoc)
+    , m_pOldFormat(new SwTableAutoFormat(rOldFormat))
+    , m_pNewFormat(new SwTableAutoFormat(rNewFormat))
 { }
 
 SwUndoTableStyleUpdate::~SwUndoTableStyleUpdate()


More information about the Libreoffice-commits mailing list