diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-11-10 10:29:43 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-11-10 10:32:02 +0100 |
commit | 3a2037b11c28fdf9409a336f8086790bc6f8f86f (patch) | |
tree | ef7a94cf7e7b4f7a4ace1c035e0dcc4179fc2fda /xmlsecurity | |
parent | 6de82da0c154a0e8a353125aa80a61779abfd3ba (diff) |
loplugin:nullptr (automatic rewrite)
Change-Id: I2093e93e07ff19a1a1d2c8b6f221dac2bf2a2613
Diffstat (limited to 'xmlsecurity')
43 files changed, 405 insertions, 405 deletions
diff --git a/xmlsecurity/source/component/documentdigitalsignatures.cxx b/xmlsecurity/source/component/documentdigitalsignatures.cxx index 9ce81d68984d..a0cee496d30d 100644 --- a/xmlsecurity/source/component/documentdigitalsignatures.cxx +++ b/xmlsecurity/source/component/documentdigitalsignatures.cxx @@ -442,12 +442,12 @@ Reference< css::security::XCertificate > DocumentDigitalSignatures::chooseCertif ScopedVclPtrInstance< CertificateChooser > aChooser( nullptr, mxCtx, xSecEnv, aSignatureHelper.GetSignatureInformations()); if (aChooser->Execute() != RET_OK) - return Reference< css::security::XCertificate >(0); + return Reference< css::security::XCertificate >(nullptr); Reference< css::security::XCertificate > xCert = aChooser->GetSelectedCertificate(); if ( !xCert.is() ) - return Reference< css::security::XCertificate >(0); + return Reference< css::security::XCertificate >(nullptr); return xCert; } diff --git a/xmlsecurity/source/component/registerservices.cxx b/xmlsecurity/source/component/registerservices.cxx index 722c29172297..2b5544f86489 100644 --- a/xmlsecurity/source/component/registerservices.cxx +++ b/xmlsecurity/source/component/registerservices.cxx @@ -32,7 +32,7 @@ extern "C" { SAL_DLLPUBLIC_EXPORT void* SAL_CALL xmlsecurity_component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) { - void* pRet = 0; + void* pRet = nullptr; uno::Reference< XInterface > xFactory; //Decryptor diff --git a/xmlsecurity/source/dialogs/certificatechooser.cxx b/xmlsecurity/source/dialogs/certificatechooser.cxx index 24b13fc35903..8728c6f3a2da 100644 --- a/xmlsecurity/source/dialogs/certificatechooser.cxx +++ b/xmlsecurity/source/dialogs/certificatechooser.cxx @@ -76,7 +76,7 @@ CertificateChooser::CertificateChooser( vcl::Window* _pParent, uno::Reference< u mbInitialized = false; // disable buttons - CertificateHighlightHdl( NULL ); + CertificateHighlightHdl( nullptr ); } CertificateChooser::~CertificateChooser() @@ -184,7 +184,7 @@ void CertificateChooser::ImplInitialize() } // enable/disable buttons - CertificateHighlightHdl( NULL ); + CertificateHighlightHdl( nullptr ); mbInitialized = true; } } diff --git a/xmlsecurity/source/dialogs/certificateviewer.cxx b/xmlsecurity/source/dialogs/certificateviewer.cxx index 4dd2f7c39f42..1d81da24d471 100644 --- a/xmlsecurity/source/dialogs/certificateviewer.cxx +++ b/xmlsecurity/source/dialogs/certificateviewer.cxx @@ -393,7 +393,7 @@ void CertificateViewerCertPathTP::ActivatePage() const Reference< security::XCertificate >* pCertPath = aCertPath.getConstArray(); sal_Int32 i, nCnt = aCertPath.getLength(); - SvTreeListEntry* pParent = NULL; + SvTreeListEntry* pParent = nullptr; for( i = nCnt; i; ) { const Reference< security::XCertificate > rCert = pCertPath[ --i ]; @@ -414,7 +414,7 @@ void CertificateViewerCertPathTP::ActivatePage() pParent = mpCertPathLB->GetParent( pParent ); } - CertSelectHdl( NULL ); + CertSelectHdl( nullptr ); } } diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx index a1e0ce5e2c2a..f1928c838939 100644 --- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx +++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx @@ -96,13 +96,13 @@ void SaveODFItem::Notify( const ::com::sun::star::uno::Sequence< OUString >& ) { else throw uno::RuntimeException( OUString("[xmlsecurity]SaveODFItem::SaveODFItem(): Wrong Type!"), - 0 ); + nullptr ); } else throw uno::RuntimeException( OUString("[xmlsecurity] Could not open property Office.Common/Save/ODF/DefaultVersion"), - 0); + nullptr); } } @@ -713,7 +713,7 @@ void DigitalSignaturesDialog::ImplFillSignaturesBox() m_pSigsOldSignatureImg->Show(bShowOldSignature); m_pSigsOldSignatureFI->Show(bShowOldSignature); - SignatureHighlightHdl( NULL ); + SignatureHighlightHdl( nullptr ); } //If bUseTempStream is true then the temporary signature stream is used. diff --git a/xmlsecurity/source/dialogs/macrosecurity.cxx b/xmlsecurity/source/dialogs/macrosecurity.cxx index cc12147ad0ee..10b911559f34 100644 --- a/xmlsecurity/source/dialogs/macrosecurity.cxx +++ b/xmlsecurity/source/dialogs/macrosecurity.cxx @@ -131,8 +131,8 @@ MacroSecurityLevelTP::MacroSecurityLevelTP(vcl::Window* _pParent, MacroSecurity* mnCurLevel = (sal_uInt16) mpDlg->maSecOptions.GetMacroSecurityLevel(); bool bReadonly = mpDlg->maSecOptions.IsReadOnly( SvtSecurityOptions::E_MACRO_SECLEVEL ); - RadioButton* pCheck = 0; - FixedImage* pImage = 0; + RadioButton* pCheck = nullptr; + FixedImage* pImage = nullptr; switch (mnCurLevel) { case 3: @@ -206,7 +206,7 @@ void MacroSecurityLevelTP::ClosePage() void MacroSecurityTrustedSourcesTP::ImplCheckButtons() { - bool bCertSelected = m_pTrustCertLB->FirstSelected() != NULL; + bool bCertSelected = m_pTrustCertLB->FirstSelected() != nullptr; m_pViewCertPB->Enable( bCertSelected ); m_pRemoveCertPB->Enable( bCertSelected && !mbAuthorsReadonly); diff --git a/xmlsecurity/source/dialogs/resourcemanager.cxx b/xmlsecurity/source/dialogs/resourcemanager.cxx index f6c4ce812c51..c5a1e1382d7e 100644 --- a/xmlsecurity/source/dialogs/resourcemanager.cxx +++ b/xmlsecurity/source/dialogs/resourcemanager.cxx @@ -33,8 +33,8 @@ using namespace std; namespace XmlSec { - static ResMgr* pResMgr = 0; - static SvtSysLocale* pSysLocale = 0; + static ResMgr* pResMgr = nullptr; + static SvtSysLocale* pSysLocale = nullptr; ResMgr* GetResMgr() { @@ -289,7 +289,7 @@ vector< pair< OUString, OUString> > parseDN(const OUString& rRawString) OUString GetContentPart( const OUString& _rRawString ) { - char const * aIDs[] = { "CN", "OU", "O", "E", NULL }; + char const * aIDs[] = { "CN", "OU", "O", "E", nullptr }; OUString retVal; int i = 0; vector< pair< OUString, OUString > > vecAttrValueOfDN = parseDN(_rRawString); diff --git a/xmlsecurity/source/framework/buffernode.cxx b/xmlsecurity/source/framework/buffernode.cxx index 8196f7182f94..2a101d649690 100644 --- a/xmlsecurity/source/framework/buffernode.cxx +++ b/xmlsecurity/source/framework/buffernode.cxx @@ -29,8 +29,8 @@ namespace cssxw = com::sun::star::xml::wrapper; namespace cssxc = com::sun::star::xml::crypto; BufferNode::BufferNode( const cssu::Reference< cssxw::XXMLElementWrapper >& xXMLElement ) - :m_pParent(NULL), - m_pBlocker(NULL), + :m_pParent(nullptr), + m_pBlocker(nullptr), m_bAllReceived(false), m_xXMLElement(xXMLElement) { @@ -173,7 +173,7 @@ void BufferNode::removeElementCollector(const ElementCollector* pElementCollecto if( *ii == pElementCollector ) { m_vElementCollectors.erase( ii ); - const_cast<ElementCollector*>(pElementCollector)->setBufferNode(NULL); + const_cast<ElementCollector*>(pElementCollector)->setBufferNode(nullptr); break; } } @@ -207,10 +207,10 @@ void BufferNode::setBlocker(const ElementMark* pBlocker) * Email: michael.mi@sun.com ******************************************************************************/ { - OSL_ASSERT(!(m_pBlocker != NULL && pBlocker != NULL)); + OSL_ASSERT(!(m_pBlocker != nullptr && pBlocker != nullptr)); m_pBlocker = const_cast<ElementMark*>(pBlocker); - if (m_pBlocker != NULL) + if (m_pBlocker != nullptr) { m_pBlocker->setBufferNode(this); } @@ -355,7 +355,7 @@ const BufferNode* BufferNode::getFirstChild() const * Email: michael.mi@sun.com ******************************************************************************/ { - BufferNode* rc = NULL; + BufferNode* rc = nullptr; if (!m_vChildren.empty()) { @@ -545,9 +545,9 @@ const BufferNode* BufferNode::getNextSibling() const * Email: michael.mi@sun.com ******************************************************************************/ { - BufferNode* rc = NULL; + BufferNode* rc = nullptr; - if (m_pParent != NULL) + if (m_pParent != nullptr) { rc = const_cast<BufferNode*>(m_pParent->getNextChild(this)); } @@ -580,9 +580,9 @@ const BufferNode* BufferNode::isAncestor(const BufferNode* pDescendant) const * Email: michael.mi@sun.com ******************************************************************************/ { - BufferNode* rc = NULL; + BufferNode* rc = nullptr; - if (pDescendant != NULL) + if (pDescendant != nullptr) { std::vector< const BufferNode* >::const_iterator ii = m_vChildren.begin(); @@ -596,7 +596,7 @@ const BufferNode* BufferNode::isAncestor(const BufferNode* pDescendant) const break; } - if (pChild->isAncestor(pDescendant) != NULL) + if (pChild->isAncestor(pDescendant) != nullptr) { rc = pChild; break; @@ -635,7 +635,7 @@ bool BufferNode::isPrevious(const BufferNode* pFollowing) const bool rc = false; BufferNode* pNextBufferNode = const_cast<BufferNode*>(getNextNodeByTreeOrder()); - while (pNextBufferNode != NULL) + while (pNextBufferNode != nullptr) { if (pNextBufferNode == pFollowing) { @@ -696,7 +696,7 @@ const BufferNode* BufferNode::getNextNodeByTreeOrder() const * then return that sibling. */ BufferNode* pNextSibling = const_cast<BufferNode*>(getNextSibling()); - if (pNextSibling != NULL) + if (pNextSibling != nullptr) { return pNextSibling; } @@ -707,23 +707,23 @@ const BufferNode* BufferNode::getNextNodeByTreeOrder() const */ BufferNode* pNode = const_cast<BufferNode*>(this); BufferNode* pParent; - BufferNode* pNextSiblingParent = NULL; + BufferNode* pNextSiblingParent = nullptr; do { - if (pNode == NULL) + if (pNode == nullptr) { break; } pParent = const_cast<BufferNode*>(pNode->getParent()); - if (pParent != NULL) + if (pParent != nullptr) { pNextSiblingParent = const_cast<BufferNode*>(pParent->getNextSibling()); } pNode = pParent; - }while (pNextSiblingParent == NULL); + }while (pNextSiblingParent == nullptr); return pNextSiblingParent; } @@ -949,7 +949,7 @@ bool BufferNode::isECOfBeforeModifyInAncestorIncluded(sal_Int32 nIgnoredSecurity bool rc = false; BufferNode* pParentNode = m_pParent; - while (pParentNode != NULL) + while (pParentNode != nullptr) { if (pParentNode->isECOfBeforeModifyIncluded(nIgnoredSecurityId)) { @@ -1000,7 +1000,7 @@ bool BufferNode::isBlockerInSubTreeIncluded(sal_Int32 nIgnoredSecurityId) const BufferNode* pBufferNode = const_cast<BufferNode*>(*ii); ElementMark* pBlocker = pBufferNode->getBlocker(); - if (pBlocker != NULL && + if (pBlocker != nullptr && (nIgnoredSecurityId == cssxc::sax::ConstOfSecurityId::UNDEFINEDSECURITYID || pBlocker->getSecurityId() != nIgnoredSecurityId )) { @@ -1042,7 +1042,7 @@ const BufferNode* BufferNode::getNextChild(const BufferNode* pChild) const * Email: michael.mi@sun.com ******************************************************************************/ { - BufferNode* rc = NULL; + BufferNode* rc = nullptr; bool bChildFound = false; std::vector< const BufferNode* >::const_iterator ii = m_vChildren.begin(); diff --git a/xmlsecurity/source/framework/elementcollector.cxx b/xmlsecurity/source/framework/elementcollector.cxx index 96c242020e58..c5573012f73d 100644 --- a/xmlsecurity/source/framework/elementcollector.cxx +++ b/xmlsecurity/source/framework/elementcollector.cxx @@ -211,7 +211,7 @@ ElementCollector* ElementCollector::clone( pClonedOne->notifyListener(); } - if (m_pBufferNode != NULL) + if (m_pBufferNode != nullptr) { m_pBufferNode->addElementCollector(pClonedOne); } diff --git a/xmlsecurity/source/framework/elementmark.cxx b/xmlsecurity/source/framework/elementmark.cxx index c87e480fecd9..e0d88d41dcd3 100644 --- a/xmlsecurity/source/framework/elementmark.cxx +++ b/xmlsecurity/source/framework/elementmark.cxx @@ -24,7 +24,7 @@ namespace cssxc = com::sun::star::xml::crypto; ElementMark::ElementMark(sal_Int32 nSecurityId, sal_Int32 nBufferId) - :m_pBufferNode(NULL), + :m_pBufferNode(nullptr), m_nSecurityId(nSecurityId), m_nBufferId(nBufferId), m_type(cssxc::sax::ElementMarkType_ELEMENTMARK) diff --git a/xmlsecurity/source/framework/encryptorimpl.cxx b/xmlsecurity/source/framework/encryptorimpl.cxx index 2bb30f14fa13..52652c95d3ca 100644 --- a/xmlsecurity/source/framework/encryptorimpl.cxx +++ b/xmlsecurity/source/framework/encryptorimpl.cxx @@ -160,7 +160,7 @@ void EncryptorImpl::startEngine( const Reference< Reference < cssxw::XXMLElementWrapper > xResultEncryption = xResultTemplate->getTemplate(); m_xSAXEventKeeper->setElement(m_nIdOfTemplateEC, xResultEncryption); - m_xSAXEventKeeper->setElement(m_nReferenceId, NULL); + m_xSAXEventKeeper->setElement(m_nReferenceId, nullptr); } } diff --git a/xmlsecurity/source/framework/saxeventkeeperimpl.cxx b/xmlsecurity/source/framework/saxeventkeeperimpl.cxx index 69a5ecd9188b..583aeb7cf3ef 100644 --- a/xmlsecurity/source/framework/saxeventkeeperimpl.cxx +++ b/xmlsecurity/source/framework/saxeventkeeperimpl.cxx @@ -37,11 +37,11 @@ namespace cssxs = com::sun::star::xml::sax; #define _USECOMPRESSEDDOCUMENTHANDLER SAXEventKeeperImpl::SAXEventKeeperImpl( ) - :m_pRootBufferNode(NULL), - m_pCurrentBufferNode(NULL), + :m_pRootBufferNode(nullptr), + m_pCurrentBufferNode(nullptr), m_nNextElementMarkId(1), - m_pNewBlocker(NULL), - m_pCurrentBlockingBufferNode(NULL), + m_pNewBlocker(nullptr), + m_pCurrentBlockingBufferNode(nullptr), m_bIsReleasing(false), m_bIsForwarding(false) { @@ -55,19 +55,19 @@ SAXEventKeeperImpl::~SAXEventKeeperImpl() /* * delete the BufferNode tree */ - if (m_pRootBufferNode != NULL) + if (m_pRootBufferNode != nullptr) { m_pRootBufferNode->freeAllChildren(); delete m_pRootBufferNode; } - m_pRootBufferNode = m_pCurrentBufferNode = m_pCurrentBlockingBufferNode = NULL; + m_pRootBufferNode = m_pCurrentBufferNode = m_pCurrentBlockingBufferNode = nullptr; /* * delete all unfreed ElementMarks */ m_vNewElementCollectors.clear(); - m_pNewBlocker = NULL; + m_pNewBlocker = nullptr; std::vector< const ElementMark* >::const_iterator ii = m_vElementMarkBuffers.begin(); for( ; ii != m_vElementMarkBuffers.end(); ++ii ) @@ -114,7 +114,7 @@ void SAXEventKeeperImpl::setCurrentBufferNode(BufferNode* pBufferNode) m_xSAXEventKeeperStatusChangeListener->collectionStatusChanged(sal_True); } - if (pBufferNode->getParent() == NULL) + if (pBufferNode->getParent() == nullptr) { m_pCurrentBufferNode->addChild(pBufferNode); pBufferNode->setParent(m_pCurrentBufferNode); @@ -151,7 +151,7 @@ BufferNode* SAXEventKeeperImpl::addNewElementMarkBuffers() * Email: michael.mi@sun.com ******************************************************************************/ { - BufferNode* pBufferNode = NULL; + BufferNode* pBufferNode = nullptr; if (m_pNewBlocker || !m_vNewElementCollectors.empty() ) { @@ -161,7 +161,7 @@ BufferNode* SAXEventKeeperImpl::addNewElementMarkBuffers() * no new BufferNode is needed to create. * This situation can only happen in the "Forwarding" mode. */ - if ( (m_pCurrentBufferNode != NULL) && + if ( (m_pCurrentBufferNode != nullptr) && (m_xXMLDocument->isCurrent(m_pCurrentBufferNode->getXMLElement()))) { pBufferNode = m_pCurrentBufferNode; @@ -171,7 +171,7 @@ BufferNode* SAXEventKeeperImpl::addNewElementMarkBuffers() pBufferNode = new BufferNode(m_xXMLDocument->getCurrentElement()); } - if (m_pNewBlocker != NULL) + if (m_pNewBlocker != nullptr) { pBufferNode->setBlocker(m_pNewBlocker); @@ -180,7 +180,7 @@ BufferNode* SAXEventKeeperImpl::addNewElementMarkBuffers() * the SAXEventKeeper has entered "blocking" status, during which, no * SAX events will be forwarded to the next document handler. */ - if (m_pCurrentBlockingBufferNode == NULL) + if (m_pCurrentBlockingBufferNode == nullptr) { m_pCurrentBlockingBufferNode = pBufferNode; @@ -190,7 +190,7 @@ BufferNode* SAXEventKeeperImpl::addNewElementMarkBuffers() } } - m_pNewBlocker = NULL; + m_pNewBlocker = nullptr; } if (!m_vNewElementCollectors.empty()) @@ -234,7 +234,7 @@ ElementMark* SAXEventKeeperImpl::findElementMarkBuffer(sal_Int32 nId) const * Email: michael.mi@sun.com ******************************************************************************/ { - ElementMark* pElementMark = NULL; + ElementMark* pElementMark = nullptr; std::vector< const ElementMark* >::const_iterator ii = m_vElementMarkBuffers.begin(); @@ -297,7 +297,7 @@ void SAXEventKeeperImpl::removeElementMarkBuffer(sal_Int32 nId) */ if ((*ii) == m_pNewBlocker) { - m_pNewBlocker = NULL; + m_pNewBlocker = nullptr; } /* @@ -365,7 +365,7 @@ OUString SAXEventKeeperImpl::printBufferNode( rc += " " + m_xXMLDocument->getNodeName(pBufferNode->getXMLElement()); BufferNode* pParent = const_cast<BufferNode*>(pBufferNode->getParent()); - if (pParent != NULL) + if (pParent != nullptr) { rc += "[" + m_xXMLDocument->getNodeName(pParent->getXMLElement()) + "]"; } @@ -373,7 +373,7 @@ OUString SAXEventKeeperImpl::printBufferNode( rc += ":EC=" + pBufferNode->printChildren() + " BR="; ElementMark * pBlocker = pBufferNode->getBlocker(); - if (pBlocker != NULL) + if (pBlocker != nullptr) { rc += OUString::number( pBlocker->getBufferId() ) + "(SecId=" + OUString::number( pBlocker->getSecurityId() ) + ") "; @@ -484,7 +484,7 @@ void SAXEventKeeperImpl::smashBufferNode( */ if (pParent == m_pRootBufferNode) { - bool bIsNotBlocking = (m_pCurrentBlockingBufferNode == NULL); + bool bIsNotBlocking = (m_pCurrentBlockingBufferNode == nullptr); bool bIsBlockInside = false; bool bIsBlockingAfterward = false; @@ -504,7 +504,7 @@ void SAXEventKeeperImpl::smashBufferNode( */ m_xXMLDocument->clearUselessData(m_pRootBufferNode->getXMLElement(), aChildElements, - bIsNotBlocking?(NULL): + bIsNotBlocking?(nullptr): (m_pCurrentBlockingBufferNode->getXMLElement())); /* @@ -524,7 +524,7 @@ void SAXEventKeeperImpl::smashBufferNode( /* * the current blocking BufferNode is a descendant of this BufferNode. */ - bIsBlockInside = (NULL != pBufferNode->isAncestor(m_pCurrentBlockingBufferNode)); + bIsBlockInside = (nullptr != pBufferNode->isAncestor(m_pCurrentBlockingBufferNode)); /* * the current blocking BufferNode locates behind this BufferNode in tree @@ -556,7 +556,7 @@ void SAXEventKeeperImpl::smashBufferNode( m_xXMLDocument->clearUselessData(pBufferNode->getXMLElement(), aChildElements, bIsBlockInside?(m_pCurrentBlockingBufferNode->getXMLElement()): - (NULL)); + (nullptr)); /* * remove the node if it is empty, then if its parent is also @@ -571,7 +571,7 @@ void SAXEventKeeperImpl::smashBufferNode( std::vector< const BufferNode* >* vChildren = pBufferNode->getChildren(); pParent->removeChild(pBufferNode); - pBufferNode->setParent(NULL); + pBufferNode->setParent(nullptr); std::vector< const BufferNode * >::const_iterator ii = vChildren->begin(); for( ; ii != vChildren->end(); ++ii ) @@ -617,15 +617,15 @@ BufferNode* SAXEventKeeperImpl::findNextBlockingBufferNode( * Email: michael.mi@sun.com ******************************************************************************/ { - BufferNode* pNext = NULL; + BufferNode* pNext = nullptr; - if (pStartBufferNode != NULL) + if (pStartBufferNode != nullptr) { pNext = pStartBufferNode; - while (NULL != (pNext = const_cast<BufferNode*>(pNext->getNextNodeByTreeOrder()))) + while (nullptr != (pNext = const_cast<BufferNode*>(pNext->getNextNodeByTreeOrder()))) { - if (pNext->getBlocker() != NULL) + if (pNext->getBlocker() != nullptr) { break; } @@ -704,7 +704,7 @@ void SAXEventKeeperImpl::releaseElementMarkBuffer() ElementMark* pElementMark = findElementMarkBuffer(nId); - if (pElementMark != NULL) + if (pElementMark != nullptr) { if (cssxc::sax::ElementMarkType_ELEMENTCOLLECTOR == pElementMark->getType()) @@ -729,8 +729,8 @@ void SAXEventKeeperImpl::releaseElementMarkBuffer() /* * delete the ElementMark */ - pElementCollector = NULL; - pElementMark = NULL; + pElementCollector = nullptr; + pElementMark = nullptr; removeElementMarkBuffer(nId); /* @@ -748,7 +748,7 @@ void SAXEventKeeperImpl::releaseElementMarkBuffer() * Delete the TH from the buffer node. */ BufferNode *pBufferNode = pElementMark->getBufferNode(); - pBufferNode->setBlocker(NULL); + pBufferNode->setBlocker(nullptr); /* * If there is a following handler and no blocking now, then @@ -771,7 +771,7 @@ void SAXEventKeeperImpl::releaseElementMarkBuffer() BufferNode* pTempCurrentBlockingBufferNode = m_pCurrentBlockingBufferNode; m_pCurrentBufferNode = pBufferNode; - m_pCurrentBlockingBufferNode = NULL; + m_pCurrentBlockingBufferNode = nullptr; m_bIsForwarding = true; @@ -779,18 +779,18 @@ void SAXEventKeeperImpl::releaseElementMarkBuffer() m_xNextHandler, this, pBufferNode->getXMLElement(), - (pTempCurrentBlockingBufferNode == NULL)?NULL:(pTempCurrentBlockingBufferNode->getXMLElement())); + (pTempCurrentBlockingBufferNode == nullptr)?nullptr:(pTempCurrentBlockingBufferNode->getXMLElement())); m_bIsForwarding = false; m_pCurrentBufferNode = pTempCurrentBufferNode; - if (m_pCurrentBlockingBufferNode == NULL) + if (m_pCurrentBlockingBufferNode == nullptr) { m_pCurrentBlockingBufferNode = pTempCurrentBlockingBufferNode; } } - if (m_pCurrentBlockingBufferNode == NULL && + if (m_pCurrentBlockingBufferNode == nullptr && m_xSAXEventKeeperStatusChangeListener.is()) { m_xSAXEventKeeperStatusChangeListener->blockingStatusChanged(sal_False); @@ -800,7 +800,7 @@ void SAXEventKeeperImpl::releaseElementMarkBuffer() /* * delete the ElementMark */ - pElementMark = NULL; + pElementMark = nullptr; removeElementMarkBuffer(nId); /* @@ -937,7 +937,7 @@ sal_Int32 SAXEventKeeperImpl::createBlocker(sal_Int32 nSecurityId) sal_Int32 nId = m_nNextElementMarkId; m_nNextElementMarkId ++; - OSL_ASSERT(m_pNewBlocker == NULL); + OSL_ASSERT(m_pNewBlocker == nullptr); m_pNewBlocker = new ElementMark(nSecurityId, nId); m_vElementMarkBuffers.push_back( m_pNewBlocker ); @@ -953,7 +953,7 @@ sal_Int32 SAL_CALL SAXEventKeeperImpl::addElementCollector( ) cssxc::sax::ConstOfSecurityId::UNDEFINEDSECURITYID, cssxc::sax::ElementMarkPriority_AFTERMODIFY, false, - NULL); + nullptr); } void SAL_CALL SAXEventKeeperImpl::removeElementCollector( sal_Int32 id ) @@ -977,7 +977,7 @@ void SAL_CALL SAXEventKeeperImpl::removeBlocker( sal_Int32 id ) sal_Bool SAL_CALL SAXEventKeeperImpl::isBlocking( ) throw (cssu::RuntimeException, std::exception) { - return (m_pCurrentBlockingBufferNode != NULL); + return (m_pCurrentBlockingBufferNode != nullptr); } cssu::Reference< cssxw::XXMLElementWrapper > SAL_CALL @@ -987,7 +987,7 @@ cssu::Reference< cssxw::XXMLElementWrapper > SAL_CALL cssu::Reference< cssxw::XXMLElementWrapper > rc; ElementMark* pElementMark = findElementMarkBuffer(id); - if (pElementMark != NULL) + if (pElementMark != nullptr) { rc = pElementMark->getBufferNode()->getXMLElement(); } @@ -1006,10 +1006,10 @@ void SAL_CALL SAXEventKeeperImpl::setElement( ElementMark* pElementMark = findElementMarkBuffer(id); - if (pElementMark != NULL) + if (pElementMark != nullptr) { BufferNode* pBufferNode = pElementMark->getBufferNode(); - if (pBufferNode != NULL) + if (pBufferNode != nullptr) { bool bIsCurrent = m_xXMLDocument->isCurrent(pBufferNode->getXMLElement()); pBufferNode->setXMLElement(aElement); @@ -1056,7 +1056,7 @@ cssu::Reference< cssxw::XXMLElementWrapper > SAL_CALL SAXEventKeeperImpl::getCur { cssu::Reference< cssxw::XXMLElementWrapper > rc; - if (m_pCurrentBlockingBufferNode != NULL) + if (m_pCurrentBlockingBufferNode != nullptr) { rc = m_pCurrentBlockingBufferNode->getXMLElement(); } @@ -1074,7 +1074,7 @@ sal_Int32 SAL_CALL SAXEventKeeperImpl::addSecurityElementCollector( cssxc::sax::ConstOfSecurityId::UNDEFINEDSECURITYID, priority, modifyElement, - NULL); + nullptr); } sal_Int32 SAL_CALL SAXEventKeeperImpl::cloneElementCollector( @@ -1085,7 +1085,7 @@ sal_Int32 SAL_CALL SAXEventKeeperImpl::cloneElementCollector( sal_Int32 nId = -1; ElementCollector* pElementCollector = static_cast<ElementCollector*>(findElementMarkBuffer(referenceId)); - if (pElementCollector != NULL) + if (pElementCollector != nullptr) { nId = m_nNextElementMarkId; m_nNextElementMarkId ++; @@ -1102,7 +1102,7 @@ sal_Int32 SAL_CALL SAXEventKeeperImpl::cloneElementCollector( * If the reference EC is still in initial EC array, add * this cloned one into the initial EC array too. */ - if (pElementCollector->getBufferNode() == NULL) + if (pElementCollector->getBufferNode() == nullptr) { m_vNewElementCollectors.push_back(pClonedOne); } @@ -1115,7 +1115,7 @@ void SAL_CALL SAXEventKeeperImpl::setSecurityId( sal_Int32 id, sal_Int32 securit throw (cssu::RuntimeException, std::exception) { ElementMark* pElementMark = findElementMarkBuffer(id); - if (pElementMark != NULL) + if (pElementMark != nullptr) { pElementMark->setSecurityId(securityId); } @@ -1129,7 +1129,7 @@ void SAL_CALL SAXEventKeeperImpl::addReferenceResolvedListener( throw (cssu::RuntimeException, std::exception) { ElementCollector* pElementCollector = static_cast<ElementCollector*>(findElementMarkBuffer(referenceId)); - if (pElementCollector != NULL) + if (pElementCollector != nullptr) { pElementCollector->setReferenceResolvedListener(listener); } @@ -1184,10 +1184,10 @@ void SAL_CALL SAXEventKeeperImpl::startElement( * If there is a following handler and no blocking now, then * forward this event */ - if ((m_pCurrentBlockingBufferNode == NULL) && + if ((m_pCurrentBlockingBufferNode == nullptr) && (m_xNextHandler.is()) && (!m_bIsForwarding) && - (m_pNewBlocker == NULL)) + (m_pNewBlocker == nullptr)) { m_xNextHandler->startElement(aName, xAttribs); } @@ -1215,7 +1215,7 @@ void SAL_CALL SAXEventKeeperImpl::startElement( } BufferNode* pBufferNode = addNewElementMarkBuffers(); - if (pBufferNode != NULL) + if (pBufferNode != nullptr) { setCurrentBufferNode(pBufferNode); } @@ -1230,14 +1230,14 @@ void SAL_CALL SAXEventKeeperImpl::endElement( const OUString& aName ) * If there is a following handler and no blocking now, then * forward this event */ - if ((m_pCurrentBlockingBufferNode == NULL) && + if ((m_pCurrentBlockingBufferNode == nullptr) && (m_xNextHandler.is()) && (!m_bIsForwarding)) { m_xNextHandler->endElement(aName); } - if ((m_pCurrentBlockingBufferNode != NULL) || + if ((m_pCurrentBlockingBufferNode != nullptr) || (m_pCurrentBufferNode != m_pRootBufferNode) || (!m_xXMLDocument->isCurrentElementEmpty())) { @@ -1283,12 +1283,12 @@ void SAL_CALL SAXEventKeeperImpl::characters( const OUString& aChars ) { if (!m_bIsForwarding) { - if ((m_pCurrentBlockingBufferNode == NULL) && m_xNextHandler.is()) + if ((m_pCurrentBlockingBufferNode == nullptr) && m_xNextHandler.is()) { m_xNextHandler->characters(aChars); } - if ((m_pCurrentBlockingBufferNode != NULL) || + if ((m_pCurrentBlockingBufferNode != nullptr) || (m_pCurrentBufferNode != m_pRootBufferNode)) { #ifndef _USECOMPRESSEDDOCUMENTHANDLER @@ -1312,12 +1312,12 @@ void SAL_CALL SAXEventKeeperImpl::processingInstruction( { if (!m_bIsForwarding) { - if ((m_pCurrentBlockingBufferNode == NULL) && m_xNextHandler.is()) + if ((m_pCurrentBlockingBufferNode == nullptr) && m_xNextHandler.is()) { m_xNextHandler->processingInstruction(aTarget, aData); } - if ((m_pCurrentBlockingBufferNode != NULL) || + if ((m_pCurrentBlockingBufferNode != nullptr) || (m_pCurrentBufferNode != m_pRootBufferNode)) { #ifndef _USECOMPRESSEDDOCUMENTHANDLER diff --git a/xmlsecurity/source/framework/securityengine.cxx b/xmlsecurity/source/framework/securityengine.cxx index 84a3e637b54d..10af4918b5e3 100644 --- a/xmlsecurity/source/framework/securityengine.cxx +++ b/xmlsecurity/source/framework/securityengine.cxx @@ -64,8 +64,8 @@ sal_Bool SAL_CALL SecurityEngine::endMission( ) m_bMissionDone = true; } - m_xResultListener = NULL; - m_xSAXEventKeeper = NULL; + m_xResultListener = nullptr; + m_xSAXEventKeeper = nullptr; return rc; } diff --git a/xmlsecurity/source/framework/xmlencryptiontemplateimpl.cxx b/xmlsecurity/source/framework/xmlencryptiontemplateimpl.cxx index ecbbddc54808..b5cd81f523df 100644 --- a/xmlsecurity/source/framework/xmlencryptiontemplateimpl.cxx +++ b/xmlsecurity/source/framework/xmlencryptiontemplateimpl.cxx @@ -29,8 +29,8 @@ using ::com::sun::star::xml::wrapper::XXMLElementWrapper ; using ::com::sun::star::xml::crypto::XXMLEncryptionTemplate ; XMLEncryptionTemplateImpl::XMLEncryptionTemplateImpl( const Reference< XMultiServiceFactory >& aFactory ) - : m_xTemplate( NULL ), - m_xTarget( NULL ), + : m_xTemplate( nullptr ), + m_xTarget( nullptr ), m_xServiceManager( aFactory ), m_nStatus ( ::com::sun::star::xml::crypto::SecurityOperationStatus_UNKNOWN ) { } diff --git a/xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx b/xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx index 00e1fe167fc0..b7dac4045121 100644 --- a/xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx +++ b/xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx @@ -30,7 +30,7 @@ using ::com::sun::star::xml::wrapper::XXMLElementWrapper ; using ::com::sun::star::xml::crypto::XXMLSignatureTemplate ; XMLSignatureTemplateImpl::XMLSignatureTemplateImpl( const Reference< XMultiServiceFactory >& aFactory ) - :m_xTemplate( NULL ), + :m_xTemplate( nullptr ), m_xServiceManager( aFactory ), m_nStatus ( ::com::sun::star::xml::crypto::SecurityOperationStatus_UNKNOWN ) { diff --git a/xmlsecurity/source/framework/xsec_framework.cxx b/xmlsecurity/source/framework/xsec_framework.cxx index c20886dba590..c16170c110d0 100644 --- a/xmlsecurity/source/framework/xsec_framework.cxx +++ b/xmlsecurity/source/framework/xsec_framework.cxx @@ -40,7 +40,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL xsec_fw_component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) { - void * pRet = 0; + void * pRet = nullptr; //Decryptor OUString implName = OUString::createFromAscii( pImplName ); diff --git a/xmlsecurity/source/helper/documentsignaturehelper.cxx b/xmlsecurity/source/helper/documentsignaturehelper.cxx index faca8c83170b..3b44a40e6ff1 100644 --- a/xmlsecurity/source/helper/documentsignaturehelper.cxx +++ b/xmlsecurity/source/helper/documentsignaturehelper.cxx @@ -98,7 +98,7 @@ void ImplFillElementList( pNames[n], rtl_UriCharClassRelSegment, rtl_UriEncodeStrict, RTL_TEXTENCODING_UTF8); if (sEncName.isEmpty() && !pNames[n].isEmpty()) - throw css::uno::RuntimeException("Failed to encode element name of XStorage", 0); + throw css::uno::RuntimeException("Failed to encode element name of XStorage", nullptr); if ( rxStore->isStreamElement( pNames[n] ) ) { diff --git a/xmlsecurity/source/helper/xmlsignaturehelper.cxx b/xmlsecurity/source/helper/xmlsignaturehelper.cxx index a91604065ff8..496d1b5ea800 100644 --- a/xmlsecurity/source/helper/xmlsignaturehelper.cxx +++ b/xmlsecurity/source/helper/xmlsignaturehelper.cxx @@ -282,7 +282,7 @@ bool XMLSignatureHelper::ReadAndVerifySignature( const com::sun::star::uno::Refe /* * clear up the connection */ - pSignatureListener->setNextHandler( NULL ); + pSignatureListener->setNextHandler( nullptr ); /* * clear up the signature verify listener diff --git a/xmlsecurity/source/helper/xmlsignaturehelper2.cxx b/xmlsecurity/source/helper/xmlsignaturehelper2.cxx index eb0a49a119ee..40407d586a06 100644 --- a/xmlsecurity/source/helper/xmlsignaturehelper2.cxx +++ b/xmlsecurity/source/helper/xmlsignaturehelper2.cxx @@ -192,7 +192,7 @@ uno::Reference < io::XInputStream > UriBindingHelper::OpenInputStream( const uno const OUString sName = ::rtl::Uri::decode( rURI, rtl_UriDecodeStrict, rtl_UriCharClassRelSegment); if (sName.isEmpty() && !rURI.isEmpty()) - throw uno::Exception("Could not decode URI for stream element.", 0); + throw uno::Exception("Could not decode URI for stream element.", nullptr); uno::Reference< io::XStream > xStream; xStream = rxStore->cloneStreamElement( sName ); @@ -205,7 +205,7 @@ uno::Reference < io::XInputStream > UriBindingHelper::OpenInputStream( const uno const OUString aStoreName = ::rtl::Uri::decode( rURI.copy( 0, nSepPos ), rtl_UriDecodeStrict, rtl_UriCharClassRelSegment); if (aStoreName.isEmpty() && !rURI.isEmpty()) - throw uno::Exception("Could not decode URI for stream element.", 0); + throw uno::Exception("Could not decode URI for stream element.", nullptr); OUString aElement = rURI.copy( nSepPos+1 ); uno::Reference < embed::XStorage > xSubStore = rxStore->openStorageElement( aStoreName, embed::ElementModes::READ ); diff --git a/xmlsecurity/source/helper/xsecctl.cxx b/xmlsecurity/source/helper/xsecctl.cxx index c025632008d8..3a77b1372051 100644 --- a/xmlsecurity/source/helper/xsecctl.cxx +++ b/xmlsecurity/source/helper/xsecctl.cxx @@ -54,8 +54,8 @@ XSecController::XSecController( const cssu::Reference<cssu::XComponentContext>& , m_bIsBlocking(false) , m_nStatusOfSecurityComponents(UNINITIALIZED) , m_bIsSAXEventKeeperSticky(false) - , m_pErrorMessage(NULL) - , m_pXSecParser(NULL) + , m_pErrorMessage(nullptr) + , m_pXSecParser(nullptr) , m_nReservedSignatureId(0) , m_bVerifyCurrentSignature(false) { @@ -142,9 +142,9 @@ void XSecController::createXSecComponent( ) * marks all security components are not available. */ m_nStatusOfSecurityComponents = FAILTOINITIALIZED; - m_xXMLSignature = NULL; - m_xXMLDocumentWrapper = NULL; - m_xSAXEventKeeper = NULL; + m_xXMLSignature = nullptr; + m_xXMLDocumentWrapper = nullptr; + m_xSAXEventKeeper = nullptr; cssu::Reference< cssl::XMultiComponentFactory > xMCF( mxCtx->getServiceManager() ); @@ -259,7 +259,7 @@ bool XSecController::chainOn( bool bRetrievingLastEvent ) * to make sure no SAX event is forwarded during the connecting * phase. */ - m_xSAXEventKeeper->setNextHandler( NULL ); + m_xSAXEventKeeper->setNextHandler( nullptr ); cssu::Reference< cssxs::XDocumentHandler > xSEKHandler(m_xSAXEventKeeper, cssu::UNO_QUERY); @@ -341,7 +341,7 @@ void XSecController::chainOff() { if (m_bIsSAXEventKeeperConnected) { - m_xSAXEventKeeper->setNextHandler( NULL ); + m_xSAXEventKeeper->setNextHandler( nullptr ); if ( m_xPreviousNodeOnSAXChain.is() ) { @@ -529,7 +529,7 @@ void XSecController::startMission( m_nStatusOfSecurityComponents = UNINITIALIZED; m_xSecurityContext = xSecurityContext; - m_pErrorMessage = NULL; + m_pErrorMessage = nullptr; m_vInternalSignatureInformations.clear(); @@ -613,9 +613,9 @@ void XSecController::clearSAXChainConnector() chainOff(); - m_xPreviousNodeOnSAXChain = NULL; - m_xNextNodeOnSAXChain = NULL; - m_xElementStackKeeper = NULL; + m_xPreviousNodeOnSAXChain = nullptr; + m_xNextNodeOnSAXChain = nullptr; + m_xElementStackKeeper = nullptr; } void XSecController::endMission() @@ -661,8 +661,8 @@ void XSecController::endMission() } } - m_xUriBinding = NULL; - m_xSecurityContext = NULL; + m_xUriBinding = nullptr; + m_xSecurityContext = nullptr; /* * free the status change listener reference to this object @@ -672,7 +672,7 @@ void XSecController::endMission() cssu::Reference<cssxc::sax::XSAXEventKeeperStatusChangeBroadcaster> xSAXEventKeeperStatusChangeBroadcaster(m_xSAXEventKeeper, cssu::UNO_QUERY); xSAXEventKeeperStatusChangeBroadcaster - ->addSAXEventKeeperStatusChangeListener( NULL ); + ->addSAXEventKeeperStatusChangeListener( nullptr ); } } diff --git a/xmlsecurity/source/helper/xsecparser.cxx b/xmlsecurity/source/helper/xsecparser.cxx index 750713fc1467..e429535b1ddd 100644 --- a/xmlsecurity/source/helper/xsecparser.cxx +++ b/xmlsecurity/source/helper/xsecparser.cxx @@ -45,7 +45,7 @@ OUString XSecParser::getIdAttr(const cssu::Reference< cssxs::XAttributeList >& x { OUString ouIdAttr = xAttribs->getValueByName("id"); - if (ouIdAttr == NULL) + if (ouIdAttr == nullptr) { ouIdAttr = xAttribs->getValueByName("Id"); } @@ -89,7 +89,7 @@ void SAL_CALL XSecParser::startElement( try { OUString ouIdAttr = getIdAttr(xAttribs); - if (ouIdAttr != NULL) + if (ouIdAttr != nullptr) { m_pXSecController->collectToVerify( ouIdAttr ); } @@ -97,7 +97,7 @@ void SAL_CALL XSecParser::startElement( if ( aName == TAG_SIGNATURE ) { m_pXSecController->addSignature(); - if (ouIdAttr != NULL) + if (ouIdAttr != nullptr) { m_pXSecController->setId( ouIdAttr ); } @@ -105,7 +105,7 @@ void SAL_CALL XSecParser::startElement( else if ( aName == TAG_REFERENCE ) { OUString ouUri = xAttribs->getValueByName(ATTR_URI); - DBG_ASSERT( ouUri != NULL, "URI == NULL" ); + DBG_ASSERT( ouUri != nullptr, "URI == NULL" ); if (ouUri.startsWith(CHAR_FRAGMENT)) { @@ -129,7 +129,7 @@ void SAL_CALL XSecParser::startElement( { OUString ouAlgorithm = xAttribs->getValueByName(ATTR_ALGORITHM); - if (ouAlgorithm != NULL && ouAlgorithm == ALGO_C14N) + if (ouAlgorithm != nullptr && ouAlgorithm == ALGO_C14N) /* * a xml stream */ @@ -166,7 +166,7 @@ void SAL_CALL XSecParser::startElement( } else if ( aName == TAG_SIGNATUREPROPERTY ) { - if (ouIdAttr != NULL) + if (ouIdAttr != nullptr) { m_pXSecController->setPropertyId( ouIdAttr ); } @@ -187,12 +187,12 @@ void SAL_CALL XSecParser::startElement( cssu::Any exc = cppu::getCaughtException(); throw cssxs::SAXException( "xmlsecurity: Exception in XSecParser::startElement", - 0, exc); + nullptr, exc); } catch (...) { throw cssxs::SAXException( - "xmlsecurity: unexpected exception in XSecParser::startElement", 0, + "xmlsecurity: unexpected exception in XSecParser::startElement", nullptr, cssu::Any()); } } @@ -259,12 +259,12 @@ void SAL_CALL XSecParser::endElement( const OUString& aName ) cssu::Any exc = cppu::getCaughtException(); throw cssxs::SAXException( "xmlsecurity: Exception in XSecParser::endElement", - 0, exc); + nullptr, exc); } catch (...) { throw cssxs::SAXException( - "xmlsecurity: unexpected exception in XSecParser::endElement", 0, + "xmlsecurity: unexpected exception in XSecParser::endElement", nullptr, cssu::Any()); } } diff --git a/xmlsecurity/source/helper/xsecsign.cxx b/xmlsecurity/source/helper/xsecsign.cxx index c1a7b091e122..42af9d0460fe 100644 --- a/xmlsecurity/source/helper/xsecsign.cxx +++ b/xmlsecurity/source/helper/xsecsign.cxx @@ -44,7 +44,7 @@ namespace cssxs = com::sun::star::xml::sax; OUString XSecController::createId() { sal_uInt8 aSeq[16]; - rtl_createUuid( aSeq, 0, true ); + rtl_createUuid( aSeq, nullptr, true ); char str[68]="ID_"; int length = 3; @@ -190,7 +190,7 @@ void XSecController::signAStream( sal_Int32 securityId, const OUString& uri, con if (index == -1) { - InternalSignatureInformation isi(securityId, NULL); + InternalSignatureInformation isi(securityId, nullptr); isi.addReference(type, uri, -1); m_vInternalSignatureInformations.push_back( isi ); } @@ -220,7 +220,7 @@ void XSecController::setX509Certificate( if ( index == -1 ) { - InternalSignatureInformation isi(nSecurityId, NULL); + InternalSignatureInformation isi(nSecurityId, nullptr); isi.signatureInfor.nSecurityEnvironmentIndex = nSecurityEnvironmentIndex; isi.signatureInfor.ouX509IssuerName = ouX509IssuerName; isi.signatureInfor.ouX509SerialNumber = ouX509SerialNumber; @@ -246,7 +246,7 @@ void XSecController::setDate( if ( index == -1 ) { - InternalSignatureInformation isi(nSecurityId, NULL); + InternalSignatureInformation isi(nSecurityId, nullptr); isi.signatureInfor.stDateTime = rDateTime; m_vInternalSignatureInformations.push_back( isi ); } @@ -320,7 +320,7 @@ bool XSecController::WriteSignature( m_pErrorMessage = ERROR_EXCEPTIONDURINGCREATION; } - m_xSAXEventKeeper->setNextHandler( NULL ); + m_xSAXEventKeeper->setNextHandler( nullptr ); m_bIsSAXEventKeeperSticky = false; } else diff --git a/xmlsecurity/source/helper/xsecverify.cxx b/xmlsecurity/source/helper/xsecverify.cxx index 325279f5da95..2ebd27d74d26 100644 --- a/xmlsecurity/source/helper/xsecverify.cxx +++ b/xmlsecurity/source/helper/xsecverify.cxx @@ -45,7 +45,7 @@ cssu::Reference< cssxc::sax::XReferenceResolvedListener > XSecController::prepar { if ( m_nStatusOfSecurityComponents != INITIALIZED ) { - return NULL; + return nullptr; } sal_Int32 nIdOfSignatureElementCollector; @@ -95,7 +95,7 @@ cssu::Reference< cssxc::sax::XReferenceResolvedListener > XSecController::prepar void XSecController::addSignature() { - cssu::Reference< cssxc::sax::XReferenceResolvedListener > xReferenceResolvedListener = NULL; + cssu::Reference< cssxc::sax::XReferenceResolvedListener > xReferenceResolvedListener = nullptr; sal_Int32 nSignatureId = 0; @@ -295,7 +295,7 @@ void XSecController::collectToVerify( const OUString& referenceId ) */ { bool bJustChainingOn = false; - cssu::Reference< cssxs::XDocumentHandler > xHandler = NULL; + cssu::Reference< cssxs::XDocumentHandler > xHandler = nullptr; int i,j; int sigNum = m_vInternalSignatureInformations.size(); @@ -315,7 +315,7 @@ void XSecController::collectToVerify( const OUString& referenceId ) if (chainOn(false)) { bJustChainingOn = true; - xHandler = m_xSAXEventKeeper->setNextHandler(NULL); + xHandler = m_xSAXEventKeeper->setNextHandler(nullptr); } sal_Int32 nKeeperId = m_xSAXEventKeeper->addSecurityElementCollector( @@ -352,7 +352,7 @@ void XSecController::collectToVerify( const OUString& referenceId ) void XSecController::addSignature( sal_Int32 nSignatureId ) { - DBG_ASSERT( m_pXSecParser != NULL, "No XSecParser initialized" ); + DBG_ASSERT( m_pXSecParser != nullptr, "No XSecParser initialized" ); m_nReservedSignatureId = nSignatureId; m_bVerifyCurrentSignature = true; @@ -360,10 +360,10 @@ void XSecController::addSignature( sal_Int32 nSignatureId ) cssu::Reference< cssxs::XDocumentHandler > XSecController::createSignatureReader() { - m_pXSecParser = new XSecParser( this, NULL ); + m_pXSecParser = new XSecParser( this, nullptr ); cssu::Reference< cssl::XInitialization > xInitialization = m_pXSecParser; - setSAXChainConnector(xInitialization, NULL, NULL); + setSAXChainConnector(xInitialization, nullptr, nullptr); return m_pXSecParser; } @@ -371,7 +371,7 @@ cssu::Reference< cssxs::XDocumentHandler > XSecController::createSignatureReader void XSecController::releaseSignatureReader() { clearSAXChainConnector( ); - m_pXSecParser = NULL; + m_pXSecParser = nullptr; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlsecurity/source/xmlsec/biginteger.cxx b/xmlsecurity/source/xmlsec/biginteger.cxx index e79bc51577ef..3c33ea8a36b0 100644 --- a/xmlsecurity/source/xmlsec/biginteger.cxx +++ b/xmlsecurity/source/xmlsec/biginteger.cxx @@ -27,7 +27,7 @@ using namespace ::com::sun::star::uno ; Sequence< sal_Int8 > numericStringToBigInteger ( const OUString& numeral ) { - if( numeral.getStr() != NULL ) + if( numeral.getStr() != nullptr ) { xmlChar* chNumeral ; const xmlSecByte* bnInteger ; @@ -58,7 +58,7 @@ Sequence< sal_Int8 > numericStringToBigInteger ( const OUString& numeral ) } bnInteger = xmlSecBnGetData( &bn ) ; - if( bnInteger == NULL ) { + if( bnInteger == nullptr ) { xmlSecBnFinalize( &bn ) ; return Sequence< sal_Int8 >(); } @@ -93,7 +93,7 @@ OUString bigIntegerToNumericString ( const Sequence< sal_Int8 >& integer ) } chNumeral = xmlSecBnToDecString( &bn ) ; - if( chNumeral == NULL ) { + if( chNumeral == nullptr ) { xmlSecBnFinalize( &bn ) ; return aRet ; } diff --git a/xmlsecurity/source/xmlsec/certificateextension_xmlsecimpl.cxx b/xmlsecurity/source/xmlsec/certificateextension_xmlsecimpl.cxx index b3aa81915929..93f25448ba79 100644 --- a/xmlsecurity/source/xmlsec/certificateextension_xmlsecimpl.cxx +++ b/xmlsecurity/source/xmlsec/certificateextension_xmlsecimpl.cxx @@ -52,7 +52,7 @@ sal_Bool SAL_CALL CertificateExtension_XmlSecImpl::isCritical() throw( ::com::su void CertificateExtension_XmlSecImpl::setCertExtn( unsigned char* value, unsigned int vlen, unsigned char* id, unsigned int idlen, bool critical ) { unsigned int i ; - if( value != NULL && vlen != 0 ) { + if( value != nullptr && vlen != 0 ) { Sequence< sal_Int8 > extnv( vlen ) ; for( i = 0; i < vlen ; i ++ ) extnv[i] = *( value + i ) ; @@ -62,7 +62,7 @@ void CertificateExtension_XmlSecImpl::setCertExtn( unsigned char* value, unsigne m_xExtnValue = Sequence<sal_Int8>(); } - if( id != NULL && idlen != 0 ) { + if( id != nullptr && idlen != 0 ) { Sequence< sal_Int8 > extnId( idlen ) ; for( i = 0; i < idlen ; i ++ ) extnId[i] = *( id + i ) ; diff --git a/xmlsecurity/source/xmlsec/errorcallback.cxx b/xmlsecurity/source/xmlsec/errorcallback.cxx index b2dcf6a6df12..abf04751667a 100644 --- a/xmlsecurity/source/xmlsec/errorcallback.cxx +++ b/xmlsecurity/source/xmlsec/errorcallback.cxx @@ -53,7 +53,7 @@ void setErrorRecorder() void clearErrorRecorder() { - xmlSecErrorsSetCallback(NULL); + xmlSecErrorsSetCallback(nullptr); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlsecurity/source/xmlsec/nss/ciphercontext.cxx b/xmlsecurity/source/xmlsec/nss/ciphercontext.cxx index 807fe786a12a..6d9d40ade222 100644 --- a/xmlsecurity/source/xmlsec/nss/ciphercontext.cxx +++ b/xmlsecurity/source/xmlsec/nss/ciphercontext.cxx @@ -31,11 +31,11 @@ uno::Reference< xml::crypto::XCipherContext > OCipherContext::Create( CK_MECHANI { ::rtl::Reference< OCipherContext > xResult = new OCipherContext; - xResult->m_pSlot = PK11_GetBestSlot( nNSSCipherID, NULL ); + xResult->m_pSlot = PK11_GetBestSlot( nNSSCipherID, nullptr ); if ( xResult->m_pSlot ) { SECItem aKeyItem = { siBuffer, const_cast< unsigned char* >( reinterpret_cast< const unsigned char* >( aKey.getConstArray() ) ), sal::static_int_cast<unsigned>( aKey.getLength() ) }; - xResult->m_pSymKey = PK11_ImportSymKey( xResult->m_pSlot, nNSSCipherID, PK11_OriginDerive, bEncryption ? CKA_ENCRYPT : CKA_DECRYPT, &aKeyItem, NULL ); + xResult->m_pSymKey = PK11_ImportSymKey( xResult->m_pSlot, nNSSCipherID, PK11_OriginDerive, bEncryption ? CKA_ENCRYPT : CKA_DECRYPT, &aKeyItem, nullptr ); if ( xResult->m_pSymKey ) { SECItem aIVItem = { siBuffer, const_cast< unsigned char* >( reinterpret_cast< const unsigned char* >( aInitializationVector.getConstArray() ) ), sal::static_int_cast<unsigned>( aInitializationVector.getLength() ) }; @@ -66,25 +66,25 @@ void OCipherContext::Dispose() if ( m_pContext ) { PK11_DestroyContext( m_pContext, PR_TRUE ); - m_pContext = NULL; + m_pContext = nullptr; } if ( m_pSecParam ) { SECITEM_FreeItem( m_pSecParam, PR_TRUE ); - m_pSecParam = NULL; + m_pSecParam = nullptr; } if ( m_pSymKey ) { PK11_FreeSymKey( m_pSymKey ); - m_pSymKey = NULL; + m_pSymKey = nullptr; } if ( m_pSlot ) { PK11_FreeSlot( m_pSlot ); - m_pSlot = NULL; + m_pSlot = nullptr; } m_bDisposed = true; diff --git a/xmlsecurity/source/xmlsec/nss/ciphercontext.hxx b/xmlsecurity/source/xmlsec/nss/ciphercontext.hxx index 7d9c613ae056..3dd190778e38 100644 --- a/xmlsecurity/source/xmlsec/nss/ciphercontext.hxx +++ b/xmlsecurity/source/xmlsec/nss/ciphercontext.hxx @@ -50,10 +50,10 @@ private: void Dispose(); OCipherContext() - : m_pSlot( NULL ) - , m_pSymKey( NULL ) - , m_pSecParam( NULL ) - , m_pContext( NULL ) + : m_pSlot( nullptr ) + , m_pSymKey( nullptr ) + , m_pSecParam( nullptr ) + , m_pContext( nullptr ) , m_nBlockSize( 0 ) , m_bEncryption( false ) , m_bPadding( false ) diff --git a/xmlsecurity/source/xmlsec/nss/digestcontext.cxx b/xmlsecurity/source/xmlsec/nss/digestcontext.cxx index 0dec799a0380..86f8c77b6f63 100644 --- a/xmlsecurity/source/xmlsec/nss/digestcontext.cxx +++ b/xmlsecurity/source/xmlsec/nss/digestcontext.cxx @@ -28,7 +28,7 @@ ODigestContext::~ODigestContext() if ( m_pContext ) { PK11_DestroyContext( m_pContext, PR_TRUE ); - m_pContext = NULL; + m_pContext = nullptr; } } @@ -52,7 +52,7 @@ void SAL_CALL ODigestContext::updateDigest( const uno::Sequence< ::sal_Int8 >& a if ( PK11_DigestOp( m_pContext, reinterpret_cast< const unsigned char* >( aToDigest.getConstArray() ), aToDigest.getLength() ) != SECSuccess ) { PK11_DestroyContext( m_pContext, PR_TRUE ); - m_pContext = NULL; + m_pContext = nullptr; m_bBroken = true; throw uno::RuntimeException(); } @@ -77,13 +77,13 @@ uno::Sequence< ::sal_Int8 > SAL_CALL ODigestContext::finalizeDigestAndDispose() if ( PK11_DigestFinal( m_pContext, reinterpret_cast< unsigned char* >( aResult.getArray() ), &nResultLen, aResult.getLength() ) != SECSuccess ) { PK11_DestroyContext( m_pContext, PR_TRUE ); - m_pContext = NULL; + m_pContext = nullptr; m_bBroken = true; throw uno::RuntimeException(); } PK11_DestroyContext( m_pContext, PR_TRUE ); - m_pContext = NULL; + m_pContext = nullptr; m_bDisposed = true; aResult.realloc( nResultLen ); diff --git a/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx b/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx index 71a3b870ea9b..dff7cd7a1a4c 100644 --- a/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx +++ b/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx @@ -106,7 +106,7 @@ struct GetNSSInitStaticMutex void deleteRootsModule() { - SECMODModule *RootsModule = 0; + SECMODModule *RootsModule = nullptr; SECMODModuleList *list = SECMOD_GetDefaultModuleList(); SECMODListLock *lock = SECMOD_GetDefaultModuleListLock(); SECMOD_GetReadLock(lock); @@ -145,7 +145,7 @@ void deleteRootsModule() SAL_INFO("xmlsecurity.xmlsec", "Failed to delete \"" << RootsModule->commonName << "\": " << RootsModule->dllName); } SECMOD_DestroyModule(RootsModule); - RootsModule = 0; + RootsModule = nullptr; } } @@ -275,7 +275,7 @@ bool nsscrypto_initialize( const css::uno::Reference< css::uno::XComponentContex if( sCertDir.isEmpty() || !bSuccess ) { SAL_INFO("xmlsecurity.xmlsec", "Initializing NSS without profile."); - if ( NSS_NoDB_Init(NULL) != SECSuccess ) + if ( NSS_NoDB_Init(nullptr) != SECSuccess ) { SAL_INFO("xmlsecurity.xmlsec", "Initializing NSS without profile failed."); int errlen = PR_GetErrorTextLength(); @@ -313,7 +313,7 @@ bool nsscrypto_initialize( const css::uno::Reference< css::uno::XComponentContex SECMODModule * RootsModule = SECMOD_LoadUserModule( const_cast<char*>(aStr.getStr()), - 0, // no parent + nullptr, // no parent PR_FALSE); // do not recurse if (RootsModule) @@ -322,7 +322,7 @@ bool nsscrypto_initialize( const css::uno::Reference< css::uno::XComponentContex bool found = RootsModule->loaded; SECMOD_DestroyModule(RootsModule); - RootsModule = 0; + RootsModule = nullptr; if (found) SAL_INFO("xmlsecurity.xmlsec", "Added new root certificate module " ROOT_CERTS " contained in " << ospath); else diff --git a/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx index e45f7f813f4c..1815770ad77a 100644 --- a/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx @@ -70,7 +70,7 @@ namespace { CERTGeneralName *first; first = names; - if (names != NULL) { + if (names != nullptr) { do { length++; names = CERT_GetNextGeneralName(names); diff --git a/xmlsecurity/source/xmlsec/nss/secerror.cxx b/xmlsecurity/source/xmlsec/nss/secerror.cxx index ea82265bd8d4..24955bb2ccf3 100644 --- a/xmlsecurity/source/xmlsec/nss/secerror.cxx +++ b/xmlsecurity/source/xmlsec/nss/secerror.cxx @@ -64,7 +64,7 @@ void printChainFailure(CERTVerifyLog *log) { unsigned int depth = (unsigned int)-1; - CERTVerifyLogNode *node = NULL; + CERTVerifyLogNode *node = nullptr; if (log->count > 0) { @@ -81,8 +81,8 @@ printChainFailure(CERTVerifyLog *log) } SAL_INFO("xmlsecurity.xmlsec", " ERROR " << node->error << ": " << getCertError(node->error)); - const char * specificError = NULL; - const char * issuer = NULL; + const char * specificError = nullptr; + const char * issuer = nullptr; switch (node->error) { case SEC_ERROR_INADEQUATE_KEY_USAGE: diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx index f9c3e72bdd69..ff08ce67c1ba 100644 --- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx @@ -67,7 +67,7 @@ struct UsageDescription UsageDescription() : usage( certificateUsageCheckAllUsages ) - , description( NULL ) + , description( nullptr ) {} UsageDescription( SECCertificateUsage i_usage, char const* i_description ) @@ -82,7 +82,7 @@ char* GetPasswordFunction( PK11SlotInfo* pSlot, PRBool bRetry, void* /*arg*/ ) { uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); uno::Reference < task::XInteractionHandler2 > xInteractionHandler( - task::InteractionHandler::createWithParent(xContext, 0) ); + task::InteractionHandler::createWithParent(xContext, nullptr) ); task::PasswordRequestMode eMode = bRetry ? task::PasswordRequestMode_PASSWORD_REENTER : task::PasswordRequestMode_PASSWORD_ENTER; ::comphelper::DocPasswordRequest* pPasswordRequest = new ::comphelper::DocPasswordRequest( @@ -102,18 +102,18 @@ char* GetPasswordFunction( PK11SlotInfo* pSlot, PRBool bRetry, void* /*arg*/ ) memcpy( pPassword, aPassword.getStr(), nLen ); return pPassword; } - return NULL; + return nullptr; } SecurityEnvironment_NssImpl::SecurityEnvironment_NssImpl() : -m_pHandler( NULL ) , m_tSymKeyList() , m_tPubKeyList() , m_tPriKeyList() { +m_pHandler( nullptr ) , m_tSymKeyList() , m_tPubKeyList() , m_tPriKeyList() { PK11_SetPasswordFunc( GetPasswordFunction ) ; } SecurityEnvironment_NssImpl::~SecurityEnvironment_NssImpl() { - PK11_SetPasswordFunc( NULL ) ; + PK11_SetPasswordFunc( nullptr ) ; for (CIT_SLOTS i = m_Slots.begin(); i != m_Slots.end(); i++) { @@ -234,7 +234,7 @@ void SecurityEnvironment_NssImpl::setCertDb( CERTCertDBHandle* aCertDb ) throw( void SecurityEnvironment_NssImpl::adoptSymKey( PK11SymKey* aSymKey ) throw( Exception , RuntimeException ) { std::list< PK11SymKey* >::iterator keyIt ; - if( aSymKey != NULL ) { + if( aSymKey != nullptr ) { //First try to find the key in the list for( keyIt = m_tSymKeyList.begin() ; keyIt != m_tSymKeyList.end() ; ++keyIt ) { if( *keyIt == aSymKey ) @@ -243,7 +243,7 @@ void SecurityEnvironment_NssImpl::adoptSymKey( PK11SymKey* aSymKey ) throw( Exce //If we do not find the key in the list, add a new node PK11SymKey* symkey = PK11_ReferenceSymKey( aSymKey ) ; - if( symkey == NULL ) + if( symkey == nullptr ) throw RuntimeException() ; try { @@ -259,7 +259,7 @@ PK11SymKey* SecurityEnvironment_NssImpl::getSymKey( unsigned int position ) thro std::list< PK11SymKey* >::iterator keyIt ; unsigned int pos ; - symkey = NULL ; + symkey = nullptr ; for( pos = 0, keyIt = m_tSymKeyList.begin() ; pos < position && keyIt != m_tSymKeyList.end() ; pos ++ , ++keyIt ) ; if( pos == position && keyIt != m_tSymKeyList.end() ) @@ -273,7 +273,7 @@ SECKEYPublicKey* SecurityEnvironment_NssImpl::getPubKey( unsigned int position ) std::list< SECKEYPublicKey* >::iterator keyIt ; unsigned int pos ; - pubkey = NULL ; + pubkey = nullptr ; for( pos = 0, keyIt = m_tPubKeyList.begin() ; pos < position && keyIt != m_tPubKeyList.end() ; pos ++ , ++keyIt ) ; if( pos == position && keyIt != m_tPubKeyList.end() ) @@ -287,7 +287,7 @@ SECKEYPrivateKey* SecurityEnvironment_NssImpl::getPriKey( unsigned int position std::list< SECKEYPrivateKey* >::iterator keyIt ; unsigned int pos ; - prikey = NULL ; + prikey = nullptr ; for( pos = 0, keyIt = m_tPriKeyList.begin() ; pos < position && keyIt != m_tPriKeyList.end() ; pos ++ , ++keyIt ) ; if( pos == position && keyIt != m_tPriKeyList.end() ) @@ -304,14 +304,14 @@ void SecurityEnvironment_NssImpl::updateSlots() m_Slots.clear(); m_tSymKeyList.clear(); - PK11SlotList * soltList = PK11_GetAllTokens( CKM_INVALID_MECHANISM, PR_FALSE, PR_FALSE, NULL ) ; - if( soltList != NULL ) + PK11SlotList * soltList = PK11_GetAllTokens( CKM_INVALID_MECHANISM, PR_FALSE, PR_FALSE, nullptr ) ; + if( soltList != nullptr ) { - for (PK11SlotListElement* soltEle = soltList->head ; soltEle != NULL; soltEle = soltEle->next) + for (PK11SlotListElement* soltEle = soltList->head ; soltEle != nullptr; soltEle = soltEle->next) { PK11SlotInfo * pSlot = soltEle->slot ; - if(pSlot != NULL) + if(pSlot != nullptr) { SAL_INFO( "xmlsecurity.xmlsec", @@ -328,7 +328,7 @@ void SecurityEnvironment_NssImpl::updateSlots() // By doing this, the encryption may fail if a smart card is being used which does not // support this key generation. // - PK11SymKey * pSymKey = PK11_KeyGen( pSlot , CKM_DES3_CBC, NULL, 128, NULL ) ; + PK11SymKey * pSymKey = PK11_KeyGen( pSlot , CKM_DES3_CBC, nullptr, 128, nullptr ) ; // if( pSymKey == NULL ) // { // PK11_FreeSlot( pSlot ) ; @@ -337,13 +337,13 @@ void SecurityEnvironment_NssImpl::updateSlots() // } addCryptoSlot(pSlot); PK11_FreeSlot( pSlot ) ; - pSlot = NULL; + pSlot = nullptr; - if (pSymKey != NULL) + if (pSymKey != nullptr) { adoptSymKey( pSymKey ) ; PK11_FreeSymKey( pSymKey ) ; - pSymKey = NULL; + pSymKey = nullptr; } }// end of if(pSlot != NULL) @@ -366,7 +366,7 @@ SecurityEnvironment_NssImpl::getPersonalCertificates() throw( SecurityException SECKEYPrivateKeyList* priKeyList ; if( PK11_NeedLogin(slot ) ) { - SECStatus nRet = PK11_Authenticate(slot, PR_TRUE, NULL); + SECStatus nRet = PK11_Authenticate(slot, PR_TRUE, nullptr); //PK11_Authenticate may fail in case the a slot has not been initialized. //this is the case if the user has a new profile, so that they have never //added a personal certificate. @@ -376,14 +376,14 @@ SecurityEnvironment_NssImpl::getPersonalCertificates() throw( SecurityException } priKeyList = PK11_ListPrivateKeysInSlot(slot) ; - if( priKeyList != NULL ) + if( priKeyList != nullptr ) { for (SECKEYPrivateKeyListNode* curPri = PRIVKEY_LIST_HEAD(priKeyList); - !PRIVKEY_LIST_END( curPri, priKeyList ) && curPri != NULL; + !PRIVKEY_LIST_END( curPri, priKeyList ) && curPri != nullptr; curPri = PRIVKEY_LIST_NEXT(curPri)) { xcert = NssPrivKeyToXCert( curPri->key ) ; - if( xcert != NULL ) + if( xcert != nullptr ) certsList.push_back( xcert ) ; } SECKEY_DestroyPrivateKeyList( priKeyList ) ; @@ -398,7 +398,7 @@ SecurityEnvironment_NssImpl::getPersonalCertificates() throw( SecurityException for( priKeyIt = m_tPriKeyList.begin() ; priKeyIt != m_tPriKeyList.end() ; ++priKeyIt ) { xcert = NssPrivKeyToXCert( *priKeyIt ) ; - if( xcert != NULL ) + if( xcert != nullptr ) certsList.push_back( xcert ) ; } } @@ -421,9 +421,9 @@ SecurityEnvironment_NssImpl::getPersonalCertificates() throw( SecurityException Reference< XCertificate > SecurityEnvironment_NssImpl::getCertificate( const OUString& issuerName, const Sequence< sal_Int8 >& serialNumber ) throw( SecurityException , RuntimeException, std::exception ) { - X509Certificate_NssImpl* xcert = NULL; + X509Certificate_NssImpl* xcert = nullptr; - if( m_pHandler != NULL ) { + if( m_pHandler != nullptr ) { CERTIssuerAndSN issuerAndSN ; CERTCertificate* cert ; CERTName* nmIssuer ; @@ -432,21 +432,21 @@ Reference< XCertificate > SecurityEnvironment_NssImpl::getCertificate( const OUS PRArenaPool* arena ; arena = PORT_NewArena( DER_DEFAULT_CHUNKSIZE ) ; - if( arena == NULL ) + if( arena == nullptr ) throw RuntimeException() ; // Create cert info from issue and serial OString ostr = OUStringToOString( issuerName , RTL_TEXTENCODING_UTF8 ) ; chIssuer = PL_strndup( ostr.getStr(), ( int )ostr.getLength() ) ; nmIssuer = CERT_AsciiToName( chIssuer ) ; - if( nmIssuer == NULL ) { + if( nmIssuer == nullptr ) { PL_strfree( chIssuer ) ; PORT_FreeArena( arena, PR_FALSE ) ; - return NULL; // no need for exception cf. i40394 + return nullptr; // no need for exception cf. i40394 } - derIssuer = SEC_ASN1EncodeItem( arena, NULL, static_cast<void*>(nmIssuer), SEC_ASN1_GET( CERT_NameTemplate ) ) ; - if( derIssuer == NULL ) { + derIssuer = SEC_ASN1EncodeItem( arena, nullptr, static_cast<void*>(nmIssuer), SEC_ASN1_GET( CERT_NameTemplate ) ) ; + if( derIssuer == nullptr ) { PL_strfree( chIssuer ) ; CERT_DestroyName( nmIssuer ) ; PORT_FreeArena( arena, PR_FALSE ) ; @@ -462,10 +462,10 @@ Reference< XCertificate > SecurityEnvironment_NssImpl::getCertificate( const OUS issuerAndSN.serialNumber.len = serialNumber.getLength() ; cert = CERT_FindCertByIssuerAndSN( m_pHandler, &issuerAndSN ) ; - if( cert != NULL ) { + if( cert != nullptr ) { xcert = NssCertToXCert( cert ) ; } else { - xcert = NULL ; + xcert = nullptr ; } PL_strfree( chIssuer ) ; @@ -474,7 +474,7 @@ Reference< XCertificate > SecurityEnvironment_NssImpl::getCertificate( const OUS CERT_DestroyCertificate( cert ) ; PORT_FreeArena( arena, PR_FALSE ) ; } else { - xcert = NULL ; + xcert = nullptr ; } return xcert ; @@ -492,12 +492,12 @@ Sequence< Reference < XCertificate > > SecurityEnvironment_NssImpl::buildCertifi xcert = reinterpret_cast<X509Certificate_NssImpl*>( sal::static_int_cast<sal_uIntPtr>(xCertTunnel->getSomething( X509Certificate_NssImpl::getUnoTunnelId() ))) ; - if( xcert == NULL ) { + if( xcert == nullptr ) { throw RuntimeException() ; } cert = xcert->getNssCert() ; - if( cert != NULL ) { + if( cert != nullptr ) { int64 timeboundary ; //Get the system clock time @@ -505,10 +505,10 @@ Sequence< Reference < XCertificate > > SecurityEnvironment_NssImpl::buildCertifi certChain = CERT_GetCertChainFromCert( const_cast<CERTCertificate*>(cert), timeboundary, certUsageAnyCA ) ; } else { - certChain = NULL ; + certChain = nullptr ; } - if( certChain != NULL ) { + if( certChain != nullptr ) { X509Certificate_NssImpl* pCert ; CERTCertListNode* node ; int len ; @@ -518,7 +518,7 @@ Sequence< Reference < XCertificate > > SecurityEnvironment_NssImpl::buildCertifi for( len = 0, node = CERT_LIST_HEAD( certChain ); !CERT_LIST_END( node, certChain ); node = CERT_LIST_NEXT( node ), len ++ ) { pCert = new X509Certificate_NssImpl() ; - if( pCert == NULL ) { + if( pCert == nullptr ) { CERT_DestroyCertList( certChain ) ; throw RuntimeException() ; } @@ -541,12 +541,12 @@ Reference< XCertificate > SecurityEnvironment_NssImpl::createCertificateFromRaw( if( rawCertificate.getLength() > 0 ) { xcert = new X509Certificate_NssImpl() ; - if( xcert == NULL ) + if( xcert == nullptr ) throw RuntimeException() ; xcert->setRawCert( rawCertificate ) ; } else { - xcert = NULL ; + xcert = nullptr ; } return xcert ; @@ -569,7 +569,7 @@ Reference< XCertificate > SecurityEnvironment_NssImpl::createCertificateFromAsci } else { - return NULL; + return nullptr; } } @@ -591,7 +591,7 @@ verifyCertificate( const Reference< csss::XCertificate >& aCert, xcert = reinterpret_cast<X509Certificate_NssImpl*>( sal::static_int_cast<sal_uIntPtr>(xCertTunnel->getSomething( X509Certificate_NssImpl::getUnoTunnelId() ))) ; - if( xcert == NULL ) { + if( xcert == nullptr ) { throw RuntimeException() ; } @@ -599,9 +599,9 @@ verifyCertificate( const Reference< csss::XCertificate >& aCert, //internally use CERT_GetDefaultCertDB //Make sure m_pHandler is the default DB OSL_ASSERT(m_pHandler == CERT_GetDefaultCertDB()); - CERTCertDBHandle * certDb = m_pHandler != NULL ? m_pHandler : CERT_GetDefaultCertDB(); + CERTCertDBHandle * certDb = m_pHandler != nullptr ? m_pHandler : CERT_GetDefaultCertDB(); cert = xcert->getNssCert() ; - if( cert != NULL ) + if( cert != nullptr ) { //prepare the intermediate certificates @@ -614,7 +614,7 @@ verifyCertificate( const Reference< csss::XCertificate >& aCert, item.len = der.getLength(); CERTCertificate* certTmp = CERT_NewTempCertificate(certDb, &item, - NULL /* nickname */, + nullptr /* nickname */, PR_FALSE /* isPerm */, PR_TRUE /* copyDER */); if (!certTmp) @@ -635,7 +635,7 @@ verifyCertificate( const Reference< csss::XCertificate >& aCert, CERTVerifyLog log; log.arena = PORT_NewArena(512); - log.head = log.tail = NULL; + log.head = log.tail = nullptr; log.count = 0; CERT_EnableOCSPChecking(certDb); @@ -675,7 +675,7 @@ verifyCertificate( const Reference< csss::XCertificate >& aCert, CERT_REV_M_TEST_USING_THIS_METHOD | CERT_REV_M_IGNORE_IMPLICIT_DEFAULT_SOURCE; rev.leafTests.number_of_preferred_methods = 0; - rev.leafTests.preferred_methods = NULL; + rev.leafTests.preferred_methods = nullptr; rev.leafTests.cert_rev_method_independent_flags = CERT_REV_MI_TEST_ALL_LOCAL_INFORMATION_FIRST; @@ -688,7 +688,7 @@ verifyCertificate( const Reference< csss::XCertificate >& aCert, CERT_REV_M_TEST_USING_THIS_METHOD | CERT_REV_M_IGNORE_IMPLICIT_DEFAULT_SOURCE; rev.chainTests.number_of_preferred_methods = 0; - rev.chainTests.preferred_methods = NULL; + rev.chainTests.preferred_methods = nullptr; rev.chainTests.cert_rev_method_independent_flags = CERT_REV_MI_TEST_ALL_LOCAL_INFORMATION_FIRST; @@ -703,7 +703,7 @@ verifyCertificate( const Reference< csss::XCertificate >& aCert, cvin[ncvinCount].type = cert_pi_end; cvout[0].type = cert_po_trustAnchor; - cvout[0].value.pointer.cert = NULL; + cvout[0].value.pointer.cert = nullptr; cvout[1].type = cert_po_errorLog; cvout[1].value.pointer.log = &log; cvout[2].type = cert_po_end; @@ -738,7 +738,7 @@ verifyCertificate( const Reference< csss::XCertificate >& aCert, " (0x" << std::hex << (int) arUsages[i].usage << ")" << std::dec); status = CERT_PKIXVerifyCert(const_cast<CERTCertificate *>(cert), arUsages[i].usage, - cvin, cvout, NULL); + cvin, cvout, nullptr); if( status == SECSuccess ) { SAL_INFO("xmlsecurity.xmlsec", "CERT_PKIXVerifyCert returned SECSuccess."); @@ -770,14 +770,14 @@ verifyCertificate( const Reference< csss::XCertificate >& aCert, /* Display validation results */ if ( log.count > 0) { - CERTVerifyLogNode *node = NULL; + CERTVerifyLogNode *node = nullptr; printChainFailure(&log); for (node = log.head; node; node = node->next) { if (node->cert) CERT_DestroyCertificate(node->cert); } - log.head = log.tail = NULL; + log.head = log.tail = nullptr; log.count = 0; } SAL_INFO("xmlsecurity.xmlsec", "Certificate is invalid."); @@ -813,7 +813,7 @@ sal_Int32 SecurityEnvironment_NssImpl::getCertificateCharacters( xcert = reinterpret_cast<X509Certificate_NssImpl*>( sal::static_int_cast<sal_uIntPtr>(xCertTunnel->getSomething( X509Certificate_NssImpl::getUnoTunnelId() ))) ; - if( xcert == NULL ) { + if( xcert == nullptr ) { throw RuntimeException() ; } @@ -835,22 +835,22 @@ sal_Int32 SecurityEnvironment_NssImpl::getCertificateCharacters( * * mmi : need to check whether the cert's slot is valid first */ - SECKEYPrivateKey* priKey = NULL; + SECKEYPrivateKey* priKey = nullptr; - if (cert->slot != NULL) + if (cert->slot != nullptr) { - priKey = PK11_FindPrivateKeyFromCert( cert->slot, const_cast<CERTCertificate*>(cert), NULL ) ; + priKey = PK11_FindPrivateKeyFromCert( cert->slot, const_cast<CERTCertificate*>(cert), nullptr ) ; } - if(priKey == NULL) + if(priKey == nullptr) { for (CIT_SLOTS is = m_Slots.begin(); is != m_Slots.end(); is++) { - priKey = PK11_FindPrivateKeyFromCert(*is, const_cast<CERTCertificate*>(cert), NULL); + priKey = PK11_FindPrivateKeyFromCert(*is, const_cast<CERTCertificate*>(cert), nullptr); if (priKey) break; } } - if( priKey != NULL ) { + if( priKey != nullptr ) { characters |= ::com::sun::star::security::CertificateCharacters::HAS_PRIVATE_KEY ; SECKEY_DestroyPrivateKey( priKey ) ; @@ -865,15 +865,15 @@ X509Certificate_NssImpl* NssCertToXCert( CERTCertificate* cert ) { X509Certificate_NssImpl* xcert ; - if( cert != NULL ) { + if( cert != nullptr ) { xcert = new X509Certificate_NssImpl() ; - if( xcert == NULL ) { - xcert = NULL ; + if( xcert == nullptr ) { + xcert = nullptr ; } else { xcert->setCert( cert ) ; } } else { - xcert = NULL ; + xcert = nullptr ; } return xcert ; @@ -883,18 +883,18 @@ X509Certificate_NssImpl* NssPrivKeyToXCert( SECKEYPrivateKey* priKey ) { X509Certificate_NssImpl* xcert ; - if( priKey != NULL ) { + if( priKey != nullptr ) { CERTCertificate* cert = PK11_GetCertFromPrivateKey( priKey ) ; - if( cert != NULL ) { + if( cert != nullptr ) { xcert = NssCertToXCert( cert ) ; } else { - xcert = NULL ; + xcert = nullptr ; } CERT_DestroyCertificate( cert ) ; } else { - xcert = NULL ; + xcert = nullptr ; } return xcert ; @@ -905,11 +905,11 @@ X509Certificate_NssImpl* NssPrivKeyToXCert( SECKEYPrivateKey* priKey ) xmlSecKeysMngrPtr SecurityEnvironment_NssImpl::createKeysManager() throw( Exception, RuntimeException ) { unsigned int i ; - CERTCertDBHandle* handler = NULL ; - PK11SymKey* symKey = NULL ; - SECKEYPublicKey* pubKey = NULL ; - SECKEYPrivateKey* priKey = NULL ; - xmlSecKeysMngrPtr pKeysMngr = NULL ; + CERTCertDBHandle* handler = nullptr ; + PK11SymKey* symKey = nullptr ; + SECKEYPublicKey* pubKey = nullptr ; + SECKEYPrivateKey* priKey = nullptr ; + xmlSecKeysMngrPtr pKeysMngr = nullptr ; handler = this->getCertDb() ; @@ -925,13 +925,13 @@ xmlSecKeysMngrPtr SecurityEnvironment_NssImpl::createKeysManager() throw( Except slots[count] = *islots; pKeysMngr = xmlSecNssAppliedKeysMngrCreate(slots, cSlots, handler ) ; - if( pKeysMngr == NULL ) + if( pKeysMngr == nullptr ) throw RuntimeException() ; /*- * Adopt symmetric key into keys manager */ - for( i = 0 ; ( symKey = this->getSymKey( i ) ) != NULL ; i ++ ) { + for( i = 0 ; ( symKey = this->getSymKey( i ) ) != nullptr ; i ++ ) { if( xmlSecNssAppliedKeysMngrSymKeyLoad( pKeysMngr, symKey ) < 0 ) { throw RuntimeException() ; } @@ -940,7 +940,7 @@ xmlSecKeysMngrPtr SecurityEnvironment_NssImpl::createKeysManager() throw( Except /*- * Adopt asymmetric public key into keys manager */ - for( i = 0 ; ( pubKey = this->getPubKey( i ) ) != NULL ; i ++ ) { + for( i = 0 ; ( pubKey = this->getPubKey( i ) ) != nullptr ; i ++ ) { if( xmlSecNssAppliedKeysMngrPubKeyLoad( pKeysMngr, pubKey ) < 0 ) { throw RuntimeException() ; } @@ -949,7 +949,7 @@ xmlSecKeysMngrPtr SecurityEnvironment_NssImpl::createKeysManager() throw( Except /*- * Adopt asymmetric private key into keys manager */ - for( i = 0 ; ( priKey = this->getPriKey( i ) ) != NULL ; i ++ ) { + for( i = 0 ; ( priKey = this->getPriKey( i ) ) != nullptr ; i ++ ) { if( xmlSecNssAppliedKeysMngrPriKeyLoad( pKeysMngr, priKey ) < 0 ) { throw RuntimeException() ; } @@ -957,7 +957,7 @@ xmlSecKeysMngrPtr SecurityEnvironment_NssImpl::createKeysManager() throw( Except return pKeysMngr ; } void SecurityEnvironment_NssImpl::destroyKeysManager(xmlSecKeysMngrPtr pKeysMngr) throw( Exception, RuntimeException ) { - if( pKeysMngr != NULL ) { + if( pKeysMngr != nullptr ) { xmlSecKeysMngrDestroy( pKeysMngr ) ; } } diff --git a/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx index 3a88ffa91f46..2e4f66488abd 100644 --- a/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx @@ -67,10 +67,10 @@ uno::Reference< cssxc::XXMLSecurityContext > SAL_CALL SEInitializer_NssImpl::createSecurityContext( const OUString& ) throw (uno::RuntimeException, std::exception) { - CERTCertDBHandle *pCertHandle = NULL ; + CERTCertDBHandle *pCertHandle = nullptr ; if( !initNSS( m_xContext ) ) - return NULL; + return nullptr; pCertHandle = CERT_GetDefaultCertDB() ; @@ -95,7 +95,7 @@ uno::Reference< cssxc::XXMLSecurityContext > SAL_CALL { //PK11_LogoutAll(); //NSS_Shutdown(); - return NULL; + return nullptr; } } diff --git a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx index 5ac40f70d5cf..0939a1f95bfb 100644 --- a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx @@ -42,19 +42,19 @@ using ::com::sun::star::security::XCertificate ; using ::com::sun::star::util::DateTime ; X509Certificate_NssImpl::X509Certificate_NssImpl() : - m_pCert( NULL ) + m_pCert( nullptr ) { } X509Certificate_NssImpl::~X509Certificate_NssImpl() { - if( m_pCert != NULL ) { + if( m_pCert != nullptr ) { CERT_DestroyCertificate( m_pCert ) ; } } //Methods from XCertificate sal_Int16 SAL_CALL X509Certificate_NssImpl::getVersion() throw ( ::com::sun::star::uno::RuntimeException, std::exception) { - if( m_pCert != NULL ) { + if( m_pCert != nullptr ) { if( m_pCert->version.len > 0 ) { return ( char )*( m_pCert->version.data ) ; } else @@ -65,7 +65,7 @@ sal_Int16 SAL_CALL X509Certificate_NssImpl::getVersion() throw ( ::com::sun::sta } ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL X509Certificate_NssImpl::getSerialNumber() throw ( ::com::sun::star::uno::RuntimeException, std::exception) { - if( m_pCert != NULL && m_pCert->serialNumber.len > 0 ) { + if( m_pCert != nullptr && m_pCert->serialNumber.len > 0 ) { Sequence< sal_Int8 > serial( m_pCert->serialNumber.len ) ; for( unsigned int i = 0 ; i < m_pCert->serialNumber.len ; i ++ ) serial[i] = *( m_pCert->serialNumber.data + i ) ; @@ -77,7 +77,7 @@ sal_Int16 SAL_CALL X509Certificate_NssImpl::getVersion() throw ( ::com::sun::sta } OUString SAL_CALL X509Certificate_NssImpl::getIssuerName() throw ( ::com::sun::star::uno::RuntimeException, std::exception) { - if( m_pCert != NULL ) { + if( m_pCert != nullptr ) { return OUString(m_pCert->issuerName , PL_strlen(m_pCert->issuerName) , RTL_TEXTENCODING_UTF8) ; } else { return OUString() ; @@ -85,7 +85,7 @@ OUString SAL_CALL X509Certificate_NssImpl::getIssuerName() throw ( ::com::sun::s } OUString SAL_CALL X509Certificate_NssImpl::getSubjectName() throw ( ::com::sun::star::uno::RuntimeException, std::exception) { - if( m_pCert != NULL ) { + if( m_pCert != nullptr ) { return OUString(m_pCert->subjectName , PL_strlen(m_pCert->subjectName) , RTL_TEXTENCODING_UTF8); } else { return OUString() ; @@ -93,7 +93,7 @@ OUString SAL_CALL X509Certificate_NssImpl::getSubjectName() throw ( ::com::sun:: } ::com::sun::star::util::DateTime SAL_CALL X509Certificate_NssImpl::getNotValidBefore() throw ( ::com::sun::star::uno::RuntimeException, std::exception) { - if( m_pCert != NULL ) { + if( m_pCert != nullptr ) { SECStatus rv ; PRTime notBefore ; PRExplodedTime explTime ; @@ -122,7 +122,7 @@ OUString SAL_CALL X509Certificate_NssImpl::getSubjectName() throw ( ::com::sun:: } ::com::sun::star::util::DateTime SAL_CALL X509Certificate_NssImpl::getNotValidAfter() throw ( ::com::sun::star::uno::RuntimeException, std::exception) { - if( m_pCert != NULL ) { + if( m_pCert != nullptr ) { SECStatus rv ; PRTime notAfter ; PRExplodedTime explTime ; @@ -151,7 +151,7 @@ OUString SAL_CALL X509Certificate_NssImpl::getSubjectName() throw ( ::com::sun:: } ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL X509Certificate_NssImpl::getIssuerUniqueID() throw ( ::com::sun::star::uno::RuntimeException, std::exception) { - if( m_pCert != NULL && m_pCert->issuerID.len > 0 ) { + if( m_pCert != nullptr && m_pCert->issuerID.len > 0 ) { Sequence< sal_Int8 > issuerUid( m_pCert->issuerID.len ) ; for( unsigned int i = 0 ; i < m_pCert->issuerID.len ; i ++ ) issuerUid[i] = *( m_pCert->issuerID.data + i ) ; @@ -163,7 +163,7 @@ OUString SAL_CALL X509Certificate_NssImpl::getSubjectName() throw ( ::com::sun:: } ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL X509Certificate_NssImpl::getSubjectUniqueID() throw ( ::com::sun::star::uno::RuntimeException, std::exception) { - if( m_pCert != NULL && m_pCert->subjectID.len > 0 ) { + if( m_pCert != nullptr && m_pCert->subjectID.len > 0 ) { Sequence< sal_Int8 > subjectUid( m_pCert->subjectID.len ) ; for( unsigned int i = 0 ; i < m_pCert->subjectID.len ; i ++ ) subjectUid[i] = *( m_pCert->subjectID.data + i ) ; @@ -175,16 +175,16 @@ OUString SAL_CALL X509Certificate_NssImpl::getSubjectName() throw ( ::com::sun:: } ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::security::XCertificateExtension > > SAL_CALL X509Certificate_NssImpl::getExtensions() throw ( ::com::sun::star::uno::RuntimeException, std::exception) { - if( m_pCert != NULL && m_pCert->extensions != NULL ) { + if( m_pCert != nullptr && m_pCert->extensions != nullptr ) { CERTCertExtension** extns ; CertificateExtension_XmlSecImpl* pExtn ; bool crit ; int len ; - for( len = 0, extns = m_pCert->extensions; *extns != NULL; len ++, extns ++ ) ; + for( len = 0, extns = m_pCert->extensions; *extns != nullptr; len ++, extns ++ ) ; Sequence< Reference< XCertificateExtension > > xExtns( len ) ; - for( extns = m_pCert->extensions, len = 0; *extns != NULL; extns ++, len ++ ) { + for( extns = m_pCert->extensions, len = 0; *extns != nullptr; extns ++, len ++ ) { const SECItem id = (*extns)->id; OString oidString(CERT_GetOidString(&id)); @@ -201,7 +201,7 @@ OUString SAL_CALL X509Certificate_NssImpl::getSubjectName() throw ( ::com::sun:: else pExtn = new CertificateExtension_XmlSecImpl() ; - if( (*extns)->critical.data == NULL ) + if( (*extns)->critical.data == nullptr ) crit = false ; else crit = (*extns)->critical.data[0] == 0xFF; @@ -217,7 +217,7 @@ OUString SAL_CALL X509Certificate_NssImpl::getSubjectName() throw ( ::com::sun:: } ::com::sun::star::uno::Reference< ::com::sun::star::security::XCertificateExtension > SAL_CALL X509Certificate_NssImpl::findCertificateExtension( const ::com::sun::star::uno::Sequence< sal_Int8 >& oid ) throw (::com::sun::star::uno::RuntimeException, std::exception) { - if( m_pCert != NULL && m_pCert->extensions != NULL ) { + if( m_pCert != nullptr && m_pCert->extensions != nullptr ) { CertificateExtension_XmlSecImpl* pExtn ; CERTCertExtension** extns ; SECItem idItem ; @@ -226,8 +226,8 @@ OUString SAL_CALL X509Certificate_NssImpl::getSubjectName() throw ( ::com::sun:: idItem.data = reinterpret_cast<unsigned char *>(const_cast<sal_Int8 *>(oid.getConstArray())); idItem.len = oid.getLength() ; - pExtn = NULL ; - for( extns = m_pCert->extensions; *extns != NULL; extns ++ ) { + pExtn = nullptr ; + for( extns = m_pCert->extensions; *extns != nullptr; extns ++ ) { if( SECITEM_CompareItem( &idItem, &(*extns)->id ) == SECEqual ) { const SECItem id = (*extns)->id; OString objId(CERT_GetOidString(&id)); @@ -235,7 +235,7 @@ OUString SAL_CALL X509Certificate_NssImpl::getSubjectName() throw ( ::com::sun:: pExtn = reinterpret_cast<CertificateExtension_XmlSecImpl*>(new SanExtensionImpl()); else pExtn = new CertificateExtension_XmlSecImpl() ; - if( (*extns)->critical.data == NULL ) + if( (*extns)->critical.data == nullptr ) crit = false ; else crit = (*extns)->critical.data[0] == 0xFF; @@ -246,13 +246,13 @@ OUString SAL_CALL X509Certificate_NssImpl::getSubjectName() throw ( ::com::sun:: return pExtn ; } else { - return NULL ; + return nullptr ; } } ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL X509Certificate_NssImpl::getEncoded() throw ( ::com::sun::star::uno::RuntimeException, std::exception) { - if( m_pCert != NULL && m_pCert->derCert.len > 0 ) { + if( m_pCert != nullptr && m_pCert->derCert.len > 0 ) { Sequence< sal_Int8 > rawCert( m_pCert->derCert.len ) ; for( unsigned int i = 0 ; i < m_pCert->derCert.len ; i ++ ) @@ -266,21 +266,21 @@ OUString SAL_CALL X509Certificate_NssImpl::getSubjectName() throw ( ::com::sun:: //Helper methods void X509Certificate_NssImpl::setCert( CERTCertificate* cert ) { - if( m_pCert != NULL ) { + if( m_pCert != nullptr ) { CERT_DestroyCertificate( m_pCert ) ; - m_pCert = NULL ; + m_pCert = nullptr ; } - if( cert != NULL ) { + if( cert != nullptr ) { m_pCert = CERT_DupCertificate( cert ) ; } } const CERTCertificate* X509Certificate_NssImpl::getNssCert() const { - if( m_pCert != NULL ) { + if( m_pCert != nullptr ) { return m_pCert ; } else { - return NULL ; + return nullptr ; } } @@ -291,13 +291,13 @@ void X509Certificate_NssImpl::setRawCert( const Sequence< sal_Int8 >& rawCert ) certItem.data = reinterpret_cast<unsigned char *>(const_cast<sal_Int8 *>(rawCert.getConstArray())); certItem.len = rawCert.getLength() ; - cert = CERT_DecodeDERCertificate( &certItem, PR_TRUE, NULL ) ; - if( cert == NULL ) + cert = CERT_DecodeDERCertificate( &certItem, PR_TRUE, nullptr ) ; + if( cert == nullptr ) throw RuntimeException() ; - if( m_pCert != NULL ) { + if( m_pCert != nullptr ) { CERT_DestroyCertificate( m_pCert ) ; - m_pCert = NULL ; + m_pCert = nullptr ; } m_pCert = cert ; @@ -334,7 +334,7 @@ OUString getAlgorithmDescription(SECAlgorithmID *aid) ::com::sun::star::uno::Sequence< sal_Int8 > getThumbprint(CERTCertificate *pCert, SECOidTag id) { - if( pCert != NULL ) + if( pCert != nullptr ) { SECStatus rv; unsigned char fingerprint[20]; @@ -357,7 +357,7 @@ OUString getAlgorithmDescription(SECAlgorithmID *aid) OUString SAL_CALL X509Certificate_NssImpl::getSubjectPublicKeyAlgorithm() throw ( ::com::sun::star::uno::RuntimeException, std::exception) { - if( m_pCert != NULL ) + if( m_pCert != nullptr ) { return getAlgorithmDescription(&(m_pCert->subjectPublicKeyInfo.algorithm)); } @@ -370,7 +370,7 @@ OUString SAL_CALL X509Certificate_NssImpl::getSubjectPublicKeyAlgorithm() ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL X509Certificate_NssImpl::getSubjectPublicKeyValue() throw ( ::com::sun::star::uno::RuntimeException, std::exception) { - if( m_pCert != NULL ) + if( m_pCert != nullptr ) { SECItem spk = m_pCert->subjectPublicKeyInfo.subjectPublicKey; DER_ConvertBitString(&spk); @@ -393,7 +393,7 @@ OUString SAL_CALL X509Certificate_NssImpl::getSubjectPublicKeyAlgorithm() OUString SAL_CALL X509Certificate_NssImpl::getSignatureAlgorithm() throw ( ::com::sun::star::uno::RuntimeException, std::exception) { - if( m_pCert != NULL ) + if( m_pCert != nullptr ) { return getAlgorithmDescription(&(m_pCert->signature)); } @@ -427,7 +427,7 @@ sal_Int32 SAL_CALL X509Certificate_NssImpl::getCertificateUsage( ) { usage = tmpitem.data[0]; PORT_Free(tmpitem.data); - tmpitem.data = NULL; + tmpitem.data = nullptr; } else { diff --git a/xmlsecurity/source/xmlsec/nss/xmlencryption_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/xmlencryption_nssimpl.cxx index 8b6162997f12..921178f0dac4 100644 --- a/xmlsecurity/source/xmlsec/nss/xmlencryption_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/xmlencryption_nssimpl.cxx @@ -58,10 +58,10 @@ SAL_CALL XMLEncryption_NssImpl::encrypt( com::sun::star::uno::SecurityException, com::sun::star::uno::RuntimeException, std::exception) { - xmlSecKeysMngrPtr pMngr = NULL ; - xmlSecEncCtxPtr pEncCtx = NULL ; - xmlNodePtr pEncryptedData = NULL ; - xmlNodePtr pContent = NULL ; + xmlSecKeysMngrPtr pMngr = nullptr ; + xmlSecEncCtxPtr pEncCtx = nullptr ; + xmlNodePtr pEncryptedData = nullptr ; + xmlNodePtr pContent = nullptr ; if( !aTemplate.is() ) throw RuntimeException() ; @@ -78,7 +78,7 @@ SAL_CALL XMLEncryption_NssImpl::encrypt( SecurityEnvironment_NssImpl* pSecEnv = reinterpret_cast<SecurityEnvironment_NssImpl*>( sal::static_int_cast<sal_uIntPtr>(xSecTunnel->getSomething( SecurityEnvironment_NssImpl::getUnoTunnelId() ))) ; - if( pSecEnv == NULL ) + if( pSecEnv == nullptr ) throw RuntimeException() ; //Get the encryption template @@ -96,7 +96,7 @@ SAL_CALL XMLEncryption_NssImpl::encrypt( reinterpret_cast<XMLElementWrapper_XmlSecImpl*>( sal::static_int_cast<sal_uIntPtr>( xTplTunnel->getSomething( XMLElementWrapper_XmlSecImpl::getUnoTunnelImplementationId() ))); - if( pTemplate == NULL ) { + if( pTemplate == nullptr ) { throw RuntimeException() ; } @@ -115,13 +115,13 @@ SAL_CALL XMLEncryption_NssImpl::encrypt( reinterpret_cast<XMLElementWrapper_XmlSecImpl*>( sal::static_int_cast<sal_uIntPtr>( xTgtTunnel->getSomething( XMLElementWrapper_XmlSecImpl::getUnoTunnelImplementationId() ))); - if( pTarget == NULL ) { + if( pTarget == nullptr ) { throw RuntimeException() ; } pContent = pTarget->getNativeElement() ; - if( pContent == NULL ) { + if( pContent == nullptr ) { throw XMLEncryptionException() ; } @@ -151,7 +151,7 @@ SAL_CALL XMLEncryption_NssImpl::encrypt( //Create Encryption context pEncCtx = xmlSecEncCtxCreate( pMngr ) ; - if( pEncCtx == NULL ) + if( pEncCtx == nullptr ) { SecurityEnvironment_NssImpl::destroyKeysManager( pMngr ); //throw XMLEncryptionException() ; @@ -197,9 +197,9 @@ SAL_CALL XMLEncryption_NssImpl::decrypt( com::sun::star::uno::SecurityException, com::sun::star::uno::RuntimeException, std::exception) { - xmlSecKeysMngrPtr pMngr = NULL ; - xmlSecEncCtxPtr pEncCtx = NULL ; - xmlNodePtr pEncryptedData = NULL ; + xmlSecKeysMngrPtr pMngr = nullptr ; + xmlSecEncCtxPtr pEncCtx = nullptr ; + xmlNodePtr pEncryptedData = nullptr ; if( !aTemplate.is() ) throw RuntimeException() ; @@ -222,7 +222,7 @@ SAL_CALL XMLEncryption_NssImpl::decrypt( reinterpret_cast<XMLElementWrapper_XmlSecImpl*>( sal::static_int_cast<sal_uIntPtr>( xTplTunnel->getSomething( XMLElementWrapper_XmlSecImpl::getUnoTunnelImplementationId() ))); - if( pTemplate == NULL ) { + if( pTemplate == nullptr ) { throw RuntimeException() ; } @@ -262,7 +262,7 @@ SAL_CALL XMLEncryption_NssImpl::decrypt( reinterpret_cast<SecurityEnvironment_NssImpl*>( sal::static_int_cast<sal_uIntPtr>( xSecTunnel->getSomething( SecurityEnvironment_NssImpl::getUnoTunnelId() ))); - if( pSecEnv == NULL ) + if( pSecEnv == nullptr ) throw RuntimeException() ; pMngr = pSecEnv->createKeysManager(); @@ -272,7 +272,7 @@ SAL_CALL XMLEncryption_NssImpl::decrypt( //Create Encryption context pEncCtx = xmlSecEncCtxCreate( pMngr ) ; - if( pEncCtx == NULL ) + if( pEncCtx == nullptr ) { SecurityEnvironment_NssImpl::destroyKeysManager( pMngr ); //throw XMLEncryptionException() ; @@ -281,7 +281,7 @@ SAL_CALL XMLEncryption_NssImpl::decrypt( } //Decrypt the template - if(!( xmlSecEncCtxDecrypt( pEncCtx , pEncryptedData ) < 0 || pEncCtx->result == NULL )) + if(!( xmlSecEncCtxDecrypt( pEncCtx , pEncryptedData ) < 0 || pEncCtx->result == nullptr )) { //The decryption succeeds diff --git a/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx index 3aa99751ba96..5d30bf716300 100644 --- a/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx @@ -62,9 +62,9 @@ SAL_CALL XMLSignature_NssImpl::generate( com::sun::star::uno::SecurityException, com::sun::star::uno::RuntimeException, std::exception ) { - xmlSecKeysMngrPtr pMngr = NULL ; - xmlSecDSigCtxPtr pDsigCtx = NULL ; - xmlNodePtr pNode = NULL ; + xmlSecKeysMngrPtr pMngr = nullptr ; + xmlSecDSigCtxPtr pDsigCtx = nullptr ; + xmlNodePtr pNode = nullptr ; if( !aTemplate.is() ) throw RuntimeException() ; @@ -87,7 +87,7 @@ SAL_CALL XMLSignature_NssImpl::generate( reinterpret_cast<XMLElementWrapper_XmlSecImpl*>( sal::static_int_cast<sal_uIntPtr>( xNodTunnel->getSomething( XMLElementWrapper_XmlSecImpl::getUnoTunnelImplementationId() ))); - if( pElement == NULL ) { + if( pElement == nullptr ) { throw RuntimeException() ; } @@ -113,7 +113,7 @@ SAL_CALL XMLSignature_NssImpl::generate( reinterpret_cast<SecurityEnvironment_NssImpl*>( sal::static_int_cast<sal_uIntPtr>( xSecTunnel->getSomething( SecurityEnvironment_NssImpl::getUnoTunnelId() ))); - if( pSecEnv == NULL ) + if( pSecEnv == nullptr ) throw RuntimeException() ; setErrorRecorder(); @@ -125,7 +125,7 @@ SAL_CALL XMLSignature_NssImpl::generate( //Create Signature context pDsigCtx = xmlSecDSigCtxCreate( pMngr ) ; - if( pDsigCtx == NULL ) + if( pDsigCtx == nullptr ) { SecurityEnvironment_NssImpl::destroyKeysManager( pMngr ); //throw XMLSignatureException() ; @@ -166,9 +166,9 @@ SAL_CALL XMLSignature_NssImpl::validate( ) throw( com::sun::star::uno::RuntimeException, com::sun::star::uno::SecurityException, com::sun::star::xml::crypto::XMLSignatureException, std::exception ) { - xmlSecKeysMngrPtr pMngr = NULL ; - xmlSecDSigCtxPtr pDsigCtx = NULL ; - xmlNodePtr pNode = NULL ; + xmlSecKeysMngrPtr pMngr = nullptr ; + xmlSecDSigCtxPtr pDsigCtx = nullptr ; + xmlNodePtr pNode = nullptr ; //sal_Bool valid ; if( !aTemplate.is() ) @@ -191,7 +191,7 @@ SAL_CALL XMLSignature_NssImpl::validate( reinterpret_cast<XMLElementWrapper_XmlSecImpl*>( sal::static_int_cast<sal_uIntPtr>( xNodTunnel->getSomething( XMLElementWrapper_XmlSecImpl::getUnoTunnelImplementationId() ))); - if( pElement == NULL ) + if( pElement == nullptr ) throw RuntimeException() ; pNode = pElement->getNativeElement() ; @@ -223,7 +223,7 @@ SAL_CALL XMLSignature_NssImpl::validate( reinterpret_cast<SecurityEnvironment_NssImpl*>( sal::static_int_cast<sal_uIntPtr>( xSecTunnel->getSomething( SecurityEnvironment_NssImpl::getUnoTunnelId() ))); - if( pSecEnv == NULL ) + if( pSecEnv == nullptr ) throw RuntimeException() ; pMngr = pSecEnv->createKeysManager(); @@ -233,7 +233,7 @@ SAL_CALL XMLSignature_NssImpl::validate( //Create Signature context pDsigCtx = xmlSecDSigCtxCreate( pMngr ) ; - if( pDsigCtx == NULL ) + if( pDsigCtx == nullptr ) { SecurityEnvironment_NssImpl::destroyKeysManager( pMngr ); //throw XMLSignatureException() ; diff --git a/xmlsecurity/source/xmlsec/nss/xsec_nss.cxx b/xmlsecurity/source/xmlsec/nss/xsec_nss.cxx index 35e8aa00615f..3a46eaa2426b 100644 --- a/xmlsecurity/source/xmlsec/nss/xsec_nss.cxx +++ b/xmlsecurity/source/xmlsec/nss/xsec_nss.cxx @@ -42,10 +42,10 @@ extern "C" void* SAL_CALL nss_component_getFactory( const sal_Char* pImplName , void* pServiceManager , void* /*pRegistryKey*/ ) { - void* pRet = 0; + void* pRet = nullptr; Reference< XSingleServiceFactory > xFactory ; - if( pImplName != NULL && pServiceManager != NULL ) + if( pImplName != nullptr && pServiceManager != nullptr ) { #ifdef XMLSEC_CRYPTO_NSS if( SEInitializer_NssImpl_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) ) diff --git a/xmlsecurity/source/xmlsec/saxhelper.cxx b/xmlsecurity/source/xmlsec/saxhelper.cxx index ea5fd5105e7d..589e89028bd8 100644 --- a/xmlsecurity/source/xmlsec/saxhelper.cxx +++ b/xmlsecurity/source/xmlsec/saxhelper.cxx @@ -59,9 +59,9 @@ xmlChar* ous_to_nxmlstr( const OUString& oustr, int& length ) */ const xmlChar** attrlist_to_nxmlstr( const cssu::Sequence< cssxcsax::XMLAttribute >& aAttributes ) { - xmlChar* attname = NULL ; - xmlChar* attvalue = NULL ; - const xmlChar** attrs = NULL ; + xmlChar* attname = nullptr ; + xmlChar* attvalue = nullptr ; + const xmlChar** attrs = nullptr ; sal_Int32 nLength = aAttributes.getLength(); @@ -71,7 +71,7 @@ const xmlChar** attrlist_to_nxmlstr( const cssu::Sequence< cssxcsax::XMLAttribut } else { - return NULL ; + return nullptr ; } for( int i = 0 , j = 0 ; j < nLength ; ++j ) @@ -79,18 +79,18 @@ const xmlChar** attrlist_to_nxmlstr( const cssu::Sequence< cssxcsax::XMLAttribut attname = ous_to_xmlstr( aAttributes[j].sName ) ; attvalue = ous_to_xmlstr( aAttributes[j].sValue ) ; - if( attname != NULL && attvalue != NULL ) + if( attname != nullptr && attvalue != nullptr ) { attrs[i++] = attname ; attrs[i++] = attvalue ; - attrs[i] = NULL ; - attrs[i+1] = NULL ; + attrs[i] = nullptr ; + attrs[i+1] = nullptr ; } else { - if( attname != NULL ) + if( attname != nullptr ) xmlFree( attname ) ; - if( attvalue != NULL ) + if( attvalue != nullptr ) xmlFree( attvalue ) ; } } @@ -105,8 +105,8 @@ const xmlChar** attrlist_to_nxmlstr( const cssu::Sequence< cssxcsax::XMLAttribut * default sax handler is initialized with the context. */ SAXHelper::SAXHelper( ) - : m_pParserCtxt( NULL ), - m_pSaxHandler( NULL ) + : m_pParserCtxt( nullptr ), + m_pSaxHandler( nullptr ) { xmlInitParser() ; LIBXML_TEST_VERSION ; @@ -123,7 +123,7 @@ SAXHelper::SAXHelper( ) m_pParserCtxt = xmlNewParserCtxt() ; - if( m_pParserCtxt == NULL ) + if( m_pParserCtxt == nullptr ) { #ifndef XMLSEC_NO_XSLT xsltCleanupGlobals() ; @@ -137,12 +137,12 @@ SAXHelper::SAXHelper( ) { xmlSAXVersion(m_pParserCtxt->sax, 1); - if( m_pParserCtxt->inputTab[0] != NULL ) + if( m_pParserCtxt->inputTab[0] != nullptr ) { - m_pParserCtxt->inputTab[0] = NULL ; + m_pParserCtxt->inputTab[0] = nullptr ; } - if( m_pParserCtxt->sax == NULL ) + if( m_pParserCtxt->sax == nullptr ) { xmlFreeParserCtxt( m_pParserCtxt ) ; @@ -152,7 +152,7 @@ SAXHelper::SAXHelper( ) // see issue i74334, we cannot call xmlCleanupParser when libxml is still used // in other parts of the office. // xmlCleanupParser() ; - m_pParserCtxt = NULL ; + m_pParserCtxt = nullptr ; throw cssu::RuntimeException() ; } else @@ -174,7 +174,7 @@ SAXHelper::SAXHelper( ) * destruct the xml tree. */ SAXHelper::~SAXHelper() { - if( m_pParserCtxt != NULL ) + if( m_pParserCtxt != nullptr ) { /* * In the situation that no object refer the Document, this destructor @@ -182,17 +182,17 @@ SAXHelper::~SAXHelper() { */ if( m_pSaxHandler == m_pParserCtxt->sax ) { - m_pSaxHandler = NULL ; + m_pSaxHandler = nullptr ; } xmlFreeParserCtxt( m_pParserCtxt ) ; - m_pParserCtxt = NULL ; + m_pParserCtxt = nullptr ; } - if( m_pSaxHandler != NULL ) + if( m_pSaxHandler != nullptr ) { xmlFree( m_pSaxHandler ) ; - m_pSaxHandler = NULL ; + m_pSaxHandler = nullptr ; } // see issue i74334, we cannot call xmlCleanupParser when libxml is still used // in other parts of the office. @@ -220,7 +220,7 @@ void SAXHelper::setCurrentNode(const xmlNodePtr pNode) void SAXHelper::startDocument() throw( cssxs::SAXException , cssu::RuntimeException ) { - if( m_pParserCtxt == NULL) + if( m_pParserCtxt == nullptr) { throw cssu::RuntimeException() ; } @@ -229,7 +229,7 @@ void SAXHelper::startDocument() */ xmlParserInputPtr pInput = xmlNewInputStream( m_pParserCtxt ) ; - if( m_pParserCtxt->inputTab != NULL && m_pParserCtxt->inputMax != 0 ) + if( m_pParserCtxt->inputTab != nullptr && m_pParserCtxt->inputMax != 0 ) { m_pParserCtxt->inputTab[0] = pInput ; m_pParserCtxt->input = pInput ; @@ -237,7 +237,7 @@ void SAXHelper::startDocument() m_pSaxHandler->startDocument( m_pParserCtxt ) ; - if( m_pParserCtxt->myDoc == NULL ) + if( m_pParserCtxt->myDoc == nullptr ) { throw cssu::RuntimeException() ; } @@ -260,33 +260,33 @@ void SAXHelper::startElement( const cssu::Sequence< cssxcsax::XMLAttribute >& aAttributes ) throw( cssxs::SAXException , cssu::RuntimeException ) { - const xmlChar* fullName = NULL ; - const xmlChar** attrs = NULL ; + const xmlChar* fullName = nullptr ; + const xmlChar** attrs = nullptr ; fullName = ous_to_xmlstr( aName ) ; attrs = attrlist_to_nxmlstr( aAttributes ) ; - if( fullName != NULL || attrs != NULL ) + if( fullName != nullptr || attrs != nullptr ) { m_pSaxHandler->startElement( m_pParserCtxt , fullName , attrs ) ; } - if( fullName != NULL ) + if( fullName != nullptr ) { xmlFree( const_cast<xmlChar*>(fullName) ) ; - fullName = NULL ; + fullName = nullptr ; } - if( attrs != NULL ) + if( attrs != nullptr ) { - for( int i = 0 ; attrs[i] != NULL ; ++i ) + for( int i = 0 ; attrs[i] != nullptr ; ++i ) { xmlFree( const_cast<xmlChar*>(attrs[i]) ) ; - attrs[i] = NULL ; + attrs[i] = nullptr ; } xmlFree( static_cast<void*>(attrs) ) ; - attrs = NULL ; + attrs = nullptr ; } } @@ -296,15 +296,15 @@ void SAXHelper::startElement( void SAXHelper::endElement( const OUString& aName ) throw( cssxs::SAXException , cssu::RuntimeException ) { - xmlChar* fullname = NULL ; + xmlChar* fullname = nullptr ; fullname = ous_to_xmlstr( aName ) ; m_pSaxHandler->endElement( m_pParserCtxt , fullname ) ; - if( fullname != NULL ) + if( fullname != nullptr ) { xmlFree( fullname ) ; - fullname = NULL ; + fullname = nullptr ; } } @@ -314,13 +314,13 @@ void SAXHelper::endElement( const OUString& aName ) void SAXHelper::characters( const OUString& aChars ) throw( cssxs::SAXException , cssu::RuntimeException ) { - const xmlChar* chars = NULL ; + const xmlChar* chars = nullptr ; int length = 0 ; chars = ous_to_nxmlstr( aChars, length ) ; m_pSaxHandler->characters( m_pParserCtxt , chars , length ) ; - if( chars != NULL ) + if( chars != nullptr ) { xmlFree( const_cast<xmlChar*>(chars) ) ; } @@ -332,13 +332,13 @@ void SAXHelper::characters( const OUString& aChars ) void SAXHelper::ignorableWhitespace( const OUString& aWhitespaces ) throw( cssxs::SAXException , cssu::RuntimeException ) { - const xmlChar* chars = NULL ; + const xmlChar* chars = nullptr ; int length = 0 ; chars = ous_to_nxmlstr( aWhitespaces, length ) ; m_pSaxHandler->ignorableWhitespace( m_pParserCtxt , chars , length ) ; - if( chars != NULL ) + if( chars != nullptr ) { xmlFree( const_cast<xmlChar*>(chars) ) ; } @@ -352,24 +352,24 @@ void SAXHelper::processingInstruction( const OUString& aData ) throw( cssxs::SAXException , cssu::RuntimeException ) { - xmlChar* target = NULL ; - xmlChar* data = NULL ; + xmlChar* target = nullptr ; + xmlChar* data = nullptr ; target = ous_to_xmlstr( aTarget ) ; data = ous_to_xmlstr( aData ) ; m_pSaxHandler->processingInstruction( m_pParserCtxt , target , data ) ; - if( target != NULL ) + if( target != nullptr ) { xmlFree( target ) ; - target = NULL ; + target = nullptr ; } - if( data != NULL ) + if( data != nullptr ) { xmlFree( data ) ; - data = NULL ; + data = nullptr ; } } diff --git a/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx b/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx index f61dbfeeceba..5af8716c96b8 100644 --- a/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx +++ b/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx @@ -59,8 +59,8 @@ namespace cssxw = com::sun::star::xml::wrapper; XMLDocumentWrapper_XmlSecImpl::XMLDocumentWrapper_XmlSecImpl() : m_nCurrentPosition(0) - , m_pStopAtNode(0) - , m_pCurrentReservedNode(0) + , m_pStopAtNode(nullptr) + , m_pCurrentReservedNode(nullptr) , m_nReservedNodeIndex(0) { saxHelper.startDocument(); @@ -118,7 +118,7 @@ void XMLDocumentWrapper_XmlSecImpl::getNextSAXEvent() * Email: michael.mi@sun.com ******************************************************************************/ { - OSL_ASSERT( m_pCurrentElement != NULL ); + OSL_ASSERT( m_pCurrentElement != nullptr ); /* * Get the next event through tree order. @@ -136,7 +136,7 @@ void XMLDocumentWrapper_XmlSecImpl::getNextSAXEvent() * type. Otherwise, the endElement of current node is the * next event. */ - if (m_pCurrentElement->children != NULL) + if (m_pCurrentElement->children != nullptr) { m_pCurrentElement = m_pCurrentElement->children; m_nCurrentPosition @@ -164,7 +164,7 @@ void XMLDocumentWrapper_XmlSecImpl::getNextSAXEvent() * type. Otherwise, the endElement of current node's parent * becomes the next event. */ - if (pNextSibling != NULL) + if (pNextSibling != nullptr) { m_pCurrentElement = pNextSibling; m_nCurrentPosition @@ -218,12 +218,12 @@ void XMLDocumentWrapper_XmlSecImpl::sendStartElement( xmlNsPtr pNsDef = pNode->nsDef; - while (pNsDef != NULL) + while (pNsDef != nullptr) { const xmlChar* pNsPrefix = pNsDef->prefix; const xmlChar* pNsHref = pNsDef->href; - if (pNsDef->prefix == NULL) + if (pNsDef->prefix == nullptr) { pAttributeList->AddAttribute( OUString(C2U( STRXMLNS )), @@ -243,13 +243,13 @@ void XMLDocumentWrapper_XmlSecImpl::sendStartElement( xmlAttrPtr pAttr = pNode->properties; - while (pAttr != NULL) + while (pAttr != nullptr) { const xmlChar* pAttrName = pAttr->name; xmlNsPtr pAttrNs = pAttr->ns; OUString ouAttrName; - if (pAttrNs == NULL) + if (pAttrNs == nullptr) { ouAttrName = OUString(C2U( reinterpret_cast<char const *>(pAttrName) )); } @@ -411,11 +411,11 @@ OString XMLDocumentWrapper_XmlSecImpl::getNodeQName(const xmlNodePtr pNode) ******************************************************************************/ { OString sNodeName(reinterpret_cast<const char*>(pNode->name)); - if (pNode->ns != NULL) + if (pNode->ns != nullptr) { xmlNsPtr pNs = pNode->ns; - if (pNs->prefix != NULL) + if (pNs->prefix != nullptr) { OString sPrefix(reinterpret_cast<const char*>(pNs->prefix)); sNodeName = sPrefix+OString(":")+sNodeName; @@ -449,7 +449,7 @@ xmlNodePtr XMLDocumentWrapper_XmlSecImpl::checkElement( const cssu::Reference< c * Email: michael.mi@sun.com ******************************************************************************/ { - xmlNodePtr rc = NULL; + xmlNodePtr rc = nullptr; if (xXMLElement.is()) { @@ -465,7 +465,7 @@ xmlNodePtr XMLDocumentWrapper_XmlSecImpl::checkElement( const cssu::Reference< c xNodTunnel->getSomething( XMLElementWrapper_XmlSecImpl::getUnoTunnelImplementationId() ))) ; - if( pElement == NULL ) { + if( pElement == nullptr ) { throw cssu::RuntimeException() ; } @@ -530,7 +530,7 @@ sal_Int32 XMLDocumentWrapper_XmlSecImpl::recursiveDelete( bool bIsRemoved = true; sal_Int32 nResult; - while( pChild != NULL ) + while( pChild != nullptr ) { pNextSibling = pChild->next; nResult = recursiveDelete(pChild); @@ -601,7 +601,7 @@ void XMLDocumentWrapper_XmlSecImpl::getNextReservedNode() } else { - m_pCurrentReservedNode = NULL; + m_pCurrentReservedNode = nullptr; } } @@ -633,7 +633,7 @@ void XMLDocumentWrapper_XmlSecImpl::removeNode(const xmlNodePtr pNode) const xmlAttrPtr pAttr = pNode->properties; - while (pAttr != NULL) + while (pAttr != nullptr) { if (!stricmp(reinterpret_cast<char const *>(pAttr->name), "id")) { @@ -671,15 +671,15 @@ void XMLDocumentWrapper_XmlSecImpl::buildIDAttr(xmlNodePtr pNode) const ******************************************************************************/ { xmlAttrPtr idAttr = xmlHasProp( pNode, reinterpret_cast<const unsigned char *>("id") ); - if (idAttr == NULL) + if (idAttr == nullptr) { idAttr = xmlHasProp( pNode, reinterpret_cast<const unsigned char *>("Id") ); } - if (idAttr != NULL) + if (idAttr != nullptr) { xmlChar* idValue = xmlNodeListGetString( m_pDocument, idAttr->children, 1 ) ; - xmlAddID( NULL, m_pDocument, idValue, idAttr ); + xmlAddID( nullptr, m_pDocument, idValue, idAttr ); } } @@ -706,12 +706,12 @@ void XMLDocumentWrapper_XmlSecImpl::rebuildIDLink(xmlNodePtr pNode) const * Email: michael.mi@sun.com ******************************************************************************/ { - if (pNode != NULL && pNode->type == XML_ELEMENT_NODE) + if (pNode != nullptr && pNode->type == XML_ELEMENT_NODE) { buildIDAttr( pNode ); xmlNodePtr child = pNode->children; - while (child != NULL) + while (child != nullptr) { rebuildIDLink(child); child = child->next; @@ -737,7 +737,7 @@ void SAL_CALL XMLDocumentWrapper_XmlSecImpl::setCurrentElement( const cssu::Refe void SAL_CALL XMLDocumentWrapper_XmlSecImpl::removeCurrentElement( ) throw (cssu::RuntimeException, std::exception) { - OSL_ASSERT( m_pCurrentElement != NULL ); + OSL_ASSERT( m_pCurrentElement != nullptr ); xmlNodePtr pOldCurrentElement = m_pCurrentElement; @@ -772,7 +772,7 @@ sal_Bool SAL_CALL XMLDocumentWrapper_XmlSecImpl::isCurrentElementEmpty( ) { bool rc = false; - if (m_pCurrentElement->children == NULL) + if (m_pCurrentElement->children == nullptr) { rc = true; } @@ -810,9 +810,9 @@ void SAL_CALL XMLDocumentWrapper_XmlSecImpl::collapse( const cssu::Reference< cs xmlNodePtr pTargetNode = checkElement(node); xmlNodePtr pParent; - while (pTargetNode != NULL) + while (pTargetNode != nullptr) { - if (pTargetNode->children != NULL || pTargetNode == m_pCurrentElement) + if (pTargetNode->children != nullptr || pTargetNode == m_pCurrentElement) { break; } @@ -826,7 +826,7 @@ void SAL_CALL XMLDocumentWrapper_XmlSecImpl::collapse( const cssu::Reference< cs void SAL_CALL XMLDocumentWrapper_XmlSecImpl::getTree( const cssu::Reference< cssxs::XDocumentHandler >& handler ) throw (cssxs::SAXException, cssu::RuntimeException, std::exception) { - if (m_pRootElement != NULL) + if (m_pRootElement != nullptr) { xmlNodePtr pTempCurrentElement = m_pCurrentElement; sal_Int32 nTempCurrentPosition = m_nCurrentPosition; @@ -841,13 +841,13 @@ void SAL_CALL XMLDocumentWrapper_XmlSecImpl::getTree( const cssu::Reference< css switch (m_nCurrentPosition) { case NODEPOSITION_STARTELEMENT: - sendStartElement(NULL, xHandler, m_pCurrentElement); + sendStartElement(nullptr, xHandler, m_pCurrentElement); break; case NODEPOSITION_ENDELEMENT: - sendEndElement(NULL, xHandler, m_pCurrentElement); + sendEndElement(nullptr, xHandler, m_pCurrentElement); break; case NODEPOSITION_NORMAL: - sendNode(NULL, xHandler, m_pCurrentElement); + sendNode(nullptr, xHandler, m_pCurrentElement); break; } @@ -875,7 +875,7 @@ void SAL_CALL XMLDocumentWrapper_XmlSecImpl::generateSAXEvents( * The first SAX event is the startElement of the startNode * element. */ - bool bHasCurrentElementChild = (m_pCurrentElement->children != NULL); + bool bHasCurrentElementChild = (m_pCurrentElement->children != nullptr); xmlNodePtr pTempCurrentElement = m_pCurrentElement; @@ -915,10 +915,10 @@ void SAL_CALL XMLDocumentWrapper_XmlSecImpl::generateSAXEvents( if (xSAXEventKeeper->isBlocking()) { - xHandler = NULL; + xHandler = nullptr; } - if (pEndNode == NULL && + if (pEndNode == nullptr && ((bHasCurrentElementChild && m_pCurrentElement == xmlGetLastChild(pTempCurrentElement) && m_nCurrentPosition != NODEPOSITION_STARTELEMENT) || (!bHasCurrentElementChild && m_pCurrentElement == pTempCurrentElement && m_nCurrentPosition == NODEPOSITION_STARTELEMENT))) { @@ -932,7 +932,7 @@ void SAL_CALL XMLDocumentWrapper_XmlSecImpl::generateSAXEvents( * the current node equals to the end point. If so, stop * generating. */ - if (pEndNode != NULL && m_pCurrentElement == pEndNode) + if (pEndNode != nullptr && m_pCurrentElement == pEndNode) { break; } diff --git a/xmlsecurity/source/xmlsec/xmlelementwrapper_xmlsecimpl.cxx b/xmlsecurity/source/xmlsec/xmlelementwrapper_xmlsecimpl.cxx index d8de87ac82a3..14e6ff342827 100644 --- a/xmlsecurity/source/xmlsec/xmlelementwrapper_xmlsecimpl.cxx +++ b/xmlsecurity/source/xmlsec/xmlelementwrapper_xmlsecimpl.cxx @@ -40,7 +40,7 @@ XMLElementWrapper_XmlSecImpl::XMLElementWrapper_XmlSecImpl(const xmlNodePtr pNod cssu::Sequence< sal_Int8 > XMLElementWrapper_XmlSecImpl::getUnoTunnelImplementationId() throw (cssu::RuntimeException) { - static ::cppu::OImplementationId* pId = 0; + static ::cppu::OImplementationId* pId = nullptr; if (! pId) { ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); @@ -91,7 +91,7 @@ cssu::Reference< cssu::XInterface > SAL_CALL const cssu::Reference< cssu::XComponentContext > &) throw( cssu::Exception ) { - return static_cast<cppu::OWeakObject*>(new XMLElementWrapper_XmlSecImpl(NULL)); + return static_cast<cppu::OWeakObject*>(new XMLElementWrapper_XmlSecImpl(nullptr)); } /* XServiceInfo */ diff --git a/xmlsecurity/source/xmlsec/xmlstreamio.cxx b/xmlsecurity/source/xmlsec/xmlstreamio.cxx index 47648708e041..144965231285 100644 --- a/xmlsecurity/source/xmlsec/xmlstreamio.cxx +++ b/xmlsecurity/source/xmlsec/xmlstreamio.cxx @@ -46,7 +46,7 @@ int xmlStreamMatch( const char* uri ) if( ( enableXmlStreamIO & XMLSTREAMIO_INITIALIZED ) && ( enableXmlStreamIO & XMLSTREAMIO_REGISTERED ) ) { - if( uri == NULL || !m_xUriBinding.is() ) + if( uri == nullptr || !m_xUriBinding.is() ) return 0 ; //XMLSec first unescapes the uri and calls this function. For example, we pass the Uri //ObjectReplacements/Object%201 then XMLSec passes ObjectReplacements/Object 1 @@ -78,8 +78,8 @@ void* xmlStreamOpen( const char* uri ) if( ( enableXmlStreamIO & XMLSTREAMIO_INITIALIZED ) && ( enableXmlStreamIO & XMLSTREAMIO_REGISTERED ) ) { - if( uri == NULL || !m_xUriBinding.is() ) - return NULL ; + if( uri == nullptr || !m_xUriBinding.is() ) + return nullptr ; //see xmlStreamMatch OUString sUri = @@ -102,7 +102,7 @@ void* xmlStreamOpen( const char* uri ) } } - return NULL ; + return nullptr ; } extern "C" @@ -115,7 +115,7 @@ int xmlStreamRead( void* context, char* buffer, int len ) numbers = 0 ; if( ( enableXmlStreamIO & XMLSTREAMIO_INITIALIZED ) && ( enableXmlStreamIO & XMLSTREAMIO_REGISTERED ) ) { - if( context != NULL ) { + if( context != nullptr ) { xInputStream = static_cast<com::sun::star::io::XInputStream*>(context); if( !xInputStream.is() ) return 0 ; @@ -135,7 +135,7 @@ int xmlStreamClose( void * context ) { if( ( enableXmlStreamIO & XMLSTREAMIO_INITIALIZED ) && ( enableXmlStreamIO & XMLSTREAMIO_REGISTERED ) ) { - if( context != NULL ) { + if( context != nullptr ) { ::com::sun::star::io::XInputStream* pInputStream ; pInputStream = static_cast<css::io::XInputStream*>(context); pInputStream->release() ; diff --git a/xmlsecurity/source/xmlsec/xsec_xmlsec.cxx b/xmlsecurity/source/xmlsec/xsec_xmlsec.cxx index c07f3018602b..8f0777c86343 100644 --- a/xmlsecurity/source/xmlsec/xsec_xmlsec.cxx +++ b/xmlsecurity/source/xmlsec/xsec_xmlsec.cxx @@ -36,10 +36,10 @@ extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL xsec_xmlsec_component_getFactory( const sal_Char* pImplName , void* pServiceManager , void* pRegistryKey ) { - void* pRet = 0; + void* pRet = nullptr; Reference< XInterface > xFactory ; - if( pImplName != NULL ) { + if( pImplName != nullptr ) { if( XMLElementWrapper_XmlSecImpl_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) ) { xFactory = cppu::createSingleComponentFactory( @@ -68,7 +68,7 @@ SAL_DLLPUBLIC_EXPORT void* SAL_CALL xsec_xmlsec_component_getFactory( const sal_ pRet = xFactory.get() ; } else { pRet = nss_component_getFactory( pImplName, pServiceManager, pRegistryKey ) ; - if( pRet != NULL ) + if( pRet != nullptr ) return pRet ; #if defined( XMLSEC_CRYPTO_MSCRYPTO ) |