[Libreoffice-commits] core.git: compilerplugins/clang sax/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Nov 23 18:52:42 UTC 2018


 compilerplugins/clang/unusedenumconstants.untouched.results |    6 --
 sax/source/fastparser/fastparser.cxx                        |   26 ++++++------
 2 files changed, 13 insertions(+), 19 deletions(-)

New commits:
commit c110bfc810ed381409d0f3742d8ce58a690d840f
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Nov 22 08:48:59 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Nov 23 19:52:13 2018 +0100

    convert CallbackType to scoped enum
    
    and drop unused INVALID constant
    
    Change-Id: Ifbfaeb209ed75af99f8e531105b9f23541034648
    Reviewed-on: https://gerrit.libreoffice.org/63890
    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 e0009e76a1fa..e038f28ec873 100644
--- a/compilerplugins/clang/unusedenumconstants.untouched.results
+++ b/compilerplugins/clang/unusedenumconstants.untouched.results
@@ -280,8 +280,6 @@ linguistic/source/defs.hxx:85
     enum LinguDispatcher::DspType DSP_SPELL
 reportdesign/source/ui/inc/ReportDefines.hxx:24
     enum rptui::DlgEdMode Test
-sax/source/fastparser/fastparser.cxx:80
-    enum (anonymous namespace)::CallbackType INVALID
 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
@@ -390,10 +388,6 @@ sw/source/ui/fldui/fldref.cxx:767
     enum FMT_REF_IDX FMT_REF_ONLYNUMBER_IDX
 sw/source/ui/fldui/fldref.cxx:768
     enum FMT_REF_IDX FMT_REF_ONLYCAPTION_IDX
-sw/source/uibase/docvw/edtwin.cxx:1570
-    enum SwKeyState ColTopBig
-sw/source/uibase/docvw/edtwin.cxx:1571
-    enum SwKeyState ColTopSmall
 sw/source/uibase/utlui/content.cxx:824
     enum STR_CONTEXT_IDX IDX_STR_LINK_REGION
 sw/source/uibase/utlui/content.cxx:825
diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx
index c910ad83381f..d7b5446a7423 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -77,7 +77,7 @@ struct EventList
     bool mbIsAttributesEmpty;
 };
 
-enum CallbackType { INVALID, START_ELEMENT, END_ELEMENT, CHARACTERS, PROCESSING_INSTRUCTION, DONE, EXCEPTION };
+enum class CallbackType { START_ELEMENT, END_ELEMENT, CHARACTERS, PROCESSING_INSTRUCTION, DONE, EXCEPTION };
 
 struct Event
 {
@@ -295,7 +295,7 @@ private:
         catch (...)
         {
             Entity &rEntity = mpParser->getEntity();
-            rEntity.getEvent( EXCEPTION );
+            rEntity.getEvent( CallbackType::EXCEPTION );
             mpParser->produce( true );
         }
     }
@@ -985,22 +985,22 @@ bool FastSaxParserImpl::consume(EventList& rEventList)
     {
         switch ((*aEventIt).maType)
         {
-            case START_ELEMENT:
+            case CallbackType::START_ELEMENT:
                 rEntity.startElement( &(*aEventIt) );
                 break;
-            case END_ELEMENT:
+            case CallbackType::END_ELEMENT:
                 rEntity.endElement();
                 break;
-            case CHARACTERS:
+            case CallbackType::CHARACTERS:
                 rEntity.characters( (*aEventIt).msChars );
                 break;
-            case PROCESSING_INSTRUCTION:
+            case CallbackType::PROCESSING_INSTRUCTION:
                 rEntity.processingInstruction(
                     (*aEventIt).msNamespace, (*aEventIt).msElementName ); // ( target, data )
                 break;
-            case DONE:
+            case CallbackType::DONE:
                 return false;
-            case EXCEPTION:
+            case CallbackType::EXCEPTION:
                 rEntity.throwException( mxDocumentLocator, false );
                 SAL_FALLTHROUGH; // avoid unreachable code warning with some compilers
             default:
@@ -1094,7 +1094,7 @@ void FastSaxParserImpl::parse()
             rEntity.throwException( mxDocumentLocator, true );
         }
     } while( nRead > 0 );
-    rEntity.getEvent( DONE );
+    rEntity.getEvent( CallbackType::DONE );
     if( rEntity.mbEnableThreads )
         produce( true );
 }
@@ -1117,7 +1117,7 @@ void FastSaxParserImpl::callbackStartElement(const xmlChar *localName , const xm
     }
 
     // create attribute map and process namespace instructions
-    Event& rEvent = rEntity.getEvent( START_ELEMENT );
+    Event& rEvent = rEntity.getEvent( CallbackType::START_ELEMENT );
     bool bIsAttributesEmpty = false;
     if ( rEntity.mbEnableThreads )
         bIsAttributesEmpty = rEntity.getEventList().mbIsAttributesEmpty;
@@ -1285,7 +1285,7 @@ void FastSaxParserImpl::callbackEndElement()
     if( !rEntity.maNamespaceStack.empty() )
         rEntity.maNamespaceStack.pop();
 
-    rEntity.getEvent( END_ELEMENT );
+    rEntity.getEvent( CallbackType::END_ELEMENT );
     if (rEntity.mbEnableThreads)
         produce();
     else
@@ -1314,7 +1314,7 @@ void FastSaxParserImpl::sendPendingCharacters()
     OUString sChars( pendingCharacters.data(), pendingCharacters.size(), RTL_TEXTENCODING_UTF8 );
     if (rEntity.mbEnableThreads)
     {
-        Event& rEvent = rEntity.getEvent( CHARACTERS );
+        Event& rEvent = rEntity.getEvent( CallbackType::CHARACTERS );
         rEvent.msChars = sChars;
         produce();
     }
@@ -1328,7 +1328,7 @@ void FastSaxParserImpl::callbackProcessingInstruction( const xmlChar *target, co
     if (!pendingCharacters.empty())
         sendPendingCharacters();
     Entity& rEntity = getEntity();
-    Event& rEvent = rEntity.getEvent( PROCESSING_INSTRUCTION );
+    Event& rEvent = rEntity.getEvent( CallbackType::PROCESSING_INSTRUCTION );
 
     // This event is very rare, so no need to waste extra space for this
     // Using namespace and element strings to be target and data in that order.


More information about the Libreoffice-commits mailing list