[Libreoffice-commits] core.git: 4 commits - include/vcl sc/source sfx2/source vcl/source

Caolán McNamara caolanm at redhat.com
Sat Feb 14 13:32:48 PST 2015


 include/vcl/floatwin.hxx            |    1 -
 include/vcl/syswin.hxx              |    2 +-
 sc/source/core/tool/chartlis.cxx    |    1 +
 sc/source/filter/starcalc/scflt.cxx |   16 +++++++---------
 sfx2/source/dialog/tabdlg.cxx       |    4 +++-
 vcl/source/window/floatwin.cxx      |   12 ------------
 vcl/source/window/syswin.cxx        |    4 ++--
 7 files changed, 14 insertions(+), 26 deletions(-)

New commits:
commit dcef874cebf37a05e4f125b18e7c85588dbd12cb
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Feb 14 20:16:58 2015 +0000

    silence coverity#1266479 Resource leak
    
    Change-Id: Ied44998b48817964f65fbe9f15e6d8cdf56f5e7a

diff --git a/sc/source/core/tool/chartlis.cxx b/sc/source/core/tool/chartlis.cxx
index 2bdb2b1..0b67d63 100644
--- a/sc/source/core/tool/chartlis.cxx
+++ b/sc/source/core/tool/chartlis.cxx
@@ -577,6 +577,7 @@ void ScChartListenerCollection::FreeUno( const uno::Reference< chart::XChartData
     }
 
     // Release all pointers currently managed by the ptr_map container.
+    // coverity[leaked_storage] - no leak, because because we will take care of them below
     maListeners.release().release();
 
     // Re-insert the listeners we need to keep.
commit 142df15e950cab713e061a3b46dae667a0010284
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Feb 14 20:13:19 2015 +0000

    coverity#1267643 Logically dead code
    
    Change-Id: Ib55dc6c32ec37fe022d268129de12567652c96ba

diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx
index 773ae34..2d5f88d 100644
--- a/sfx2/source/dialog/tabdlg.cxx
+++ b/sfx2/source/dialog/tabdlg.cxx
@@ -1103,9 +1103,11 @@ IMPL_LINK( SfxTabDialog, ActivatePageHdl, TabControl *, pTabCtrl )
         pDataObject = Find(pImpl->aData, nId);
     }
 
-    assert(pDataObject); //Id not known
     if (!pDataObject)
+    {
+        SAL_WARN("sfx.config", "Tab Page ID not known, this is pretty serious and needs investigation");
         return 0;
+    }
 
     // Create TabPage if possible:
     if ( !pTabPage )
commit f0ee8ed43528b17e9ea6d83388fbaab0a645b677
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Feb 13 16:54:13 2015 +0000

    see if we can merge floating window and dialog child size/pos setting
    
    Change-Id: Idda1a5fbfec7d10fab4fcef47ee0d10945510d50

diff --git a/include/vcl/floatwin.hxx b/include/vcl/floatwin.hxx
index d527145..d017b21 100644
--- a/include/vcl/floatwin.hxx
+++ b/include/vcl/floatwin.hxx
@@ -94,7 +94,6 @@ private:
 
     SAL_DLLPRIVATE void    ImplCallPopupModeEnd();
     DECL_DLLPRIVATE_LINK(  ImplEndPopupModeHdl, void* );
-    virtual void setPosSizeOnContainee(Size aSize, Window &rBox) SAL_OVERRIDE;
 
                            FloatingWindow (const FloatingWindow &) SAL_DELETED_FUNCTION;
                            FloatingWindow & operator= (const FloatingWindow &) SAL_DELETED_FUNCTION;
diff --git a/include/vcl/syswin.hxx b/include/vcl/syswin.hxx
index 2773fa6..1f29d45 100644
--- a/include/vcl/syswin.hxx
+++ b/include/vcl/syswin.hxx
@@ -158,7 +158,7 @@ public:
 private:
     SAL_DLLPRIVATE void Init();
     SAL_DLLPRIVATE void ImplMoveToScreen( long& io_rX, long& io_rY, long i_nWidth, long i_nHeight, vcl::Window* i_pConfigureWin );
-    virtual void setPosSizeOnContainee(Size aSize, Window &rBox);
+    SAL_DLLPRIVATE void setPosSizeOnContainee(Size aSize, Window &rBox);
     DECL_DLLPRIVATE_LINK( ImplHandleLayoutTimerHdl, void* );
 
 protected:
diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx
index e22ec5d..f7089c1 100644
--- a/vcl/source/window/floatwin.cxx
+++ b/vcl/source/window/floatwin.cxx
@@ -22,7 +22,6 @@
 #include <window.h>
 #include <salframe.hxx>
 
