[Libreoffice-commits] core.git: 2 commits - compilerplugins/clang include/svx sc/inc sc/source

Noel Grandin noel.grandin at collabora.co.uk
Tue Feb 7 07:43:40 UTC 2017


 compilerplugins/clang/unusedenumconstants.py |    1 +
 include/svx/svdmodel.hxx                     |    1 -
 sc/inc/datastreamgettime.hxx                 |    9 ++++++++-
 sc/source/core/tool/interpr7.cxx             |    6 +++---
 sc/source/ui/docshell/datastream.cxx         |   18 +++++-------------
 5 files changed, 17 insertions(+), 18 deletions(-)

New commits:
commit b2453d1f41b369ca4b1c98e03b803be1773d0aff
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Tue Feb 7 09:06:00 2017 +0200

    convert DEBUG_TIME to scoped enum
    
    Change-Id: I91b286d8415ebc8c6675aca6ee143850c956c74b
    Reviewed-on: https://gerrit.libreoffice.org/33986
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/compilerplugins/clang/unusedenumconstants.py b/compilerplugins/clang/unusedenumconstants.py
index 670bb00..6ee56d8 100755
--- a/compilerplugins/clang/unusedenumconstants.py
+++ b/compilerplugins/clang/unusedenumconstants.py
@@ -97,6 +97,7 @@ for d in definitionSet:
          "include/registry/refltype.hxx",
          "include/registry/version.h",
          "include/svtools/rtftoken.h",
+         "sc/source/filter/inc/xltracer.hxx",
         # unit test code
          "cppu/source/uno/check.cxx",
         # general weird nonsense going on
diff --git a/sc/inc/datastreamgettime.hxx b/sc/inc/datastreamgettime.hxx
index 6c39727..632cf87 100644
--- a/sc/inc/datastreamgettime.hxx
+++ b/sc/inc/datastreamgettime.hxx
@@ -24,7 +24,14 @@
 
 namespace sc {
 
-double datastream_get_time(int nIdx);
+enum class DebugTime {
+    Import,
+    Recalc,
+    Render,
+    LAST = Render
+};
+
+double datastream_get_time(DebugTime nIdx);
 
 }
 
diff --git a/sc/source/core/tool/interpr7.cxx b/sc/source/core/tool/interpr7.cxx
index 69eed57..8b3e537 100644
--- a/sc/source/core/tool/interpr7.cxx
+++ b/sc/source/core/tool/interpr7.cxx
@@ -367,11 +367,11 @@ void ScInterpreter::ScDebugVar()
         PushDouble(fVal);
     }
     else if (aStrUpper == "DATASTREAM_IMPORT")
-        PushDouble( sc::datastream_get_time( 0 ) );
+        PushDouble( sc::datastream_get_time( sc::DebugTime::Import ) );
     else if (aStrUpper == "DATASTREAM_RECALC")
-        PushDouble( sc::datastream_get_time( 1 ) );
+        PushDouble( sc::datastream_get_time( sc::DebugTime::Recalc ) );
     else if (aStrUpper == "DATASTREAM_RENDER")
-        PushDouble( sc::datastream_get_time( 2 ) );
+        PushDouble( sc::datastream_get_time( sc::DebugTime::Render ) );
     else
         PushIllegalParameter();
 }
diff --git a/sc/source/ui/docshell/datastream.cxx b/sc/source/ui/docshell/datastream.cxx
index d423824..97ad420 100644
--- a/sc/source/ui/docshell/datastream.cxx
+++ b/sc/source/ui/docshell/datastream.cxx
@@ -25,6 +25,7 @@
 #include <viewdata.hxx>
 #include <stringutil.hxx>
 #include <documentlinkmgr.hxx>
+#include <o3tl/enumarray.hxx>
 
 #include "officecfg/Office/Calc.hxx"
 
@@ -38,19 +39,10 @@
 
 namespace sc {
 
-enum {
-    DEBUG_TIME_IMPORT,
-    DEBUG_TIME_RECALC,
-    DEBUG_TIME_RENDER,
-    DEBUG_TIME_MAX
-};
-
-static double fTimes[DEBUG_TIME_MAX] = { 0.0, 0.0, 0.0 };
+static o3tl::enumarray<DebugTime, double> fTimes { 0.0, 0.0, 0.0 };
 
-double datastream_get_time(int nIdx)
+double datastream_get_time(DebugTime nIdx)
 {
-    if( nIdx < 0 || nIdx >= (int)SAL_N_ELEMENTS( fTimes ) )
-        return -1;
     return fTimes[ nIdx ];
 }
 
@@ -449,7 +441,7 @@ void DataStream::Refresh()
     mpDocShell->DoHardRecalc(true);
     mpDocShell->SetDocumentModified();
 
-    fTimes[ DEBUG_TIME_RECALC ] = getNow() - fStart;
+    fTimes[ DebugTime::Recalc ] = getNow() - fStart;
 
     mfLastRefreshTime = getNow();
     mnLinesSinceRefresh = 0;
@@ -531,7 +523,7 @@ void DataStream::Text2Doc()
         }
     }
 
-    fTimes[ DEBUG_TIME_IMPORT ] = getNow() - fStart;
+    fTimes[ DebugTime::Import ] = getNow() - fStart;
 
     if (meMove == NO_MOVE)
         return;
commit 3aeaa73a2e3568bd932b16cf4d3fea3fb39ebf13
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Mon Feb 6 15:51:33 2017 +0200

    remove unused constant from SdrHintKind
    
    Change-Id: If48ac2b312e4363c7d6d426e315766105176114b
    Reviewed-on: https://gerrit.libreoffice.org/33985
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/svx/svdmodel.hxx b/include/svx/svdmodel.hxx
index 71c0e3e..4cad2a4 100644
--- a/include/svx/svdmodel.hxx
+++ b/include/svx/svdmodel.hxx
@@ -103,7 +103,6 @@ namespace o3tl
 
 enum class SdrHintKind
 {
-    Unknown,              // Unknown
     LayerChange,          // changed layer definition
     LayerOrderChange,     // order of layer changed (Insert/Remove/ChangePos)
     PageOrderChange,      // order of pages (object pages or master pages) changed (Insert/Remove/ChangePos)


More information about the Libreoffice-commits mailing list