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

Jochen Nitschke j.nitschke+logerrit at ok.de
Thu Feb 9 05:57:48 UTC 2017


 sc/source/filter/inc/rtfparse.hxx |    2 +-
 sc/source/filter/rtf/rtfparse.cxx |   18 ++++++++----------
 2 files changed, 9 insertions(+), 11 deletions(-)

New commits:
commit 67cf45f54c71b62226475dd54cf32fb20136a221
Author: Jochen Nitschke <j.nitschke+logerrit at ok.de>
Date:   Wed Feb 8 22:47:56 2017 +0100

    move member to stack
    
    ScRTFColTwips is a vector with some extra logic
    
    Change-Id: I1ef08152d57f73404d08a566e311fdbe8934f68c
    Reviewed-on: https://gerrit.libreoffice.org/34047
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sc/source/filter/inc/rtfparse.hxx b/sc/source/filter/inc/rtfparse.hxx
index 3fe1db4..ccb7908 100644
--- a/sc/source/filter/inc/rtfparse.hxx
+++ b/sc/source/filter/inc/rtfparse.hxx
@@ -54,7 +54,7 @@ private:
     DefaultList maDefaultList;
     size_t mnCurPos;
 
-    ScRTFColTwips*      pColTwips;
+    ScRTFColTwips       aColTwips;
     ScRTFCellDefault*   pInsDefault;
     ScRTFCellDefault*   pActDefault;
     ScRTFCellDefault*   pDefMerge;
diff --git a/sc/source/filter/rtf/rtfparse.cxx b/sc/source/filter/rtf/rtfparse.cxx
index b6b7a70..5f9dbdf 100644
--- a/sc/source/filter/rtf/rtfparse.cxx
+++ b/sc/source/filter/rtf/rtfparse.cxx
@@ -35,7 +35,6 @@
 ScRTFParser::ScRTFParser( EditEngine* pEditP ) :
         ScEEParser( pEditP ),
         mnCurPos(0),
-        pColTwips( new ScRTFColTwips ),
         pActDefault( nullptr ),
         pDefMerge( nullptr ),
         nStartAdjust( (sal_uLong)~0 ),
@@ -52,7 +51,6 @@ ScRTFParser::ScRTFParser( EditEngine* pEditP ) :
 ScRTFParser::~ScRTFParser()
 {
     delete pInsDefault;
-    delete pColTwips;
     maDefaultList.clear();
 }
 
@@ -103,21 +101,21 @@ inline void ScRTFParser::NextRow()
 
 bool ScRTFParser::SeekTwips( sal_uInt16 nTwips, SCCOL* pCol )
 {
-    ScRTFColTwips::const_iterator it = pColTwips->find( nTwips );
-    bool bFound = it != pColTwips->end();
-    sal_uInt16 nPos = it - pColTwips->begin();
+    ScRTFColTwips::const_iterator it = aColTwips.find( nTwips );
+    bool bFound = it != aColTwips.end();
+    sal_uInt16 nPos = it - aColTwips.begin();
     *pCol = static_cast<SCCOL>(nPos);
     if ( bFound )
         return true;
-    sal_uInt16 nCount = pColTwips->size();
+    sal_uInt16 nCount = aColTwips.size();
     if ( !nCount )
         return false;
     SCCOL nCol = *pCol;
     // nCol is insertion position; the next one higher up is there (or not)
-    if ( nCol < static_cast<SCCOL>(nCount) && (((*pColTwips)[nCol] - SC_RTFTWIPTOL) <= nTwips) )
+    if ( nCol < static_cast<SCCOL>(nCount) && ((aColTwips[nCol] - SC_RTFTWIPTOL) <= nTwips) )
         return true;
     // Not smaller than everything else? Then compare with the next lower one
-    else if ( nCol != 0 && (((*pColTwips)[nCol-1] + SC_RTFTWIPTOL) >= nTwips) )
+    else if ( nCol != 0 && ((aColTwips[nCol-1] + SC_RTFTWIPTOL) >= nTwips) )
     {
         (*pCol)--;
         return true;
@@ -150,7 +148,7 @@ void ScRTFParser::ColAdjust()
                 nColMax = nCol;
         }
         nStartAdjust = (sal_uLong)~0;
-        pColTwips->clear();
+        aColTwips.clear();
     }
 }
 
@@ -227,7 +225,7 @@ void ScRTFParser::NewCellRow( ImportInfo* /*pInfo*/ )
             const ScRTFCellDefault& rD = *pCellDefault.get();
             SCCOL nCol;
             if ( !SeekTwips(rD.nTwips, &nCol) )
-                pColTwips->insert( rD.nTwips );
+                aColTwips.insert( rD.nTwips );
         }
     }
     pDefMerge = nullptr;


More information about the Libreoffice-commits mailing list