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/source/xmlsec/nss | |
parent | 6de82da0c154a0e8a353125aa80a61779abfd3ba (diff) |
loplugin:nullptr (automatic rewrite)
Change-Id: I2093e93e07ff19a1a1d2c8b6f221dac2bf2a2613
Diffstat (limited to 'xmlsecurity/source/xmlsec/nss')
12 files changed, 167 insertions, 167 deletions
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 ) ) ) |