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

Noel Grandin noel.grandin at collabora.co.uk
Tue Apr 11 08:33:16 UTC 2017


 include/xmloff/txtparae.hxx        |    5 +++--
 sc/source/core/inc/jumpmatrix.hxx  |    4 ++--
 sc/source/core/tool/jumpmatrix.cxx |    9 ++++-----
 xmloff/source/text/txtparae.cxx    |   11 +++++------
 xmloff/source/text/txtstyle.cxx    |    2 +-
 5 files changed, 15 insertions(+), 16 deletions(-)

New commits:
commit 4e162517869c811c06242bb8eb08001dfcf3b714
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Tue Apr 11 09:43:53 2017 +0200

    loplugin:inlinefields in ScJumpMatrix
    
    Change-Id: I8fea7185c6ccd1c023835da41ab184351d5cac01
    Reviewed-on: https://gerrit.libreoffice.org/36403
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sc/source/core/inc/jumpmatrix.hxx b/sc/source/core/inc/jumpmatrix.hxx
index 4ef4f87b282a..94b8dc1737aa 100644
--- a/sc/source/core/inc/jumpmatrix.hxx
+++ b/sc/source/core/inc/jumpmatrix.hxx
@@ -45,7 +45,7 @@ struct ScJumpMatrixEntry
                     nNext = nNextP;
                     nStop = nStopP;
                 }
-    void    GetJump( double& rBool, short& rStart, short& rNext, short& rStop )
+    void    GetJump( double& rBool, short& rStart, short& rNext, short& rStop ) const
                 {
                     rBool = fBool;
                     rStart = nStart;
@@ -56,7 +56,7 @@ struct ScJumpMatrixEntry
 
 class ScJumpMatrix
 {
-    ScJumpMatrixEntry*  pJump;      // the jumps
+    std::vector<ScJumpMatrixEntry> mvJump;      // the jumps
     ScMatrixRef         pMat;       // the results
     ScTokenVec*         pParams;    // parameter stack
     SCSIZE              nCols;
diff --git a/sc/source/core/tool/jumpmatrix.cxx b/sc/source/core/tool/jumpmatrix.cxx
index 0961e78ff49d..760f89735db6 100644
--- a/sc/source/core/tool/jumpmatrix.cxx
+++ b/sc/source/core/tool/jumpmatrix.cxx
@@ -28,7 +28,7 @@ const SCSIZE kBufferThreshold = 128;
 }
 
 ScJumpMatrix::ScJumpMatrix(SCSIZE nColsP, SCSIZE nRowsP)
-    : pJump(new ScJumpMatrixEntry[nColsP * nRowsP])
+    : mvJump(nColsP * nRowsP)
     , pMat(new ScFullMatrix(nColsP, nRowsP))
     , pParams(nullptr)
     , nCols(nColsP)
@@ -62,7 +62,6 @@ ScJumpMatrix::~ScJumpMatrix()
         }
         delete pParams;
     }
-    delete[] pJump;
 }
 
 void ScJumpMatrix::GetDimensions(SCSIZE& rCols, SCSIZE& rRows) const
@@ -74,7 +73,7 @@ void ScJumpMatrix::GetDimensions(SCSIZE& rCols, SCSIZE& rRows) const
 void ScJumpMatrix::SetJump(SCSIZE nCol, SCSIZE nRow, double fBool,
                            short nStart, short nNext)
 {
-    pJump[(sal_uLong)nCol * nRows + nRow].SetJump(fBool, nStart, nNext, SHRT_MAX);
+    mvJump[(sal_uLong)nCol * nRows + nRow].SetJump(fBool, nStart, nNext, SHRT_MAX);
 }
 
 void ScJumpMatrix::GetJump(
@@ -93,7 +92,7 @@ void ScJumpMatrix::GetJump(
         nCol = 0;
         nRow = 0;
     }
-    pJump[(sal_uLong)nCol * nRows + nRow].
+    mvJump[(sal_uLong)nCol * nRows + nRow].
         GetJump(rBool, rStart, rNext, rStop);
 }
 
