[Libreoffice-commits] .: sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Nov 13 05:57:45 PST 2012


 sc/source/ui/docshell/docfunc.cxx |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

New commits:
commit c5aa953e005709c113f6ac11b9028e0a551a84eb
Author: jailletc36 <christophe.jaillet at wanadoo.fr>
Date:   Sat Nov 10 11:25:34 2012 +0100

    bcppCheck: redundant assignment and Possible null pointer dereference.
    
    I also turned a memmove into a memcpy. The 2 memory areas can not overlap.
    
    Change-Id: Id4f984f9eb5dea1ba59631281d6967d259948e5b
    Reviewed-on: https://gerrit.libreoffice.org/1015
    Tested-by: Eike Rathke <erack at redhat.com>
    Reviewed-by: Eike Rathke <erack at redhat.com>

diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 2c53a44..fff492f 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -3094,8 +3094,6 @@ bool ScDocFunc::SetTabBgColor(
 
 static sal_uInt16 lcl_GetOptimalColWidth( ScDocShell& rDocShell, SCCOL nCol, SCTAB nTab, sal_Bool bFormula )
 {
-    sal_uInt16 nTwips = 0;
-
     ScSizeDeviceProvider aProv(&rDocShell);
     OutputDevice* pDev = aProv.GetDevice();         // has pixel MapMode
     double nPPTX = aProv.GetPPTX();
@@ -3103,8 +3101,8 @@ static sal_uInt16 lcl_GetOptimalColWidth( ScDocShell& rDocShell, SCCOL nCol, SCT
 
     ScDocument* pDoc = rDocShell.GetDocument();
     Fraction aOne(1,1);
-    nTwips = pDoc->GetOptimalColWidth( nCol, nTab, pDev, nPPTX, nPPTY, aOne, aOne,
-                                        bFormula, NULL );
+    sal_uInt16 nTwips = pDoc->GetOptimalColWidth( nCol, nTab, pDev, nPPTX, nPPTY, aOne, aOne,
+                                                    bFormula, NULL );
 
     return nTwips;
 }
@@ -3161,7 +3159,7 @@ sal_Bool ScDocFunc::SetWidthOrHeight( sal_Bool bWidth, SCCOLROW nRangeCnt, SCCOL
         }
 
         pUndoRanges = new SCCOLROW[ 2*nRangeCnt ];
-        memmove( pUndoRanges, pRanges, 2*nRangeCnt*sizeof(SCCOLROW) );
+        memcpy( pUndoRanges, pRanges, 2*nRangeCnt*sizeof(SCCOLROW) );
 
         ScOutlineTable* pTable = pDoc->GetOutlineTable( nTab );
         if (pTable)
@@ -5097,9 +5095,9 @@ void ScDocFunc::ReplaceConditionalFormat( sal_uLong nOldFormat, ScConditionalFor
     if(nOldFormat)
     {
         ScConditionalFormat* pOldFormat = pDoc->GetCondFormList(nTab)->GetFormat(nOldFormat);
-        pRepaintRange.reset(new ScRange( pOldFormat->GetRange().Combine() ));
         if(pOldFormat)
         {
+            pRepaintRange.reset(new ScRange( pOldFormat->GetRange().Combine() ));
             RemoveCondFormatAttributes(pDoc, pOldFormat, nTab);
         }
 


More information about the Libreoffice-commits mailing list