[Libreoffice-commits] core.git: Branch 'feature/priorities' - include/vcl vcl/source

Tobias Madl tobias.madl.dev at gmail.com
Thu Jan 22 03:28:58 PST 2015


 include/vcl/idle.hxx    |   41 ++++++++---------------------------------
 vcl/source/app/idle.cxx |    4 ++--
 2 files changed, 10 insertions(+), 35 deletions(-)

New commits:
commit d2382e1a8f04ac91768fe59e1498048f3fcfdc9a
Author: Tobias Madl <tobias.madl.dev at gmail.com>
Date:   Thu Jan 22 12:27:45 2015 +0100

    Idle: Inserted static cast
    
    Change-Id: I4cfbb53763001854d37fbcd304e77e65279173b6

diff --git a/include/vcl/idle.hxx b/include/vcl/idle.hxx
index 6c40ca3..ef6d7b5 100644
--- a/include/vcl/idle.hxx
+++ b/include/vcl/idle.hxx
@@ -28,41 +28,16 @@ struct ImplIdleData;
 struct ImplSVData;
 
 enum class IdlePriority {
-    VCL_IDLE_PRIORITY_HIGHEST,
-    VCL_IDLE_PRIORITY_HIGH,
-    VCL_IDLE_PRIORITY_REPAINT,
-    VCL_IDLE_PRIORITY_RESIZE,
-    VCL_IDLE_PRIORITY_MEDIUM,
-    VCL_IDLE_PRIORITY_LOW,
-    VCL_IDLE_PRIORITY_LOWER,
-    VCL_IDLE_PRIORITY_LOWEST
+    VCL_IDLE_PRIORITY_HIGHEST   = 0,
+    VCL_IDLE_PRIORITY_HIGH      = 1,
+    VCL_IDLE_PRIORITY_REPAINT   = 2,
+    VCL_IDLE_PRIORITY_RESIZE    = 3,
+    VCL_IDLE_PRIORITY_MEDIUM    = 3,
+    VCL_IDLE_PRIORITY_LOW       = 4,
+    VCL_IDLE_PRIORITY_LOWER     = 5,
+    VCL_IDLE_PRIORITY_LOWEST    = 6
 };
 
-inline sal_Int32 convertToInt( IdlePriority ePriority )
-{
-    switch (ePriority)
-    {
-        case IdlePriority::VCL_IDLE_PRIORITY_HIGHEST:
-            return 0;
-        case IdlePriority::VCL_IDLE_PRIORITY_HIGH:
-            return 1;
-        case IdlePriority::VCL_IDLE_PRIORITY_REPAINT:
-            return 2;
-        case IdlePriority::VCL_IDLE_PRIORITY_RESIZE:
-            return 3;
-        case IdlePriority::VCL_IDLE_PRIORITY_MEDIUM:
-            return 3;
-        case IdlePriority::VCL_IDLE_PRIORITY_LOW:
-            return 4;
-        case IdlePriority::VCL_IDLE_PRIORITY_LOWER:
-            return 5;
-        case IdlePriority::VCL_IDLE_PRIORITY_LOWEST:
-            return 6;
-    }
-
-    return 42; // Should not happen
-}
-
 class VCL_DLLPUBLIC Idle
 {
 protected:
diff --git a/vcl/source/app/idle.cxx b/vcl/source/app/idle.cxx
index cc92d36..555bc34 100644
--- a/vcl/source/app/idle.cxx
+++ b/vcl/source/app/idle.cxx
@@ -36,7 +36,7 @@ struct ImplIdleData
         if (mbDelete || mbInIdle )
             return;
 
-        mpIdle->SetSchedulingPriority(convertToInt(mpIdle->GetDefaultPriority()));
+        mpIdle->SetSchedulingPriority(static_cast<sal_Int32>(mpIdle->GetDefaultPriority()));
         mbDelete = true;
         mpIdle->mbActive = false;
 
@@ -208,7 +208,7 @@ Idle& Idle::operator=( const Idle& rIdle )
 
 Idle::Idle():
     mpIdleData(NULL),
-    miPriority(convertToInt(IdlePriority::VCL_IDLE_PRIORITY_HIGH)),
+    miPriority(static_cast<sal_Int32>(IdlePriority::VCL_IDLE_PRIORITY_HIGH)),
     meDefaultPriority(IdlePriority::VCL_IDLE_PRIORITY_HIGH),
     mbActive(false)
 {


More information about the Libreoffice-commits mailing list