diff options
-rwxr-xr-x | compilerplugins/clang/unusedenumconstants.py | 1 | ||||
-rw-r--r-- | sc/inc/datastreamgettime.hxx | 9 | ||||
-rw-r--r-- | sc/source/core/tool/interpr7.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/docshell/datastream.cxx | 18 |
4 files changed, 17 insertions, 17 deletions
diff --git a/compilerplugins/clang/unusedenumconstants.py b/compilerplugins/clang/unusedenumconstants.py index 670bb005eaab..6ee56d87657f 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 6c39727fff97..632cf8723159 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 69eed575810b..8b3e5375545b 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 d42382478a7b..97ad4203576c 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; |