-#include <vcl/layout.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/wrkwin.hxx>
 #include <vcl/event.hxx>
@@ -808,15 +807,4 @@ void FloatingWindow::AddPopupModeWindow( vcl::Window* pWindow )
     mpFirstPopupModeWin = pWindow;
 }
 
-void FloatingWindow::setPosSizeOnContainee(Size aSize, Window &rBox)
-{
-    sal_Int32 nBorderWidth = get_border_width();
-
-    aSize.Width() -= mpWindowImpl->mnLeftBorder + mpWindowImpl->mnRightBorder + 2 * nBorderWidth;
-    aSize.Height() -= nBorderWidth + mpWindowImpl->mnTopBorder + mpWindowImpl->mnBottomBorder + 2 * nBorderWidth;
-
-    Point aPos(nBorderWidth, nBorderWidth);
-    VclContainer::setLayoutAllocation(rBox, aPos, aSize);
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx
index 5eca7c9..6b79906 100644
--- a/vcl/source/window/syswin.cxx
+++ b/vcl/source/window/syswin.cxx
@@ -1032,8 +1032,8 @@ void SystemWindow::setPosSizeOnContainee(Size aSize, Window &rBox)
 {
     sal_Int32 nBorderWidth = get_border_width();
 
-    aSize.Width() -= 2 * nBorderWidth;
-    aSize.Height() -= 2 * nBorderWidth;
+    aSize.Width() -= mpWindowImpl->mnLeftBorder + mpWindowImpl->mnRightBorder + 2 * nBorderWidth;
+    aSize.Height() -= nBorderWidth + mpWindowImpl->mnTopBorder + mpWindowImpl->mnBottomBorder + 2 * nBorderWidth;
 
     Point aPos(nBorderWidth, nBorderWidth);
     VclContainer::setLayoutAllocation(rBox, aPos, aSize);
commit a541aab2e7fdedcc84fff213069d7e521ff827a4
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Feb 14 20:09:04 2015 +0000

    coverity#1242895 Untrusted loop bound
    
    Change-Id: Iacd1fd5dcd91f09e142d46bd6f397375d3fd4906

diff --git a/sc/source/filter/starcalc/scflt.cxx b/sc/source/filter/starcalc/scflt.cxx
index 8c29094..791ec6a 100644
--- a/sc/source/filter/starcalc/scflt.cxx
+++ b/sc/source/filter/starcalc/scflt.cxx
@@ -1357,8 +1357,10 @@ void Sc10Import::LoadDataBaseCollection()
 
 namespace
 {
-    sal_uInt16 SanitizeDataCount(sal_uInt16 nDataCount, SvStream &rStream)
+    sal_uInt16 ReadAndSanitizeDataCount(SvStream &rStream)
     {
+        sal_uInt16 nDataCount(0);
+        rStream.ReadUInt16(nDataCount);
         const size_t nMinRecordSize = sizeof(sal_uInt16)*2;
         const size_t nMaxRecords = rStream.remainingSize() / nMinRecordSize;
         if (nDataCount > nMaxRecords)
@@ -1471,8 +1473,7 @@ void Sc10Import::LoadTables()
             nError = errUnknownID;
             return;
         }
-        rStream.ReadUInt16( DataCount );
-        DataCount = SanitizeDataCount(DataCount, rStream);
+        DataCount = ReadAndSanitizeDataCount(rStream);
         DataStart = 0;
         for (i=0; i < DataCount; i++)
         {
@@ -1494,8 +1495,7 @@ void Sc10Import::LoadTables()
             return;
         }
 
-        rStream.ReadUInt16( DataCount );
-        DataCount = SanitizeDataCount(DataCount, rStream);
+        DataCount = ReadAndSanitizeDataCount(rStream);
         DataStart = 0;
         for (i=0; i < DataCount; i++)
         {
@@ -1525,8 +1525,7 @@ void Sc10Import::LoadTables()
             return;
         }
 
-        rStream.ReadUInt16( DataCount );
-        DataCount = SanitizeDataCount(DataCount, rStream);
+        DataCount = ReadAndSanitizeDataCount(rStream);
         DataStart = 0;
         for (i=0; i < DataCount; i++)
         {
@@ -1546,8 +1545,7 @@ void Sc10Import::LoadTables()
             return;
         }
 
-        rStream.ReadUInt16(DataCount);
-        DataCount = SanitizeDataCount(DataCount, rStream);
+        DataCount = ReadAndSanitizeDataCount(rStream);
         DataStart = 0;
         for (i=0; i < DataCount; i++)
         {


More information about the Libreoffice-commits mailing list