[Libreoffice-commits] core.git: compilerplugins/clang include/oox oox/source sc/source

Noel Grandin noel.grandin at collabora.co.uk
Mon Feb 6 11:36:38 UTC 2017


 compilerplugins/clang/unusedenumconstants.py |    3 +++
 include/oox/core/fragmenthandler2.hxx        |    7 +++----
 oox/source/core/fragmenthandler2.cxx         |    8 ++++----
 sc/source/filter/oox/worksheetfragment.cxx   |    6 +++---
 4 files changed, 13 insertions(+), 11 deletions(-)

New commits:
commit fde0b8df30a65412afd5278a0dfd23ac30f62dc6
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Mon Feb 6 11:42:25 2017 +0200

    loplugin:unusedenumconstants in oox
    
    Convert FragmentHandler2::MCE_STATE to scoped enum and drop MCE_UNUSED
    constant
    
    Change-Id: Id0b3a81e61d77af5d3837527b008e196835f57cd
    Reviewed-on: https://gerrit.libreoffice.org/33954
    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 03b9071..4c454f5 100755
--- a/compilerplugins/clang/unusedenumconstants.py
+++ b/compilerplugins/clang/unusedenumconstants.py
@@ -91,12 +91,15 @@ for d in definitionSet:
          "vcl/source/fontsubset/cff.cxx",
          "include/vcl/settings.hxx", # stored in a setting, can't remove it without potentially triggering UBSAN
          "basic/source/inc/opcodes.hxx", # can't touch this without breaking unit tests, not sure why
+         "include/unotools/securityoptions.hxx", # comes from the UI
         # unit test code
          "cppu/source/uno/check.cxx",
         # general weird nonsense going on
          "framework/inc/helper/mischelper.hxx"
          "include/sfx2/shell.hxx",
          "framework/inc/helper/mischelper.hxx",
+         "include/svtools/htmltokn.h",
+         "include/sfx2/shell.hxx",
         # Windows or OSX only
          "include/canvas/rendering/icolorbuffer.hxx",
          "include/vcl/commandevent.hxx",
diff --git a/include/oox/core/fragmenthandler2.hxx b/include/oox/core/fragmenthandler2.hxx
index 9c72870..f32ee10 100644
--- a/include/oox/core/fragmenthandler2.hxx
+++ b/include/oox/core/fragmenthandler2.hxx
@@ -52,11 +52,10 @@ class XmlFilterBase;
 class OOX_DLLPUBLIC FragmentHandler2 : public FragmentHandler, public ContextHandler2Helper
 {
 protected:
-    enum MCE_STATE
+    enum class MCE_STATE
     {
-        MCE_UNUSED,
-        MCE_STARTED,
-        MCE_FOUND_CHOICE
+        Started,
+        FoundChoice
     };
     ::std::vector<MCE_STATE>           aMceState;
 
diff --git a/oox/source/core/fragmenthandler2.cxx b/oox/source/core/fragmenthandler2.cxx
index fe9b827..4bd32f4 100644
--- a/oox/source/core/fragmenthandler2.cxx
+++ b/oox/source/core/fragmenthandler2.cxx
@@ -58,12 +58,12 @@ bool FragmentHandler2::prepareMceContext( sal_Int32 nElement, const AttributeLis
     switch( nElement )
     {
         case MCE_TOKEN( AlternateContent ):
-            aMceState.push_back( MCE_STARTED );
+            aMceState.push_back( MCE_STATE::Started );
             break;
 
         case MCE_TOKEN( Choice ):
             {
-                if (aMceState.empty() || aMceState.back() != MCE_STARTED)
+                if (aMceState.empty() || aMceState.back() != MCE_STATE::Started)
                     return false;
 
                 OUString aRequires = rAttribs.getString( (XML_Requires ), "none" );
@@ -80,14 +80,14 @@ bool FragmentHandler2::prepareMceContext( sal_Int32 nElement, const AttributeLis
                 };
 
                 if (std::find(aSupportedNS.begin(), aSupportedNS.end(), aRequires) != aSupportedNS.end())
-                    aMceState.back() = MCE_FOUND_CHOICE;
+                    aMceState.back() = MCE_STATE::FoundChoice;
                 else
                     return false;
             }
             break;
 
         case MCE_TOKEN( Fallback ):
-            if( !aMceState.empty() && aMceState.back() == MCE_STARTED )
+            if( !aMceState.empty() && aMceState.back() == MCE_STATE::Started )
                 break;
             return false;
         default:
diff --git a/sc/source/filter/oox/worksheetfragment.cxx b/sc/source/filter/oox/worksheetfragment.cxx
index 8aaab09..c4882f8 100644
--- a/sc/source/filter/oox/worksheetfragment.cxx
+++ b/sc/source/filter/oox/worksheetfragment.cxx
@@ -466,17 +466,17 @@ ContextHandlerRef WorksheetFragment::onCreateContext( sal_Int32 nElement, const
         case XLS_TOKEN( oleObjects ):
             if ( getCurrentElement() == XLS_TOKEN( controls ) )
             {
-                if( aMceState.empty() || aMceState.back() == MCE_STARTED )
+                if( aMceState.empty() || aMceState.back() == MCE_STATE::Started )
                 {
                     if ( getCurrentElement() == XLS_TOKEN( oleObjects ) ) importOleObject( rAttribs );
                     else
                         importControl( rAttribs );
                 }
-                else if ( !aMceState.empty() && aMceState.back() == MCE_FOUND_CHOICE )
+                else if ( !aMceState.empty() && aMceState.back() == MCE_STATE::FoundChoice )
                 {
                     // reset the handling within 'Choice'
                     // this will force attempted handling in Fallback
-                    aMceState.back() = MCE_STARTED;
+                    aMceState.back() = MCE_STATE::Started;
                 }
             }
         break;


More information about the Libreoffice-commits mailing list