diff options
author | Tor Lillqvist <tml@collabora.com> | 2016-10-24 12:10:27 +0300 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2016-10-24 17:25:41 +0300 |
commit | 34dc5ea5510df5692addbf4d8559e72085a4835b (patch) | |
tree | baa28002f7ca42147f287ade1ed9ea6ad712f420 /xmlsecurity/source | |
parent | ec52bc6a570b93d1913d0514d451a5c72070ddc2 (diff) |
Use an enum class
Change-Id: If75874ee12197edd367f5527a37e467041005794
Diffstat (limited to 'xmlsecurity/source')
-rw-r--r-- | xmlsecurity/source/helper/xsecctl.cxx | 14 | ||||
-rw-r--r-- | xmlsecurity/source/helper/xsecctl.hxx | 13 | ||||
-rw-r--r-- | xmlsecurity/source/helper/xsecsign.cxx | 4 | ||||
-rw-r--r-- | xmlsecurity/source/helper/xsecverify.cxx | 4 |
4 files changed, 16 insertions, 19 deletions
diff --git a/xmlsecurity/source/helper/xsecctl.cxx b/xmlsecurity/source/helper/xsecctl.cxx index 23df46f04d42..87f65cf50884 100644 --- a/xmlsecurity/source/helper/xsecctl.cxx +++ b/xmlsecurity/source/helper/xsecctl.cxx @@ -61,7 +61,7 @@ XSecController::XSecController( const cssu::Reference<cssu::XComponentContext>& , m_bIsSAXEventKeeperConnected(false) , m_bIsCollectingElement(false) , m_bIsBlocking(false) - , m_nStatusOfSecurityComponents(UNINITIALIZED) + , m_eStatusOfSecurityComponents(InitializationState::UNINITIALIZED) , m_bIsSAXEventKeeperSticky(false) , m_pErrorMessage(nullptr) , m_nReservedSignatureId(0) @@ -129,7 +129,7 @@ void XSecController::createXSecComponent( ) /* * marks all security components are not available. */ - m_nStatusOfSecurityComponents = FAILTOINITIALIZED; + m_eStatusOfSecurityComponents = InitializationState::FAILTOINITIALIZED; m_xXMLSignature = nullptr; m_xXMLDocumentWrapper = nullptr; m_xSAXEventKeeper = nullptr; @@ -183,7 +183,7 @@ void XSecController::createXSecComponent( ) xSAXEventKeeperStatusChangeBroadcaster ->addSAXEventKeeperStatusChangeListener( xStatusChangeListener ); - m_nStatusOfSecurityComponents = INITIALIZED; + m_eStatusOfSecurityComponents = InitializationState::INITIALIZED; } } @@ -228,12 +228,12 @@ bool XSecController::chainOn( bool bRetrievingLastEvent ) if (!m_bIsSAXEventKeeperSticky && !m_bIsSAXEventKeeperConnected) { - if ( m_nStatusOfSecurityComponents == UNINITIALIZED ) + if ( m_eStatusOfSecurityComponents == InitializationState::UNINITIALIZED ) { createXSecComponent(); } - if ( m_nStatusOfSecurityComponents == INITIALIZED ) + if ( m_eStatusOfSecurityComponents == InitializationState::INITIALIZED ) /* * if all security components are ready, chains on the SAXEventKeeper */ @@ -455,7 +455,7 @@ void XSecController::startMission( { m_xUriBinding = xUriBinding; - m_nStatusOfSecurityComponents = UNINITIALIZED; + m_eStatusOfSecurityComponents = InitializationState::UNINITIALIZED; m_xSecurityContext = xSecurityContext; m_pErrorMessage = nullptr; @@ -534,7 +534,7 @@ void XSecController::endMission() for (int i=0; i<size; ++i) { - if ( m_nStatusOfSecurityComponents == INITIALIZED ) + if ( m_eStatusOfSecurityComponents == InitializationState::INITIALIZED ) /* * ResolvedListener only exist when the security components are created. */ diff --git a/xmlsecurity/source/helper/xsecctl.hxx b/xmlsecurity/source/helper/xsecctl.hxx index 3ecf391f6216..faa6118ec7a5 100644 --- a/xmlsecurity/source/helper/xsecctl.hxx +++ b/xmlsecurity/source/helper/xsecctl.hxx @@ -113,13 +113,6 @@ #define ALGO_XMLDSIGSHA256 "http://www.w3.org/2001/04/xmlenc#sha256" #define ALGO_RELATIONSHIP "http://schemas.openxmlformats.org/package/2006/RelationshipTransform" -/* - * status of security related components - */ -#define UNINITIALIZED 0 -#define INITIALIZED 1 -#define FAILTOINITIALIZED 2 - class XSecParser; class InternalSignatureInformation @@ -292,7 +285,11 @@ private: * a flag representing the current status of security related * components. */ - sal_Int32 m_nStatusOfSecurityComponents; + + /* + * status of security related components + */ + enum class InitializationState { UNINITIALIZED, INITIALIZED, FAILTOINITIALIZED } m_eStatusOfSecurityComponents; /* * a flag representing whether the SAXEventKeeper need to be diff --git a/xmlsecurity/source/helper/xsecsign.cxx b/xmlsecurity/source/helper/xsecsign.cxx index 6791d4096eeb..4a5fb3df5283 100644 --- a/xmlsecurity/source/helper/xsecsign.cxx +++ b/xmlsecurity/source/helper/xsecsign.cxx @@ -313,7 +313,7 @@ bool XSecController::WriteSignature( */ chainOn(true); - if ( m_nStatusOfSecurityComponents == INITIALIZED ) + if ( m_eStatusOfSecurityComponents == InitializationState::INITIALIZED ) /* * if all security components are ready, add the signature * stream. @@ -383,7 +383,7 @@ bool XSecController::WriteOOXMLSignature(const uno::Reference<embed::XStorage>& // Chain the SAXEventKeeper to the SAX chain. chainOn(/*bRetrievingLastEvent=*/true); - if (m_nStatusOfSecurityComponents == INITIALIZED) + if (m_eStatusOfSecurityComponents == InitializationState::INITIALIZED) { m_bIsSAXEventKeeperSticky = true; m_xSAXEventKeeper->setNextHandler(xDocumentHandler); diff --git a/xmlsecurity/source/helper/xsecverify.cxx b/xmlsecurity/source/helper/xsecverify.cxx index bded4f875ccb..46946feea6d3 100644 --- a/xmlsecurity/source/helper/xsecverify.cxx +++ b/xmlsecurity/source/helper/xsecverify.cxx @@ -46,7 +46,7 @@ namespace cssxs = com::sun::star::xml::sax; cssu::Reference< cssxc::sax::XReferenceResolvedListener > XSecController::prepareSignatureToRead( sal_Int32 nSecurityId) { - if ( m_nStatusOfSecurityComponents != INITIALIZED ) + if ( m_eStatusOfSecurityComponents != InitializationState::INITIALIZED ) { return nullptr; } @@ -329,7 +329,7 @@ void XSecController::collectToVerify( const OUString& referenceId ) { /* SAL_WARN_IF( !m_xSAXEventKeeper.is(), "xmlsecurity", "the SAXEventKeeper is NULL" ); */ - if ( m_nStatusOfSecurityComponents == INITIALIZED ) + if ( m_eStatusOfSecurityComponents == InitializationState::INITIALIZED ) /* * if all security components are ready, verify the signature. */ |