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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Nov 23 16:54:26 UTC 2018


 compilerplugins/clang/unusedenumconstants.untouched.results |    6 ---
 sc/inc/scmatrix.hxx                                         |    4 --
 sc/qa/unit/ucalc.cxx                                        |    2 -
 sc/source/core/tool/interpr5.cxx                            |    2 -
 sc/source/core/tool/scmatrix.cxx                            |   21 +++---------
 5 files changed, 9 insertions(+), 26 deletions(-)

New commits:
commit baf08f569fb629211e4f9679bbb30fd61272dd46
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Nov 21 19:21:48 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Nov 23 17:53:55 2018 +0100

    enum ScMatrix::Op is unnecessary
    
    Change-Id: If4ae97b43f012f1770213d99407ffaadac05f9de
    Reviewed-on: https://gerrit.libreoffice.org/63756
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/compilerplugins/clang/unusedenumconstants.untouched.results b/compilerplugins/clang/unusedenumconstants.untouched.results
index c6810008b394..e0009e76a1fa 100644
--- a/compilerplugins/clang/unusedenumconstants.untouched.results
+++ b/compilerplugins/clang/unusedenumconstants.untouched.results
@@ -282,12 +282,6 @@ reportdesign/source/ui/inc/ReportDefines.hxx:24
     enum rptui::DlgEdMode Test
 sax/source/fastparser/fastparser.cxx:80
     enum (anonymous namespace)::CallbackType INVALID
-sc/inc/scmatrix.hxx:130
-    enum ScMatrix::Op Div
-sc/inc/scmatrix.hxx:130
-    enum ScMatrix::Op Add
-sc/inc/scmatrix.hxx:130
-    enum ScMatrix::Op Sub
 sc/source/filter/excel/xiescher.cxx:460
     enum (anonymous at /home/noel/libo2/sc/source/filter/excel/xiescher.cxx:460:17) eCreateFromOffice
 sc/source/filter/inc/decl.h:24
diff --git a/sc/inc/scmatrix.hxx b/sc/inc/scmatrix.hxx
index 4b58cd19217b..cb6f170cfcce 100644
--- a/sc/inc/scmatrix.hxx
+++ b/sc/inc/scmatrix.hxx
@@ -127,8 +127,6 @@ public:
     ScMatrix( size_t nC, size_t nR, const std::vector<double>& rInitVals );
     ~ScMatrix();
 
-    enum Op { Add, Sub, Mul, Div };
-
     typedef std::function<void(size_t, size_t, double)> DoubleOpFunction;
     typedef std::function<void(size_t, size_t, bool)> BoolOpFunction;
     typedef std::function<void(size_t, size_t, svl::SharedString)> StringOpFunction;
@@ -391,7 +389,7 @@ public:
      *                     otherwise they become NaN values.
      */
     void GetDoubleArray( std::vector<double>& rArray, bool bEmptyAsZero = true ) const ;
-    void MergeDoubleArray( std::vector<double>& rArray, Op eOp ) const ;
+    void MergeDoubleArrayMultiply( std::vector<double>& rArray ) const ;
 
     void NotOp(ScMatrix& rMat) ;
     void NegOp(ScMatrix& rMat) ;
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 6853c66ac0ae..be249c6f647e 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -1855,7 +1855,7 @@ void Test::testMatrix()
 
     pMat2 = new ScMatrix(3, 3, 10.0);
     pMat2->PutString(rPool.intern("B"), 1, 0);
-    pMat2->MergeDoubleArray(aDoubles, ScMatrix::Mul);
+    pMat2->MergeDoubleArrayMultiply(aDoubles);
 
     {
         const double pChecks[] = { 25, 12, 0, fNaN, fNaN, 0, 0, 23, -200 };
diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx
index b1c840e4fd94..2ab00919d6fa 100644
--- a/sc/source/core/tool/interpr5.cxx
+++ b/sc/source/core/tool/interpr5.cxx
@@ -1672,7 +1672,7 @@ void ScInterpreter::ScSumProduct()
             return;
         }
 
-        pMat->MergeDoubleArray(aResArray, ScMatrix::Mul);
+        pMat->MergeDoubleArrayMultiply(aResArray);
     }
 
     double fSum = std::for_each(aResArray.begin(), aResArray.end(), SumValues()).getValue();
diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index 5a736dd005b8..6cd50a560050 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -319,7 +319,7 @@ public:
     ScMatrixRef CompareMatrix( sc::Compare& rComp, size_t nMatPos, sc::CompareOptions* pOptions ) const;
 
     void GetDoubleArray( std::vector<double>& rArray, bool bEmptyAsZero ) const;
-    void MergeDoubleArray( std::vector<double>& rArray, ScMatrix::Op eOp ) const;
+    void MergeDoubleArrayMultiply( std::vector<double>& rArray ) const;
 
     template<typename T>
     void ApplyOperation(T aOp, ScMatrixImpl& rMat);
@@ -2181,24 +2181,15 @@ void ScMatrixImpl::GetDoubleArray( std::vector<double>& rArray, bool bEmptyAsZer
     aFunc.swap(rArray);
 }
 
-void ScMatrixImpl::MergeDoubleArray( std::vector<double>& rArray, ScMatrix::Op eOp ) const
+void ScMatrixImpl::MergeDoubleArrayMultiply( std::vector<double>& rArray ) const
 {
     MatrixImplType::size_pair_type aSize = maMat.size();
     size_t nSize = aSize.row*aSize.column;
     if (nSize != rArray.size())
         return;
 
-    switch (eOp)
-    {
-        case ScMatrix::Mul:
-        {
-            MergeDoubleArrayFunc<ArrayMul> aFunc(rArray);
-            maMat.walk(std::move(aFunc));
-        }
-        break;
-        default:
-            ;
-    }
+    MergeDoubleArrayFunc<ArrayMul> aFunc(rArray);
+    maMat.walk(std::move(aFunc));
 }
 
 namespace Op {
@@ -3289,9 +3280,9 @@ void ScMatrix::GetDoubleArray( std::vector<double>& rArray, bool bEmptyAsZero )
     pImpl->GetDoubleArray(rArray, bEmptyAsZero);
 }
 
-void ScMatrix::MergeDoubleArray( std::vector<double>& rArray, Op eOp ) const
+void ScMatrix::MergeDoubleArrayMultiply( std::vector<double>& rArray ) const
 {
-    pImpl->MergeDoubleArray(rArray, eOp);
+    pImpl->MergeDoubleArrayMultiply(rArray);
 }
 
 namespace matop {


More information about the Libreoffice-commits mailing list