[Libreoffice-commits] core.git: 6 commits - sc/source svtools/source svx/source sw/source

Caolán McNamara caolanm at redhat.com
Tue Nov 4 12:45:34 PST 2014


 sc/source/core/tool/autoform.cxx                        |    2 -
 svtools/source/toolpanel/tabbargeometry.cxx             |   12 +++++---
 svx/source/customshapes/EnhancedCustomShapeFontWork.cxx |   14 ++++++++--
 svx/source/svdraw/svddrgmt.cxx                          |    4 ++
 sw/source/core/crsr/crsrsh.cxx                          |    4 ++
 sw/source/uibase/config/uinums.cxx                      |   22 +++++++++++-----
 sw/source/uibase/docvw/edtwin.cxx                       |    2 -
 7 files changed, 44 insertions(+), 16 deletions(-)

New commits:
commit 0ce9c4f910afb2bf1ac0aec97ef49598493ac3a5
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Nov 4 13:13:24 2014 +0000

    Resolves: fdo#69049 Format in 'Outline Numbering' not saved anymore
    
    Change-Id: Ibd129d989a32eec2f63413d1ed09962ad3b38c68

diff --git a/sc/source/core/tool/autoform.cxx b/sc/source/core/tool/autoform.cxx
index 88f7b58..e9265b9 100644
--- a/sc/source/core/tool/autoform.cxx
+++ b/sc/source/core/tool/autoform.cxx
@@ -1070,7 +1070,7 @@ bool ScAutoFormat::Save()
     SvtPathOptions aPathOpt;
     aURL.SetSmartURL( aPathOpt.GetUserConfigPath() );
     aURL.setFinalSlash();
-    aURL.Append( OUString( sAutoTblFmtName ) );
+    aURL.Append(sAutoTblFmtName);
 
     SfxMedium aMedium( aURL.GetMainURL(INetURLObject::NO_DECODE), STREAM_WRITE );
     SvStream* pStream = aMedium.GetOutStream();
diff --git a/sw/source/uibase/config/uinums.cxx b/sw/source/uibase/config/uinums.cxx
index 107ce2a..0fe448d4 100644
--- a/sw/source/uibase/config/uinums.cxx
+++ b/sw/source/uibase/config/uinums.cxx
@@ -67,13 +67,23 @@ SwBaseNumRules::~SwBaseNumRules()
 {
     if( bModified )
     {
+        INetURLObject aURL;
         SvtPathOptions aPathOpt;
-        OUString sNm( aPathOpt.GetUserConfigPath() + "/" + sFileName );
-        INetURLObject aTempObj(sNm);
-        sNm = aTempObj.GetFull();
-        SfxMedium aStrm( sNm, STREAM_WRITE | STREAM_TRUNC |
-                                        STREAM_SHARE_DENYALL );
-        Store( *aStrm.GetOutStream() );
+        aURL.SetSmartURL( aPathOpt.GetUserConfigPath() );
+        aURL.setFinalSlash();
+        aURL.Append(sFileName);
+
+        SfxMedium aMedium( aURL.GetMainURL(INetURLObject::NO_DECODE), STREAM_WRITE );
+        SvStream* pStream = aMedium.GetOutStream();
+        bool bRet = (pStream && pStream->GetError() == 0);
+        if (bRet)
+        {
+            Store( *pStream );
+
+            pStream->Flush();
+
+            aMedium.Commit();
+        }
     }
 
     for( sal_uInt16 i = 0; i < nMaxRules; ++i )
commit c61b2066660fb0130f0b0f9f51b48e3799625b83
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Nov 4 10:00:20 2014 +0000

    coverity#735635 Division or modulo by float zero
    
    and
    
    coverity#735636 Division or modulo by float zero
    
    Change-Id: Ib9c93ea843f63d38bdb8b0e5107f48afc2bdec52

diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx
index 920df9f..3011caa 100644
--- a/svx/source/svdraw/svddrgmt.cxx
+++ b/svx/source/svdraw/svddrgmt.cxx
@@ -21,6 +21,7 @@
 #include <math.h>
 
 #include <tools/bigint.hxx>
+#include <o3tl/numeric.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/settings.hxx>
 #include "svx/xattr.hxx"
@@ -3851,6 +3852,9 @@ bool SdrDragCrop::EndSdrDrag(bool /*bCopy*/)
         basegfx::fround(aRangeNewNoShearNoRotate.getMaxY()));
 
     // continue with the old original stuff
+    if (!aOldRect.GetWidth() || !aOldRect.GetHeight())
+        throw o3tl::divide_by_zero();
+
     double fScaleX = ( aGraphicSize.Width() - rOldCrop.GetLeft() - rOldCrop.GetRight() ) / (double)aOldRect.GetWidth();
     double fScaleY = ( aGraphicSize.Height() - rOldCrop.GetTop() - rOldCrop.GetBottom() ) / (double)aOldRect.GetHeight();
 
