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