[Libreoffice-commits] core.git: sc/source

Caolán McNamara caolanm at redhat.com
Tue Jun 6 15:13:22 UTC 2017


 sc/source/ui/inc/viewfunc.hxx  |    6 +++---
 sc/source/ui/undo/undoblk3.cxx |    2 +-
 sc/source/ui/view/viewfunc.cxx |   12 +++++-------
 3 files changed, 9 insertions(+), 11 deletions(-)

New commits:
commit 44f4ebc0325623ed81a4021ed0d6939bd6c0c41f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jun 6 12:52:51 2017 +0100

    coverity#1412032 ApplyPatternLines always passed non-null 2nd arg
    
    Change-Id: Ibf1754682a0d586a377709b8dacee1260a1f2ee1
    Reviewed-on: https://gerrit.libreoffice.org/38445
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/source/ui/inc/viewfunc.hxx b/sc/source/ui/inc/viewfunc.hxx
index de5ff455069f..94c304de0b65 100644
--- a/sc/source/ui/inc/viewfunc.hxx
+++ b/sc/source/ui/inc/viewfunc.hxx
@@ -162,9 +162,9 @@ public:
     void            ApplyAttr( const SfxPoolItem& rAttrItem );
     void            ApplySelectionPattern( const ScPatternAttr& rAttr,
                                             bool bCursorOnly = false);
-    void            ApplyPatternLines( const ScPatternAttr& rAttr,
-                                        const SvxBoxItem* pNewOuter,
-                                        const SvxBoxInfoItem* pNewInner );
+    void            ApplyPatternLines(const ScPatternAttr& rAttr,
+                                      const SvxBoxItem& rNewOuter,
+                                      const SvxBoxInfoItem* pNewInner);
 
     void            ApplyUserItemSet( const SfxItemSet& rItemSet );
 
diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx
index c3057d7b4bcd..a39ceff96ceb 100644
--- a/sc/source/ui/undo/undoblk3.cxx
+++ b/sc/source/ui/undo/undoblk3.cxx
@@ -470,7 +470,7 @@ void ScUndoSelectionAttr::Repeat(SfxRepeatTarget& rTarget)
     {
         ScTabViewShell& rViewShell = *static_cast<ScTabViewTarget&>(rTarget).GetViewShell();
         if (pLineOuter)
-            rViewShell.ApplyPatternLines( *pApplyPattern, pLineOuter, pLineInner );
+            rViewShell.ApplyPatternLines(*pApplyPattern, *pLineOuter, pLineInner);
         else
             rViewShell.ApplySelectionPattern( *pApplyPattern );
     }
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index 96ac268c1f80..8e0b13226a15 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -957,7 +957,7 @@ void ScViewFunc::ApplyAttributes( const SfxItemSet* pDialogSet,
         bool bDefNewInner = IsStaticDefaultItem(&rNewInner);
 
         ApplyPatternLines( aNewAttrs,
-                           bDefNewOuter ? &rOldOuter : &rNewOuter,
+                           bDefNewOuter ? rOldOuter : rNewOuter,
                            bDefNewInner ? &rOldInner : &rNewInner );
     }
 
@@ -996,7 +996,7 @@ void ScViewFunc::ApplyAttr( const SfxPoolItem& rAttrItem )
 
 //  patterns and borders
 
-void ScViewFunc::ApplyPatternLines( const ScPatternAttr& rAttr, const SvxBoxItem* pNewOuter,
+void ScViewFunc::ApplyPatternLines( const ScPatternAttr& rAttr, const SvxBoxItem& rNewOuter,
                                     const SvxBoxInfoItem* pNewInner )
 {
     ScDocument* pDoc = GetViewData().GetDocument();
@@ -1006,9 +1006,7 @@ void ScViewFunc::ApplyPatternLines( const ScPatternAttr& rAttr, const SvxBoxItem
     if (!pDoc->IsUndoEnabled())
         bRecord = false;
 
-    bool bRemoveAdjCellBorder = false;
-    if( pNewOuter )
-        bRemoveAdjCellBorder = pNewOuter->IsRemoveAdjacentCellBorder();
+    bool bRemoveAdjCellBorder = rNewOuter.IsRemoveAdjacentCellBorder();
     ScRange aMarkRange, aMarkRangeWithEnvelope;
     aFuncMark.MarkToSimple();
     bool bMulti = aFuncMark.IsMultiMarked();
@@ -1058,13 +1056,13 @@ void ScViewFunc::ApplyPatternLines( const ScPatternAttr& rAttr, const SvxBoxItem
             pDocSh, aFuncMark,
             aMarkRange.aStart.Col(), aMarkRange.aStart.Row(), aMarkRange.aStart.Tab(),
             aMarkRange.aEnd.Col(), aMarkRange.aEnd.Row(), aMarkRange.aEnd.Tab(),
-            pUndoDoc, bCopyOnlyMarked, &rAttr, pNewOuter, pNewInner, &aMarkRangeWithEnvelope ) );
+            pUndoDoc, bCopyOnlyMarked, &rAttr, &rNewOuter, pNewInner, &aMarkRangeWithEnvelope ) );
     }
 
     sal_uInt16 nExt = SC_PF_TESTMERGE;
     pDocSh->UpdatePaintExt( nExt, aMarkRangeWithEnvelope ); // content before the change
 
-    pDoc->ApplySelectionFrame( aFuncMark, pNewOuter, pNewInner );
+    pDoc->ApplySelectionFrame(aFuncMark, &rNewOuter, pNewInner);
 
     pDocSh->UpdatePaintExt( nExt, aMarkRangeWithEnvelope ); // content after the change
 


More information about the Libreoffice-commits mailing list