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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Aug 28 07:54:25 UTC 2018


 sc/inc/table.hxx               |    4 ++--
 sc/source/core/data/table3.cxx |   12 ++++++------
 2 files changed, 8 insertions(+), 8 deletions(-)

New commits:
commit 8bcc4a98d78869d6839821b9747602777f00ebaf
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Aug 27 15:50:56 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Aug 28 09:54:02 2018 +0200

    return by std::unique_ptr from CreateSortInfoArray
    
    Change-Id: I4be97a5e93bd4cb08a9c25dc663883c2c5e8dd5e
    Reviewed-on: https://gerrit.libreoffice.org/59682
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 54d11db8599c..e9aee6b689a5 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -1153,8 +1153,8 @@ private:
         ScRefCellValue& rCell2, SCCOL nCell2Col, SCROW nCell2Row ) const;
     short       Compare(SCCOLROW nIndex1, SCCOLROW nIndex2) const;
     short       Compare( ScSortInfoArray*, SCCOLROW nIndex1, SCCOLROW nIndex2) const;
-    ScSortInfoArray* CreateSortInfoArray( const sc::ReorderParam& rParam );
-    ScSortInfoArray* CreateSortInfoArray(
+    std::unique_ptr<ScSortInfoArray> CreateSortInfoArray( const sc::ReorderParam& rParam );
+    std::unique_ptr<ScSortInfoArray> CreateSortInfoArray(
         const ScSortParam& rSortParam, SCCOLROW nInd1, SCCOLROW nInd2,
         bool bKeepQuery, bool bUpdateRefs );
     void        QuickSort( ScSortInfoArray*, SCCOLROW nLo, SCCOLROW nHi);
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 816851e8c9a0..94c86f5eb8c2 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -446,9 +446,9 @@ void initDataRows(
 
 }
 
-ScSortInfoArray* ScTable::CreateSortInfoArray( const sc::ReorderParam& rParam )
+std::unique_ptr<ScSortInfoArray> ScTable::CreateSortInfoArray( const sc::ReorderParam& rParam )
 {
-    ScSortInfoArray* pArray = nullptr;
+    std::unique_ptr<ScSortInfoArray> pArray;
 
     if (rParam.mbByRow)
     {
@@ -458,7 +458,7 @@ ScSortInfoArray* ScTable::CreateSortInfoArray( const sc::ReorderParam& rParam )
         SCCOL nCol1 = rParam.maSortRange.aStart.Col();
         SCCOL nCol2 = rParam.maSortRange.aEnd.Col();
 
-        pArray = new ScSortInfoArray(0, nRow1, nRow2);
+        pArray.reset(new ScSortInfoArray(0, nRow1, nRow2));
         pArray->SetKeepQuery(rParam.mbHiddenFiltered);
         pArray->SetUpdateRefs(rParam.mbUpdateRefs);
 
@@ -471,7 +471,7 @@ ScSortInfoArray* ScTable::CreateSortInfoArray( const sc::ReorderParam& rParam )
         SCCOLROW nCol1 = rParam.maSortRange.aStart.Col();
         SCCOLROW nCol2 = rParam.maSortRange.aEnd.Col();
 
-        pArray = new ScSortInfoArray(0, nCol1, nCol2);
+        pArray.reset(new ScSortInfoArray(0, nCol1, nCol2));
         pArray->SetKeepQuery(rParam.mbHiddenFiltered);
         pArray->SetUpdateRefs(rParam.mbUpdateRefs);
     }
@@ -479,14 +479,14 @@ ScSortInfoArray* ScTable::CreateSortInfoArray( const sc::ReorderParam& rParam )
     return pArray;
 }
 
-ScSortInfoArray* ScTable::CreateSortInfoArray(
+std::unique_ptr<ScSortInfoArray> ScTable::CreateSortInfoArray(
     const ScSortParam& rSortParam, SCCOLROW nInd1, SCCOLROW nInd2,
     bool bKeepQuery, bool bUpdateRefs )
 {
     sal_uInt16 nUsedSorts = 1;
     while ( nUsedSorts < rSortParam.GetSortKeyCount() && rSortParam.maKeyState[nUsedSorts].bDoSort )
         nUsedSorts++;
-    ScSortInfoArray* pArray = new ScSortInfoArray( nUsedSorts, nInd1, nInd2 );
+    std::unique_ptr<ScSortInfoArray> pArray(new ScSortInfoArray( nUsedSorts, nInd1, nInd2 ));
     pArray->SetKeepQuery(bKeepQuery);
     pArray->SetUpdateRefs(bUpdateRefs);
 


More information about the Libreoffice-commits mailing list