commit f075a3ad08f7d5b53790076d1965818e57628afa
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Nov 4 09:56:28 2014 +0000

    coverity#735623 Division or modulo by float zero
    
    Change-Id: Ibd53687416a4e20af7ac4a1e02c54407892aa470

diff --git a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
index ae31f00..7332449 100644
--- a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
+++ b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
@@ -552,12 +552,20 @@ void CalcDistances( const Polygon& rPoly, std::vector< double >& rDistances )
 
 void InsertMissingOutlinePoints( const Polygon& /*rOutlinePoly*/, const std::vector< double >& rDistances, const Rectangle& rTextAreaBoundRect, Polygon& rPoly )
 {
-    sal_uInt16 i = 0;
+    sal_uInt16 nSize = rPoly.GetSize();
+    if (nSize == 0)
+        return;
+
+    long nTextWidth = rTextAreaBoundRect.GetWidth();
+
+    if (nTextWidth == 0)
+        throw o3tl::divide_by_zero();
+
     double fLastDistance = 0.0;
-    for ( i = 0; i < rPoly.GetSize(); i++ )
+    for (sal_uInt16 i = 0; i < nSize; ++i)
     {
         Point& rPoint = rPoly[ i ];
-        double fDistance = (double)( rPoint.X() - rTextAreaBoundRect.Left() ) / (double)rTextAreaBoundRect.GetWidth();
+        double fDistance = (double)( rPoint.X() - rTextAreaBoundRect.Left() ) / (double)nTextWidth;
         if ( i )
         {
             if ( fDistance > fLastDistance )
commit 69b5df30136b778e23eb31c66b81c5524eae903e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Nov 4 09:49:30 2014 +0000

    coverity#1213082 Dereference after null check
    
    Change-Id: Ifbc5de648c2dac23d8616d436a7a78bf1b2adb0d

diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index dc9fc32..adce220 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -2478,6 +2478,10 @@ void SwCrsrShell::_ParkPams( SwPaM* pDelRg, SwShellCrsr** ppDelRing )
     // search over the whole ring
     bool bGoNext;
     do {
+
+        if (!pTmp)
+            break;
+
         const SwPosition *pTmpStt = pTmp->Start(),
                         *pTmpEnd = pTmp->GetPoint() == pTmpStt ?
                                         pTmp->GetMark() : pTmp->GetPoint();
commit 7f21b5629379cdb8407c37e6fcb85b4cc04cb525
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Nov 4 09:47:09 2014 +0000

    coverity#982483 Dereference after null check
    
    Change-Id: I1241bd12f0e56796d8918e83c29f17ee4b595789

diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index d60fcfa..a090937 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -3942,7 +3942,7 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt)
                 const Point aOld = m_pAnchorMarker->GetPosForHitTest( *(rSh.GetOut()) );
                 Point aNew = rSh.FindAnchorPos( aDocPt );
                 SdrHdl* pHdl;
-                if( (0!=( pHdl = pSdrView->PickHandle( aOld ) )||
+                if( pSdrView && (0!=( pHdl = pSdrView->PickHandle( aOld ) )||
                     0 !=(pHdl = pSdrView->PickHandle( m_pAnchorMarker->GetHdlPos()) ) ) &&
                         ( pHdl->GetKind() == HDL_ANCHOR ||
                           pHdl->GetKind() == HDL_ANCHOR_TR ) )
commit 440fd8fa8c7ddcdffaa17028f37dc177701cbb1a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Nov 4 09:39:40 2014 +0000

    coverity#1242516 reorg to silence Arguments in wrong order
    
    Change-Id: I0d7a93461f37d5ca18605cd94b630d70d871adfb

diff --git a/svtools/source/toolpanel/tabbargeometry.cxx b/svtools/source/toolpanel/tabbargeometry.cxx
index 3390c70..da2c800 100644
--- a/svtools/source/toolpanel/tabbargeometry.cxx
+++ b/svtools/source/toolpanel/tabbargeometry.cxx
@@ -110,20 +110,22 @@ namespace svt
 
 
     //= NormalizedArea
-
-
     NormalizedArea::NormalizedArea()
         :m_aReference()
     {
     }
 
-
     NormalizedArea::NormalizedArea( const Rectangle& i_rReference, const bool i_bIsVertical )
-        :m_aReference( i_bIsVertical ? Rectangle( i_rReference.TopLeft(), Size( i_rReference.GetHeight(), i_rReference.GetWidth() ) ) : i_rReference )
+        : m_aReference(i_rReference)
     {
+        if (i_bIsVertical)
+        {
+            const long nRotatedWidth = i_rReference.GetHeight();
+            const long nRotatedHeight = i_rReference.GetWidth();
+            m_aReference = Rectangle(i_rReference.TopLeft(), Size(nRotatedWidth, nRotatedHeight));
+        }
     }
 
-
     Rectangle NormalizedArea::getTransformed( const Rectangle& i_rArea, const TabAlignment i_eTargetAlignment ) const
     {
         Rectangle aResult( i_rArea );


More information about the Libreoffice-commits mailing list