@@ -102,7 +101,7 @@ void ScJumpMatrix::SetAllJumps(double fBool, short nStart, short nNext, short nS
     sal_uLong n = (sal_uLong)nCols * nRows;
     for (sal_uLong j = 0; j < n; ++j)
     {
-        pJump[j].SetJump(fBool, nStart,
+        mvJump[j].SetJump(fBool, nStart,
                          nNext, nStop);
     }
 }
commit 25e92d7f7c915e26febd8c868a6531d99aac30cd
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Mon Apr 10 10:15:59 2017 +0200

    loplugin:inlinefields in XMLTextParagraphExport
    
    Change-Id: If0e80fbe21b6d8bed55357d7fc09027fc4a37e06
    Reviewed-on: https://gerrit.libreoffice.org/36373
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/xmloff/txtparae.hxx b/include/xmloff/txtparae.hxx
index 070c392cc7bc..9f737e665b1b 100644
--- a/include/xmloff/txtparae.hxx
+++ b/include/xmloff/txtparae.hxx
@@ -29,6 +29,7 @@
 #include <xmloff/styleexp.hxx>
 #include <xmloff/xmltoken.hxx>
 #include <xmloff/SinglePropertySetInfoCache.hxx>
+#include <xmloff/XMLTextListAutoStylePool.hxx>
 #include <memory>
 #include <vector>
 
@@ -86,7 +87,7 @@ class XMLOFF_DLLPUBLIC XMLTextParagraphExport : public XMLStyleExport
     const ::std::unique_ptr< ::xmloff::BoundFrameSets > pBoundFrameSets;
     XMLTextFieldExport          *pFieldExport;
     std::vector<OUString>  *pListElements;
-    XMLTextListAutoStylePool    *pListAutoPool;
+    XMLTextListAutoStylePool    maListAutoPool;
     XMLSectionExport            *pSectionExport;
     XMLIndexMarkExport          *pIndexMarkExport;
 
@@ -587,7 +588,7 @@ private:
 inline const XMLTextListAutoStylePool&
     XMLTextParagraphExport::GetListAutoStylePool() const
 {
-    return *pListAutoPool;
+    return maListAutoPool;
 }
 
 inline void XMLTextParagraphExport::exportTextFrame(
diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
index 62491265a464..c64d8662794a 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -531,7 +531,7 @@ void XMLTextParagraphExport::Add( sal_uInt16 nFamily,
                         }
                     }
                     if( bAdd )
-                        pListAutoPool->Add( xNumRule );
+                        maListAutoPool.Add( xNumRule );
                 }
             }
             break;
@@ -637,7 +637,7 @@ void XMLTextParagraphExport::Add( sal_uInt16 nFamily,
                 }
             }
             if( bAdd )
-                pListAutoPool->Add( xNumRule );
+                maListAutoPool.Add( xNumRule );
         }
     }
 
@@ -1161,7 +1161,7 @@ XMLTextParagraphExport::XMLTextParagraphExport(
     pBoundFrameSets(new BoundFrameSets(GetExport().GetModel())),
     pFieldExport( nullptr ),
     pListElements( nullptr ),
-    pListAutoPool( new XMLTextListAutoStylePool( this->GetExport() ) ),
+    maListAutoPool( this->GetExport() ),
     pSectionExport( nullptr ),
     pIndexMarkExport( nullptr ),
     pRedlineExport( nullptr ),
@@ -1320,7 +1320,6 @@ XMLTextParagraphExport::~XMLTextParagraphExport()
     delete pSectionExport;
     delete pFieldExport;
     delete pListElements;
-    delete pListAutoPool;
 #ifdef DBG_UTIL
     txtparae_bContainsIllegalCharacters = false;
 #endif
@@ -1624,7 +1623,7 @@ bool XMLTextParagraphExport::collectTextAutoStylesOptimized( bool bIsProgress )
                     }
                 }
                 if( bAdd )
-                    pListAutoPool->Add( xNumRule );
+                    maListAutoPool.Add( xNumRule );
             }
         }
     }
@@ -3617,7 +3616,7 @@ void XMLTextParagraphExport::exportTextAutoStyles()
                                   GetExport().GetMM100UnitConverter(),
                                   GetExport().GetNamespaceMap() );
 
-    pListAutoPool->exportXML();
+    maListAutoPool.exportXML();
 }
 
 void XMLTextParagraphExport::exportRuby(
diff --git a/xmloff/source/text/txtstyle.cxx b/xmloff/source/text/txtstyle.cxx
index c26c09b90266..0832876e57e8 100644
--- a/xmloff/source/text/txtstyle.cxx
+++ b/xmloff/source/text/txtstyle.cxx
@@ -105,7 +105,7 @@ void XMLTextParagraphExport::exportStyleAttributes(
 void XMLTextParagraphExport::exportNumStyles( bool bUsed )
 {
     SvxXMLNumRuleExport aNumRuleExport( GetExport() );
-    aNumRuleExport.exportStyles( bUsed, pListAutoPool, !IsBlockMode() );
+    aNumRuleExport.exportStyles( bUsed, &maListAutoPool, !IsBlockMode() );
 }
 
 void XMLTextParagraphExport::exportTextStyles( bool bUsed, bool bProg )


More information about the Libreoffice-commits mailing list