diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-10-14 16:42:51 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-10-15 07:59:26 +0000 |
commit | 774e51d44c3bab7652c8807bbf2ed68293b47a6e (patch) | |
tree | 253d73eb26097a71731edc28b0362f01690f4b50 /xmlsecurity/source/xmlsec | |
parent | f8854116e1c3bbe971dcb754f7db501d5302b651 (diff) |
clang-cl loplugin: xmlsecurity
Change-Id: Ic101384ca32abb0d527f97d2cf695eb19c66da86
Reviewed-on: https://gerrit.libreoffice.org/29838
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'xmlsecurity/source/xmlsec')
18 files changed, 312 insertions, 312 deletions
diff --git a/xmlsecurity/source/xmlsec/biginteger.cxx b/xmlsecurity/source/xmlsec/biginteger.cxx index 5b7075c47e47..331e853a7f9b 100644 --- a/xmlsecurity/source/xmlsec/biginteger.cxx +++ b/xmlsecurity/source/xmlsec/biginteger.cxx @@ -64,7 +64,7 @@ Sequence< sal_Int8 > numericStringToBigInteger ( const OUString& numeral ) } Sequence< sal_Int8 > integer( length ) ; - for( unsigned int i = 0 ; i < length ; i ++ ) + for( xmlSecSize i = 0 ; i < length ; i ++ ) { integer[i] = *( bnInteger + i ) ; } diff --git a/xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.cxx index 4cc81a68403a..c5ce74dbf400 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.cxx +++ b/xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.cxx @@ -35,7 +35,7 @@ using ::com::sun::star::security::XCertificateExtension ; SanExtensionImpl::SanExtensionImpl() : - m_critical( sal_False ) + m_critical( false ) { } @@ -63,7 +63,7 @@ css::uno::Sequence< css::security::CertAltNameEntry > SAL_CALL SanExtensionImpl: { CERT_ALT_NAME_INFO *subjectName; DWORD size; - CryptDecodeObjectEx(X509_ASN_ENCODING, X509_ALTERNATE_NAME, (unsigned char*) m_xExtnValue.getArray(), m_xExtnValue.getLength(), CRYPT_DECODE_ALLOC_FLAG | CRYPT_DECODE_NOCOPY_FLAG, NULL,&subjectName, &size); + CryptDecodeObjectEx(X509_ASN_ENCODING, X509_ALTERNATE_NAME, reinterpret_cast<unsigned char*>(m_xExtnValue.getArray()), m_xExtnValue.getLength(), CRYPT_DECODE_ALLOC_FLAG | CRYPT_DECODE_NOCOPY_FLAG, nullptr,&subjectName, &size); CertAltNameEntry* arrCertAltNameEntry = new CertAltNameEntry[subjectName->cAltEntry]; @@ -90,11 +90,11 @@ css::uno::Sequence< css::security::CertAltNameEntry > SAL_CALL SanExtensionImpl: } case CERT_ALT_NAME_RFC822_NAME : arrCertAltNameEntry[i].Type = ExtAltNameType_RFC822_NAME; - arrCertAltNameEntry[i].Value <<= OUString((const sal_Unicode*)pEntry->pwszRfc822Name); + arrCertAltNameEntry[i].Value <<= OUString(pEntry->pwszRfc822Name); break; case CERT_ALT_NAME_DNS_NAME : arrCertAltNameEntry[i].Type = ExtAltNameType_DNS_NAME; - arrCertAltNameEntry[i].Value <<= OUString((const sal_Unicode*)pEntry->pwszDNSName); + arrCertAltNameEntry[i].Value <<= OUString(pEntry->pwszDNSName); break; case CERT_ALT_NAME_DIRECTORY_NAME : { @@ -103,7 +103,7 @@ css::uno::Sequence< css::security::CertAltNameEntry > SAL_CALL SanExtensionImpl: } case CERT_ALT_NAME_URL : arrCertAltNameEntry[i].Type = ExtAltNameType_URL; - arrCertAltNameEntry[i].Value <<= OUString((const sal_Unicode*)pEntry->pwszURL); + arrCertAltNameEntry[i].Value <<= OUString(pEntry->pwszURL); break; case CERT_ALT_NAME_IP_ADDRESS : { diff --git a/xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.hxx b/xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.hxx index 5bd90dcfbea6..c4e391a65fa9 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.hxx +++ b/xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.hxx @@ -42,7 +42,7 @@ class SanExtensionImpl : public ::cppu::WeakImplHelper< css::security::XSanExtension > { private: - sal_Bool m_critical ; + bool m_critical ; css::uno::Sequence< sal_Int8 > m_xExtnId ; css::uno::Sequence< sal_Int8 > m_xExtnValue ; @@ -50,21 +50,21 @@ class SanExtensionImpl : public ::cppu::WeakImplHelper< public: SanExtensionImpl() ; - virtual ~SanExtensionImpl() ; + virtual ~SanExtensionImpl() override; //Methods from XCertificateExtension - virtual sal_Bool SAL_CALL isCritical() throw( css::uno::RuntimeException ) ; + virtual sal_Bool SAL_CALL isCritical() throw( css::uno::RuntimeException ) override; - virtual css::uno::Sequence< sal_Int8 > SAL_CALL getExtensionId() throw( css::uno::RuntimeException ) ; + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getExtensionId() throw( css::uno::RuntimeException ) override; - virtual css::uno::Sequence< sal_Int8 > SAL_CALL getExtensionValue() throw( css::uno::RuntimeException ) ; + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getExtensionValue() throw( css::uno::RuntimeException ) override; //Methods from XSanExtension - virtual css::uno::Sequence< css::security::CertAltNameEntry > SAL_CALL getAlternativeNames() throw( css::uno::RuntimeException ) ; + virtual css::uno::Sequence< css::security::CertAltNameEntry > SAL_CALL getAlternativeNames() throw( css::uno::RuntimeException ) override; //Helper method - void setCertExtn( unsigned char* value, unsigned int vlen, unsigned char* id, unsigned int idlen, sal_Bool critical ) ; + void setCertExtn( unsigned char* value, unsigned int vlen, unsigned char* id, unsigned int idlen, bool critical ) ; } ; #endif // INCLUDED_XMLSECURITY_SOURCE_XMLSEC_MSCRYPT_SANEXTENSION_MSCRYPTIMPL_HXX diff --git a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx index 30295452e2d2..955f0bbaf7f4 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx +++ b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx @@ -105,7 +105,7 @@ void traceTrustStatus(DWORD err) } } -SecurityEnvironment_MSCryptImpl::SecurityEnvironment_MSCryptImpl( const Reference< XMultiServiceFactory >& aFactory ) : m_hProv( NULL ) , m_pszContainer( NULL ) , m_hKeyStore( NULL ), m_hCertStore( NULL ), m_hMySystemStore(NULL), m_hRootSystemStore(NULL), m_hTrustSystemStore(NULL), m_hCaSystemStore(NULL), m_bEnableDefault( sal_False ), m_tSymKeyList() , m_tPubKeyList() , m_tPriKeyList(), m_xServiceManager( aFactory ){ +SecurityEnvironment_MSCryptImpl::SecurityEnvironment_MSCryptImpl( const Reference< XMultiServiceFactory >& aFactory ) : m_hProv( NULL ) , m_pszContainer( nullptr ) , m_hKeyStore( nullptr ), m_hCertStore( nullptr ), m_hMySystemStore(nullptr), m_hRootSystemStore(nullptr), m_hTrustSystemStore(nullptr), m_hCaSystemStore(nullptr), m_bEnableDefault( false ), m_tSymKeyList() , m_tPubKeyList() , m_tPriKeyList(), m_xServiceManager( aFactory ){ } @@ -116,40 +116,40 @@ SecurityEnvironment_MSCryptImpl::~SecurityEnvironment_MSCryptImpl() { m_hProv = NULL ; } - if( m_pszContainer != NULL ) { + if( m_pszContainer != nullptr ) { //TODO: Don't know whether or not it should be released now. - m_pszContainer = NULL ; + m_pszContainer = nullptr ; } - if( m_hCertStore != NULL ) { + if( m_hCertStore != nullptr ) { CertCloseStore( m_hCertStore, CERT_CLOSE_STORE_FORCE_FLAG ) ; - m_hCertStore = NULL ; + m_hCertStore = nullptr ; } - if( m_hKeyStore != NULL ) { + if( m_hKeyStore != nullptr ) { CertCloseStore( m_hKeyStore, CERT_CLOSE_STORE_FORCE_FLAG ) ; - m_hKeyStore = NULL ; + m_hKeyStore = nullptr ; } //i120675, close the store handles - if( m_hMySystemStore != NULL ) { + if( m_hMySystemStore != nullptr ) { CertCloseStore( m_hMySystemStore, CERT_CLOSE_STORE_CHECK_FLAG ) ; - m_hMySystemStore = NULL ; + m_hMySystemStore = nullptr ; } - if( m_hRootSystemStore != NULL ) { + if( m_hRootSystemStore != nullptr ) { CertCloseStore( m_hRootSystemStore, CERT_CLOSE_STORE_CHECK_FLAG ) ; - m_hRootSystemStore = NULL ; + m_hRootSystemStore = nullptr ; } - if( m_hTrustSystemStore != NULL ) { + if( m_hTrustSystemStore != nullptr ) { CertCloseStore( m_hTrustSystemStore, CERT_CLOSE_STORE_CHECK_FLAG ) ; - m_hTrustSystemStore = NULL ; + m_hTrustSystemStore = nullptr ; } - if( m_hCaSystemStore != NULL ) { + if( m_hCaSystemStore != nullptr ) { CertCloseStore( m_hCaSystemStore, CERT_CLOSE_STORE_CHECK_FLAG ) ; - m_hCaSystemStore = NULL ; + m_hCaSystemStore = nullptr ; } if( !m_tSymKeyList.empty() ) { @@ -186,9 +186,9 @@ sal_Bool SAL_CALL SecurityEnvironment_MSCryptImpl::supportsService( const OUStri const OUString* pArray = seqServiceNames.getConstArray() ; for( sal_Int32 i = 0 ; i < seqServiceNames.getLength() ; i ++ ) { if( *( pArray + i ) == serviceName ) - return sal_True ; + return true ; } - return sal_False ; + return false ; } /* XServiceInfo */ @@ -221,7 +221,7 @@ sal_Int64 SAL_CALL SecurityEnvironment_MSCryptImpl::getSomething( const Sequence throw( RuntimeException ) { if( aIdentifier.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(), aIdentifier.getConstArray(), 16 ) ) { - return ( sal_Int64 )this ; + return reinterpret_cast<sal_Int64>(this); } return 0 ; } @@ -242,9 +242,9 @@ const Sequence< sal_Int8>& SecurityEnvironment_MSCryptImpl::getUnoTunnelId() { SecurityEnvironment_MSCryptImpl* SecurityEnvironment_MSCryptImpl::getImplementation( const Reference< XInterface >& rObj ) { Reference< XUnoTunnel > xUT( rObj , UNO_QUERY ) ; if( xUT.is() ) { - return ( SecurityEnvironment_MSCryptImpl* )xUT->getSomething( getUnoTunnelId() ) ; + return reinterpret_cast<SecurityEnvironment_MSCryptImpl*>(xUT->getSomething( getUnoTunnelId() )); } else - return NULL ; + return nullptr ; } /* Native methods */ @@ -278,12 +278,12 @@ HCERTSTORE SecurityEnvironment_MSCryptImpl::getCryptoSlot() throw( Exception , R } void SecurityEnvironment_MSCryptImpl::setCryptoSlot( HCERTSTORE aSlot) throw( Exception , RuntimeException ) { - if( m_hKeyStore != NULL ) { + if( m_hKeyStore != nullptr ) { CertCloseStore( m_hKeyStore, CERT_CLOSE_STORE_FORCE_FLAG ) ; - m_hKeyStore = NULL ; + m_hKeyStore = nullptr ; } - if( aSlot != NULL ) { + if( aSlot != nullptr ) { m_hKeyStore = CertDuplicateStore( aSlot ) ; } } @@ -293,12 +293,12 @@ HCERTSTORE SecurityEnvironment_MSCryptImpl::getCertDb() throw( Exception , Runti } void SecurityEnvironment_MSCryptImpl::setCertDb( HCERTSTORE aCertDb ) throw( Exception , RuntimeException ) { - if( m_hCertStore != NULL ) { + if( m_hCertStore != nullptr ) { CertCloseStore( m_hCertStore, CERT_CLOSE_STORE_FORCE_FLAG ) ; - m_hCertStore = NULL ; + m_hCertStore = nullptr ; } - if( aCertDb != NULL ) { + if( aCertDb != nullptr ) { m_hCertStore = CertDuplicateStore( aCertDb ) ; } } @@ -375,17 +375,17 @@ static void get_system_name(const void *pvSystemStore, DWORD dwFlags, LPCWSTR *ppwszSystemName) { - *ppwszSystemName = NULL; + *ppwszSystemName = nullptr; if (dwFlags & CERT_SYSTEM_STORE_RELOCATE_FLAG) { - PCERT_SYSTEM_STORE_RELOCATE_PARA pRelocatePara; - pRelocatePara = (PCERT_SYSTEM_STORE_RELOCATE_PARA) pvSystemStore; + _CERT_SYSTEM_STORE_RELOCATE_PARA const * pRelocatePara; + pRelocatePara = static_cast<_CERT_SYSTEM_STORE_RELOCATE_PARA const *>(pvSystemStore); *ppwszSystemName = pRelocatePara->pwszSystemStore; } else { - *ppwszSystemName = (LPCWSTR) pvSystemStore; + *ppwszSystemName = static_cast<LPCWSTR>(pvSystemStore); } } @@ -417,7 +417,7 @@ extern "C" BOOL WINAPI cert_enum_system_store_callback(const void *pvSystemStore if (!CertEnumPhysicalStore(pvSystemStore, dwFlags, - NULL, + nullptr, cert_enum_physical_store_callback)) { DWORD dwErr = GetLastError(); @@ -438,15 +438,15 @@ Sequence< Reference < XCertificate > > SecurityEnvironment_MSCryptImpl::getPerso sal_Int32 length ; X509Certificate_MSCryptImpl* xcert ; std::list< X509Certificate_MSCryptImpl* > certsList ; - PCCERT_CONTEXT pCertContext = NULL; + PCCERT_CONTEXT pCertContext = nullptr; //firstly, we try to find private keys in given key store. - if( m_hKeyStore != NULL ) { + if( m_hKeyStore != nullptr ) { pCertContext = CertEnumCertificatesInStore( m_hKeyStore, pCertContext ); while (pCertContext) { xcert = MswcryCertContextToXCert( pCertContext ) ; - if( xcert != NULL ) + if( xcert != nullptr ) certsList.push_back( xcert ) ; pCertContext = CertEnumCertificatesInStore( m_hKeyStore, pCertContext ); } @@ -464,21 +464,21 @@ Sequence< Reference < XCertificate > > SecurityEnvironment_MSCryptImpl::getPerso HCRYPTPROV hCryptProv; #ifdef SAL_LOG_INFO - CertEnumSystemStore(CERT_SYSTEM_STORE_CURRENT_USER, NULL, NULL, cert_enum_system_store_callback); + CertEnumSystemStore(CERT_SYSTEM_STORE_CURRENT_USER, nullptr, nullptr, cert_enum_system_store_callback); #endif hSystemKeyStore = CertOpenSystemStore( 0, "MY" ) ; - if( hSystemKeyStore != NULL ) { + if( hSystemKeyStore != nullptr ) { pCertContext = CertEnumCertificatesInStore( hSystemKeyStore, pCertContext ); while (pCertContext) { // for checking whether the certificate is a personal certificate or not. if(!(CryptAcquireCertificatePrivateKey(pCertContext, CRYPT_ACQUIRE_COMPARE_KEY_FLAG, - NULL, + nullptr, &hCryptProv, &dwKeySpec, - NULL))) + nullptr))) { // Not Privatekey found. SKIP this one. pCertContext = CertEnumCertificatesInStore( hSystemKeyStore, pCertContext ); @@ -487,7 +487,7 @@ Sequence< Reference < XCertificate > > SecurityEnvironment_MSCryptImpl::getPerso // then TODO : Check the personal cert is valid or not. xcert = MswcryCertContextToXCert( pCertContext ) ; - if( xcert != NULL ) + if( xcert != nullptr ) certsList.push_back( xcert ) ; pCertContext = CertEnumCertificatesInStore( hSystemKeyStore, pCertContext ); } @@ -515,35 +515,35 @@ Sequence< Reference < XCertificate > > SecurityEnvironment_MSCryptImpl::getPerso Reference< XCertificate > SecurityEnvironment_MSCryptImpl::getCertificate( const OUString& issuerName, const Sequence< sal_Int8 >& serialNumber ) throw( SecurityException , RuntimeException ) { unsigned int i ; - LPSTR pszName ; - X509Certificate_MSCryptImpl *xcert = NULL ; - PCCERT_CONTEXT pCertContext = NULL ; - HCERTSTORE hCertStore = NULL ; + LPCSTR pszName ; + X509Certificate_MSCryptImpl *xcert = nullptr ; + PCCERT_CONTEXT pCertContext = nullptr ; + HCERTSTORE hCertStore = nullptr ; CRYPT_INTEGER_BLOB cryptSerialNumber ; CERT_INFO certInfo ; // for correct encoding sal_uInt16 encoding ; - rtl_Locale *pLocale = NULL ; + rtl_Locale *pLocale = nullptr ; osl_getProcessLocale( &pLocale ) ; encoding = osl_getTextEncodingFromLocale( pLocale ) ; //Create cert info from issue and serial OString oissuer = OUStringToOString( issuerName , encoding ) ; - pszName = ( char* )oissuer.getStr() ; + pszName = oissuer.getStr() ; if( ! ( CertStrToName( X509_ASN_ENCODING | PKCS_7_ASN_ENCODING , pszName , CERT_X500_NAME_STR | CERT_NAME_STR_REVERSE_FLAG | CERT_NAME_STR_ENABLE_UTF8_UNICODE_FLAG, - NULL , - NULL , - &certInfo.Issuer.cbData, NULL ) ) + nullptr , + nullptr , + &certInfo.Issuer.cbData, nullptr ) ) ) { - return NULL ; + return nullptr ; } - certInfo.Issuer.pbData = ( BYTE* )malloc( certInfo.Issuer.cbData ); + certInfo.Issuer.pbData = static_cast<BYTE*>(malloc( certInfo.Issuer.cbData )); if(!certInfo.Issuer.pbData) throw RuntimeException() ; @@ -551,17 +551,17 @@ Reference< XCertificate > SecurityEnvironment_MSCryptImpl::getCertificate( const X509_ASN_ENCODING | PKCS_7_ASN_ENCODING , pszName , CERT_X500_NAME_STR | CERT_NAME_STR_REVERSE_FLAG | CERT_NAME_STR_ENABLE_UTF8_UNICODE_FLAG, - NULL , - ( BYTE* )certInfo.Issuer.pbData , - &certInfo.Issuer.cbData, NULL ) ) + nullptr , + certInfo.Issuer.pbData , + &certInfo.Issuer.cbData, nullptr ) ) ) { free( certInfo.Issuer.pbData ) ; - return NULL ; + return nullptr ; } //Get the SerialNumber cryptSerialNumber.cbData = serialNumber.getLength() ; - cryptSerialNumber.pbData = ( BYTE* )malloc( cryptSerialNumber.cbData); + cryptSerialNumber.pbData = static_cast<BYTE*>(malloc( cryptSerialNumber.cbData)); if (!cryptSerialNumber.pbData) { free( certInfo.Issuer.pbData ) ; @@ -579,28 +579,28 @@ Reference< XCertificate > SecurityEnvironment_MSCryptImpl::getCertificate( const switch(i) { case 0: - if(m_hKeyStore == NULL) continue ; + if(m_hKeyStore == nullptr) continue ; hCertStore = m_hKeyStore ; break; case 1: - if(m_hCertStore == NULL) continue ; + if(m_hCertStore == nullptr) continue ; hCertStore = m_hCertStore ; break; case 2: hCertStore = CertOpenSystemStore( 0, "MY" ) ; - if(hCertStore == NULL || !m_bEnableDefault) continue ; + if(hCertStore == nullptr || !m_bEnableDefault) continue ; break; case 3: hCertStore = CertOpenSystemStore( 0, "Root" ) ; - if(hCertStore == NULL || !m_bEnableDefault) continue ; + if(hCertStore == nullptr || !m_bEnableDefault) continue ; break; case 4: hCertStore = CertOpenSystemStore( 0, "Trust" ) ; - if(hCertStore == NULL || !m_bEnableDefault) continue ; + if(hCertStore == nullptr || !m_bEnableDefault) continue ; break; case 5: hCertStore = CertOpenSystemStore( 0, "CA" ) ; - if(hCertStore == NULL || !m_bEnableDefault) continue ; + if(hCertStore == nullptr || !m_bEnableDefault) continue ; break; default: i=6; @@ -689,22 +689,22 @@ Reference< XCertificate > SecurityEnvironment_MSCryptImpl::getCertificate( const 0, CERT_FIND_SUBJECT_CERT, &certInfo, - NULL + nullptr ) ; if(i != 0 && i != 1) CertCloseStore( hCertStore, CERT_CLOSE_STORE_CHECK_FLAG ) ; - if( pCertContext != NULL ) break ; // Found the certificate. + if( pCertContext != nullptr ) break ; // Found the certificate. } if( cryptSerialNumber.pbData ) free( cryptSerialNumber.pbData ) ; if( certInfo.Issuer.pbData ) free( certInfo.Issuer.pbData ) ; - if( pCertContext != NULL ) { + if( pCertContext != nullptr ) { xcert = MswcryCertContextToXCert( pCertContext ) ; if( pCertContext ) CertFreeCertificateContext( pCertContext ) ; } else { - xcert = NULL ; + xcert = nullptr ; } return xcert ; @@ -725,7 +725,7 @@ Sequence< Reference < XCertificate > > SecurityEnvironment_MSCryptImpl::buildCer CERT_CHAIN_PARA chainPara ; enhKeyUsage.cUsageIdentifier = 0 ; - enhKeyUsage.rgpszUsageIdentifier = NULL ; + enhKeyUsage.rgpszUsageIdentifier = nullptr ; certUsage.dwType = USAGE_MATCH_TYPE_AND ; certUsage.Usage = enhKeyUsage ; chainPara.cbSize = sizeof( CERT_CHAIN_PARA ) ; @@ -736,20 +736,20 @@ Sequence< Reference < XCertificate > > SecurityEnvironment_MSCryptImpl::buildCer throw RuntimeException() ; } - xcert = ( X509Certificate_MSCryptImpl* )xCertTunnel->getSomething( X509Certificate_MSCryptImpl::getUnoTunnelId() ) ; - if( xcert == NULL ) { + xcert = reinterpret_cast<X509Certificate_MSCryptImpl*>(xCertTunnel->getSomething( X509Certificate_MSCryptImpl::getUnoTunnelId() )); + if( xcert == nullptr ) { throw RuntimeException() ; } pCertContext = xcert->getMswcryCert() ; - pChainContext = NULL ; + pChainContext = nullptr ; BOOL bChain = FALSE; - if( pCertContext != NULL ) + if( pCertContext != nullptr ) { - HCERTSTORE hAdditionalStore = NULL; - HCERTSTORE hCollectionStore = NULL; + HCERTSTORE hAdditionalStore = nullptr; + HCERTSTORE hCollectionStore = nullptr; if (m_hCertStore && m_hKeyStore) { //Merge m_hCertStore and m_hKeyStore into one store. @@ -758,9 +758,9 @@ Sequence< Reference < XCertificate > > SecurityEnvironment_MSCryptImpl::buildCer 0 , NULL , 0 , - NULL + nullptr ) ; - if (hCollectionStore != NULL) + if (hCollectionStore != nullptr) { CertAddStoreToCollection ( hCollectionStore , @@ -778,31 +778,31 @@ Sequence< Reference < XCertificate > > SecurityEnvironment_MSCryptImpl::buildCer } //if the merge of both stores failed then we add only m_hCertStore - if (hAdditionalStore == NULL && m_hCertStore) + if (hAdditionalStore == nullptr && m_hCertStore) hAdditionalStore = m_hCertStore; - else if (hAdditionalStore == NULL && m_hKeyStore) + else if (hAdditionalStore == nullptr && m_hKeyStore) hAdditionalStore = m_hKeyStore; else - hAdditionalStore = NULL; + hAdditionalStore = nullptr; //CertGetCertificateChain searches by default in MY, CA, ROOT and TRUST bChain = CertGetCertificateChain( - NULL , + nullptr , pCertContext , - NULL , //use current system time + nullptr , //use current system time hAdditionalStore, &chainPara , CERT_CHAIN_REVOCATION_CHECK_CHAIN | CERT_CHAIN_TIMESTAMP_TIME , - NULL , + nullptr , &pChainContext); if (!bChain) - pChainContext = NULL; + pChainContext = nullptr; //Close the additional store CertCloseStore(hCollectionStore, CERT_CLOSE_STORE_CHECK_FLAG); } - if(bChain && pChainContext != NULL && pChainContext->cChain > 0 ) + if(bChain && pChainContext != nullptr && pChainContext->cChain > 0 ) { PCCERT_CONTEXT pCertInChain ; PCERT_SIMPLE_CHAIN pCertChain ; @@ -816,17 +816,17 @@ Sequence< Reference < XCertificate > > SecurityEnvironment_MSCryptImpl::buildCer if( pCertChain->rgpElement[i] ) pCertInChain = pCertChain->rgpElement[i]->pCertContext ; else - pCertInChain = NULL ; + pCertInChain = nullptr ; - if( pCertInChain != NULL ) { + if( pCertInChain != nullptr ) { pCert = MswcryCertContextToXCert( pCertInChain ) ; - if( pCert != NULL ) + if( pCert != nullptr ) xCertChain[i] = pCert ; } } CertFreeCertificateChain( pChainContext ) ; - pChainContext = NULL ; + pChainContext = nullptr ; return xCertChain ; } @@ -844,7 +844,7 @@ Reference< XCertificate > SecurityEnvironment_MSCryptImpl::createCertificateFrom xcert = new X509Certificate_MSCryptImpl() ; xcert->setRawCert( rawCertificate ) ; } else { - xcert = NULL ; + xcert = nullptr ; } return xcert ; @@ -856,12 +856,12 @@ Reference< XCertificate > SecurityEnvironment_MSCryptImpl::createCertificateFrom OString oscert = OUStringToOString( asciiCertificate , RTL_TEXTENCODING_ASCII_US ) ; - chCert = xmlStrndup( ( const xmlChar* )oscert.getStr(), ( int )oscert.getLength() ) ; + chCert = xmlStrndup( reinterpret_cast<const xmlChar*>(oscert.getStr()), ( int )oscert.getLength() ) ; - certSize = xmlSecBase64Decode( chCert, ( xmlSecByte* )chCert, xmlStrlen( chCert ) ) ; + certSize = xmlSecBase64Decode( chCert, chCert, xmlStrlen( chCert ) ) ; Sequence< sal_Int8 > rawCert( certSize ) ; - for( unsigned int i = 0 ; i < certSize ; i ++ ) + for( xmlSecSize i = 0 ; i < certSize ; i ++ ) rawCert[i] = *( chCert + i ) ; xmlFree( chCert ) ; @@ -873,11 +873,11 @@ Reference< XCertificate > SecurityEnvironment_MSCryptImpl::createCertificateFrom HCERTSTORE getCertStoreForIntermediatCerts( const Sequence< Reference< css::security::XCertificate > >& seqCerts) { - HCERTSTORE store = NULL; + HCERTSTORE store = nullptr; store = CertOpenStore( - CERT_STORE_PROV_MEMORY, 0, NULL, 0, NULL); - if (store == NULL) - return NULL; + CERT_STORE_PROV_MEMORY, 0, NULL, 0, nullptr); + if (store == nullptr) + return nullptr; for (int i = 0; i < seqCerts.getLength(); i++) { @@ -885,10 +885,10 @@ HCERTSTORE getCertStoreForIntermediatCerts( Sequence<sal_Int8> data = seqCerts[i]->getEncoded(); PCCERT_CONTEXT cert = CertCreateCertificateContext( - X509_ASN_ENCODING, ( const BYTE* )&data[0], data.getLength()); + X509_ASN_ENCODING, reinterpret_cast<const BYTE*>(&data[0]), data.getLength()); //Adding the certificate creates a copy and not just increases the ref count //Therefore we free later the certificate that we now add - CertAddCertificateContextToStore(store, cert, CERT_STORE_ADD_ALWAYS, NULL); + CertAddCertificateContextToStore(store, cert, CERT_STORE_ADD_ALWAYS, nullptr); CertFreeCertificateContext(cert); } return store; @@ -904,9 +904,9 @@ sal_Int32 SecurityEnvironment_MSCryptImpl::verifyCertificate( throw( css::uno::SecurityException, css::uno::RuntimeException ) { sal_Int32 validity = 0; - PCCERT_CHAIN_CONTEXT pChainContext = NULL; - PCCERT_CONTEXT pCertContext = NULL; - const X509Certificate_MSCryptImpl* xcert = NULL; + PCCERT_CHAIN_CONTEXT pChainContext = nullptr; + PCCERT_CONTEXT pCertContext = nullptr; + const X509Certificate_MSCryptImpl* xcert = nullptr; Reference< XUnoTunnel > xCertTunnel( aCert, UNO_QUERY ) ; if( !xCertTunnel.is() ) { @@ -915,8 +915,8 @@ sal_Int32 SecurityEnvironment_MSCryptImpl::verifyCertificate( SAL_INFO("xmlsecurity.xmlsec", "Start verification of certificate: " << aCert->getSubjectName()); - xcert = ( X509Certificate_MSCryptImpl* )xCertTunnel->getSomething( X509Certificate_MSCryptImpl::getUnoTunnelId() ) ; - if( xcert == NULL ) { + xcert = reinterpret_cast<X509Certificate_MSCryptImpl*>(xCertTunnel->getSomething( X509Certificate_MSCryptImpl::getUnoTunnelId() )); + if( xcert == nullptr ) { throw RuntimeException() ; } @@ -929,17 +929,17 @@ sal_Int32 SecurityEnvironment_MSCryptImpl::verifyCertificate( //Prepare parameter for CertGetCertificateChain enhKeyUsage.cUsageIdentifier = 0 ; - enhKeyUsage.rgpszUsageIdentifier = NULL ; + enhKeyUsage.rgpszUsageIdentifier = nullptr ; certUsage.dwType = USAGE_MATCH_TYPE_AND ; certUsage.Usage = enhKeyUsage ; chainPara.cbSize = sizeof( CERT_CHAIN_PARA ) ; chainPara.RequestedUsage = certUsage ; - HCERTSTORE hCollectionStore = NULL; - HCERTSTORE hIntermediateCertsStore = NULL; + HCERTSTORE hCollectionStore = nullptr; + HCERTSTORE hIntermediateCertsStore = nullptr; BOOL bChain = FALSE; - if( pCertContext != NULL ) + if( pCertContext != nullptr ) { hIntermediateCertsStore = getCertStoreForIntermediatCerts(seqCerts); @@ -951,9 +951,9 @@ sal_Int32 SecurityEnvironment_MSCryptImpl::verifyCertificate( 0 , NULL , 0 , - NULL + nullptr ) ; - if (hCollectionStore != NULL) + if (hCollectionStore != nullptr) { CertAddStoreToCollection ( hCollectionStore , @@ -978,13 +978,13 @@ sal_Int32 SecurityEnvironment_MSCryptImpl::verifyCertificate( //Then we would get CERT_TRUST_REVOCATION_STATUS_UNKNOWN SAL_INFO("xmlsecurity.xmlsec", "Verifying cert using revocation information."); bChain = CertGetCertificateChain( - NULL , + nullptr , pCertContext , - NULL , //use current system time + nullptr , //use current system time hCollectionStore, &chainPara , CERT_CHAIN_REVOCATION_CHECK_CHAIN | CERT_CHAIN_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT, - NULL , + nullptr , &pChainContext); if (bChain && pChainContext->cChain > 0) @@ -1012,16 +1012,16 @@ sal_Int32 SecurityEnvironment_MSCryptImpl::verifyCertificate( //clear about if all other tests are performed if an error occurs, //we test again, without requiring revocation checking. CertFreeCertificateChain(pChainContext); - pChainContext = NULL; + pChainContext = nullptr; SAL_INFO("xmlsecurity.xmlsec", "Checking again but without requiring revocation information."); bChain = CertGetCertificateChain( - NULL , + nullptr , pCertContext , - NULL , //use current system time + nullptr , //use current system time hCollectionStore, &chainPara , 0, - NULL , + nullptr , &pChainContext); if (bChain && pChainContext->cChain > 0 @@ -1058,7 +1058,7 @@ sal_Int32 SecurityEnvironment_MSCryptImpl::verifyCertificate( if (pChainContext) { CertFreeCertificateChain(pChainContext); - pChainContext = NULL; + pChainContext = nullptr; } //Close the additional store, do not destroy the contained certs @@ -1080,8 +1080,8 @@ sal_Int32 SecurityEnvironment_MSCryptImpl::getCertificateCharacters( const css:: throw RuntimeException() ; } - xcert = ( X509Certificate_MSCryptImpl* )xCertTunnel->getSomething( X509Certificate_MSCryptImpl::getUnoTunnelId() ) ; - if( xcert == NULL ) { + xcert = reinterpret_cast<X509Certificate_MSCryptImpl*>(xCertTunnel->getSomething( X509Certificate_MSCryptImpl::getUnoTunnelId() )); + if( xcert == nullptr ) { throw RuntimeException() ; } @@ -1103,7 +1103,7 @@ sal_Int32 SecurityEnvironment_MSCryptImpl::getCertificateCharacters( const css:: HCRYPTPROV hProv ; if( CryptAcquireCertificatePrivateKey( pCertContext , 0 , - NULL , + nullptr , &( hProv ) , &( dwKeySpec ) , &( fCallerFreeProv ) ) @@ -1119,11 +1119,11 @@ sal_Int32 SecurityEnvironment_MSCryptImpl::getCertificateCharacters( const css:: return characters ; } -void SecurityEnvironment_MSCryptImpl::enableDefaultCrypt( sal_Bool enable ) throw( Exception, RuntimeException ) { +void SecurityEnvironment_MSCryptImpl::enableDefaultCrypt( bool enable ) throw( Exception, RuntimeException ) { m_bEnableDefault = enable ; } -sal_Bool SecurityEnvironment_MSCryptImpl::defaultEnabled() throw( Exception, RuntimeException ) { +bool SecurityEnvironment_MSCryptImpl::defaultEnabled() throw( Exception, RuntimeException ) { return m_bEnableDefault ; } @@ -1131,11 +1131,11 @@ X509Certificate_MSCryptImpl* MswcryCertContextToXCert( PCCERT_CONTEXT cert ) { X509Certificate_MSCryptImpl* xcert ; - if( cert != NULL ) { + if( cert != nullptr ) { xcert = new X509Certificate_MSCryptImpl() ; xcert->setMswcryCert( cert ) ; } else { - xcert = NULL ; + xcert = nullptr ; } return xcert ; @@ -1153,13 +1153,13 @@ xmlSecKeysMngrPtr SecurityEnvironment_MSCryptImpl::createKeysManager() throw( Ex HCRYPTKEY symKey ; HCRYPTKEY pubKey ; HCRYPTKEY priKey ; - xmlSecKeysMngrPtr pKeysMngr = NULL ; + xmlSecKeysMngrPtr pKeysMngr = nullptr ; /*- * The following lines is based on the of xmlsec-mscrypto crypto engine */ pKeysMngr = xmlSecMSCryptoAppliedKeysMngrCreate( m_hKeyStore , m_hCertStore ) ; - if( pKeysMngr == NULL ) + if( pKeysMngr == nullptr ) throw RuntimeException() ; /*- @@ -1195,40 +1195,40 @@ xmlSecKeysMngrPtr SecurityEnvironment_MSCryptImpl::createKeysManager() throw( Ex if( defaultEnabled() ) { //Add system key store into the keys manager. m_hMySystemStore = CertOpenSystemStore( 0, "MY" ) ; - if( m_hMySystemStore != NULL ) { + if( m_hMySystemStore != nullptr ) { if( xmlSecMSCryptoAppliedKeysMngrAdoptKeyStore( pKeysMngr, m_hMySystemStore ) < 0 ) { CertCloseStore( m_hMySystemStore, CERT_CLOSE_STORE_CHECK_FLAG ) ; - m_hMySystemStore = NULL; + m_hMySystemStore = nullptr; throw RuntimeException() ; } } //Add system root store into the keys manager. m_hRootSystemStore = CertOpenSystemStore( 0, "Root" ) ; - if( m_hRootSystemStore != NULL ) { + if( m_hRootSystemStore != nullptr ) { if( xmlSecMSCryptoAppliedKeysMngrAdoptTrustedStore( pKeysMngr, m_hRootSystemStore ) < 0 ) { CertCloseStore( m_hRootSystemStore, CERT_CLOSE_STORE_CHECK_FLAG ) ; - m_hRootSystemStore = NULL; + m_hRootSystemStore = nullptr; throw RuntimeException() ; } } //Add system trusted store into the keys manager. m_hTrustSystemStore = CertOpenSystemStore( 0, "Trust" ) ; - if( m_hTrustSystemStore != NULL ) { + if( m_hTrustSystemStore != nullptr ) { if( xmlSecMSCryptoAppliedKeysMngrAdoptUntrustedStore( pKeysMngr, m_hTrustSystemStore ) < 0 ) { CertCloseStore( m_hTrustSystemStore, CERT_CLOSE_STORE_CHECK_FLAG ) ; - m_hTrustSystemStore = NULL; + m_hTrustSystemStore = nullptr; throw RuntimeException() ; } } //Add system CA store into the keys manager. m_hCaSystemStore = CertOpenSystemStore( 0, "CA" ) ; - if( m_hCaSystemStore != NULL ) { + if( m_hCaSystemStore != nullptr ) { if( xmlSecMSCryptoAppliedKeysMngrAdoptUntrustedStore( pKeysMngr, m_hCaSystemStore ) < 0 ) { CertCloseStore( m_hCaSystemStore, CERT_CLOSE_STORE_CHECK_FLAG ) ; - m_hCaSystemStore = NULL; + m_hCaSystemStore = nullptr; throw RuntimeException() ; } } @@ -1237,7 +1237,7 @@ xmlSecKeysMngrPtr SecurityEnvironment_MSCryptImpl::createKeysManager() throw( Ex return pKeysMngr ; } void SecurityEnvironment_MSCryptImpl::destroyKeysManager(xmlSecKeysMngrPtr pKeysMngr) throw( Exception, RuntimeException ) { - if( pKeysMngr != NULL ) { + if( pKeysMngr != nullptr ) { xmlSecKeysMngrDestroy( pKeysMngr ) ; } } diff --git a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx index 62df6b7fa85b..e345c1e9e763 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx +++ b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx @@ -73,7 +73,7 @@ class SecurityEnvironment_MSCryptImpl : public ::cppu::WeakImplHelper< HCERTSTORE m_hCaSystemStore; //Enable default system cryptography setting - sal_Bool m_bEnableDefault ; + bool m_bEnableDefault ; //External keys std::list< HCRYPTKEY > m_tSymKeyList ; @@ -85,16 +85,16 @@ class SecurityEnvironment_MSCryptImpl : public ::cppu::WeakImplHelper< public: explicit SecurityEnvironment_MSCryptImpl( const css::uno::Reference< css::lang::XMultiServiceFactory >& aFactory ) ; - virtual ~SecurityEnvironment_MSCryptImpl() ; + virtual ~SecurityEnvironment_MSCryptImpl() override; //Methods from XSecurityEnvironment virtual css::uno::Sequence< css::uno::Reference< css::security::XCertificate > > SAL_CALL getPersonalCertificates() - throw( css::uno::SecurityException , css::uno::RuntimeException ) ; + throw( css::uno::SecurityException , css::uno::RuntimeException ) override; virtual css::uno::Reference< css::security::XCertificate > SAL_CALL getCertificate( const OUString& issuerName, const css::uno::Sequence< sal_Int8 >& serialNumber ) - throw( css::uno::SecurityException , css::uno::RuntimeException ) ; + throw( css::uno::SecurityException , css::uno::RuntimeException ) override; virtual css::uno::Reference< css::security::XCertificate > SAL_CALL getCertificate( const OUString& issuerName, @@ -103,38 +103,38 @@ class SecurityEnvironment_MSCryptImpl : public ::cppu::WeakImplHelper< virtual css::uno::Sequence< css::uno::Reference< css::security::XCertificate > > SAL_CALL buildCertificatePath( const css::uno::Reference< css::security::XCertificate >& beginCert ) - throw( css::uno::SecurityException , css::uno::RuntimeException ) ; + throw( css::uno::SecurityException , css::uno::RuntimeException ) override; virtual css::uno::Reference< css::security::XCertificate > SAL_CALL createCertificateFromRaw( const css::uno::Sequence< sal_Int8 >& rawCertificate ) - throw( css::uno::SecurityException , css::uno::RuntimeException ) ; + throw( css::uno::SecurityException , css::uno::RuntimeException ) override; virtual css::uno::Reference< css::security::XCertificate > SAL_CALL createCertificateFromAscii( const OUString& asciiCertificate ) - throw( css::uno::SecurityException , css::uno::RuntimeException ) ; + throw( css::uno::SecurityException , css::uno::RuntimeException ) override; virtual ::sal_Int32 SAL_CALL verifyCertificate( const css::uno::Reference< css::security::XCertificate >& xCert, const css::uno::Sequence< css::uno::Reference< css::security::XCertificate > >& intermediateCertificates) - throw (css::uno::SecurityException, css::uno::RuntimeException) ; + throw (css::uno::SecurityException, css::uno::RuntimeException) override; virtual ::sal_Int32 SAL_CALL getCertificateCharacters( const css::uno::Reference< css::security::XCertificate >& xCert ) - throw (css::uno::SecurityException, css::uno::RuntimeException) ; + throw (css::uno::SecurityException, css::uno::RuntimeException) override; virtual OUString SAL_CALL getSecurityEnvironmentInformation( ) - throw (css::uno::RuntimeException); + throw (css::uno::RuntimeException) override; //Methods from XServiceInfo - virtual OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException ) ; + virtual OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException ) override; virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName - ) throw( css::uno::RuntimeException ) ; + ) throw( css::uno::RuntimeException ) override; - virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw( css::uno::RuntimeException ) ; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw( css::uno::RuntimeException ) override; //Helper for XServiceInfo static css::uno::Sequence< OUString > impl_getSupportedServiceNames() ; @@ -151,7 +151,7 @@ class SecurityEnvironment_MSCryptImpl : public ::cppu::WeakImplHelper< //Methods from XUnoTunnel virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) - throw (css::uno::RuntimeException); + throw (css::uno::RuntimeException) override; static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId() ; static SecurityEnvironment_MSCryptImpl* getImplementation( const css::uno::Reference< css::uno::XInterface >& rObj ) ; @@ -176,8 +176,8 @@ class SecurityEnvironment_MSCryptImpl : public ::cppu::WeakImplHelper< virtual HCRYPTKEY getPriKey( unsigned int position ) throw( css::uno::Exception , css::uno::RuntimeException ) ; - virtual void enableDefaultCrypt( sal_Bool enable ) throw( css::uno::Exception , css::uno::RuntimeException ) ; - virtual sal_Bool defaultEnabled() throw( css::uno::Exception , css::uno::RuntimeException ) ; + virtual void enableDefaultCrypt( bool enable ) throw( css::uno::Exception , css::uno::RuntimeException ) ; + virtual bool defaultEnabled() throw( css::uno::Exception , css::uno::RuntimeException ) ; //Native methods virtual xmlSecKeysMngrPtr createKeysManager() throw( css::uno::Exception , css::uno::RuntimeException ) ; diff --git a/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx index f0c262b96db1..91158dd14d6b 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx +++ b/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx @@ -58,15 +58,15 @@ cssu::Reference< cssxc::XXMLSecurityContext > SAL_CALL OString sCertDir(sCertDB.getStr(), sCertDB.getLength(), RTL_TEXTENCODING_ASCII_US); n_pCertStore = sCertDir.getStr(); n_hStoreHandle = CertOpenSystemStore( NULL, n_pCertStore ) ; - if( n_hStoreHandle == NULL ) + if( n_hStoreHandle == nullptr ) { - return NULL; + return nullptr; } } else { - n_pCertStore = NULL ; - n_hStoreHandle = NULL ; + n_pCertStore = nullptr ; + n_hStoreHandle = nullptr ; } xmlSecMSCryptoAppInit( n_pCertStore ) ; @@ -77,26 +77,26 @@ cssu::Reference< cssxc::XXMLSecurityContext > SAL_CALL /* Setup key slot and certDb */ cssu::Reference< cssl::XUnoTunnel > xSecEnvTunnel( xSecEnv, cssu::UNO_QUERY_THROW ); - SecurityEnvironment_MSCryptImpl* pSecEnv = ( SecurityEnvironment_MSCryptImpl* )xSecEnvTunnel->getSomething( SecurityEnvironment_MSCryptImpl::getUnoTunnelId() ) ; - if( pSecEnv == NULL ) + SecurityEnvironment_MSCryptImpl* pSecEnv = reinterpret_cast<SecurityEnvironment_MSCryptImpl*>(xSecEnvTunnel->getSomething( SecurityEnvironment_MSCryptImpl::getUnoTunnelId() )); + if( pSecEnv == nullptr ) { - if( n_hStoreHandle != NULL ) + if( n_hStoreHandle != nullptr ) { CertCloseStore( n_hStoreHandle, CERT_CLOSE_STORE_FORCE_FLAG ) ; } xmlSecMSCryptoAppShutdown() ; - return NULL; + return nullptr; } - if( n_hStoreHandle != NULL ) + if( n_hStoreHandle != nullptr ) { pSecEnv->setCryptoSlot( n_hStoreHandle ) ; pSecEnv->setCertDb( n_hStoreHandle ) ; } else { - pSecEnv->enableDefaultCrypt( sal_True ) ; + pSecEnv->enableDefaultCrypt( true ) ; } /* Build XML Security Context */ @@ -107,13 +107,13 @@ cssu::Reference< cssxc::XXMLSecurityContext > SAL_CALL } catch( cssu::Exception& ) { - if( n_hStoreHandle != NULL ) + if( n_hStoreHandle != nullptr ) { CertCloseStore( n_hStoreHandle, CERT_CLOSE_STORE_FORCE_FLAG ) ; } xmlSecMSCryptoAppShutdown() ; - return NULL; + return nullptr; } } @@ -163,7 +163,7 @@ cssu::Sequence< OUString > SAL_CALL SEInitializer_MSCryptImpl_getSupportedServic cssu::Reference< cssu::XInterface > SAL_CALL SEInitializer_MSCryptImpl_createInstance( const cssu::Reference< cssl::XMultiServiceFactory > & rSMgr) throw( cssu::Exception ) { - return (cppu::OWeakObject*) new SEInitializer_MSCryptImpl( comphelper::getComponentContext(rSMgr) ); + return static_cast<cppu::OWeakObject*>(new SEInitializer_MSCryptImpl( comphelper::getComponentContext(rSMgr) )); } /* XServiceInfo */ diff --git a/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.hxx b/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.hxx index 1ffd04ff2f06..46c698c4e455 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.hxx +++ b/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.hxx @@ -52,32 +52,32 @@ private: public: explicit SEInitializer_MSCryptImpl(const css::uno::Reference< css::uno::XComponentContext > &rxContext); - virtual ~SEInitializer_MSCryptImpl(); + virtual ~SEInitializer_MSCryptImpl() override; /* XSEInitializer */ virtual css::uno::Reference< css::xml::crypto::XXMLSecurityContext > SAL_CALL createSecurityContext( const OUString& certDB ) - throw (css::uno::RuntimeException); + throw (css::uno::RuntimeException) override; virtual void SAL_CALL freeSecurityContext( const css::uno::Reference< css::xml::crypto::XXMLSecurityContext >& securityContext ) - throw (css::uno::RuntimeException); + throw (css::uno::RuntimeException) override; /* XServiceInfo */ virtual OUString SAL_CALL getImplementationName( ) - throw (css::uno::RuntimeException); + throw (css::uno::RuntimeException) override; virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) - throw (css::uno::RuntimeException); + throw (css::uno::RuntimeException) override; virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) - throw (css::uno::RuntimeException); + throw (css::uno::RuntimeException) override; }; OUString SEInitializer_MSCryptImpl_getImplementationName() throw ( css::uno::RuntimeException ); -sal_Bool SAL_CALL SEInitializer_MSCryptImpl_supportsService( const OUString& ServiceName ) +bool SAL_CALL SEInitializer_MSCryptImpl_supportsService( const OUString& ServiceName ) throw ( css::uno::RuntimeException ); css::uno::Sequence< OUString > SAL_CALL SEInitializer_MSCryptImpl_getSupportedServiceNames( ) diff --git a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx index 109fec4b046c..c2033024f8c2 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx +++ b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx @@ -157,7 +157,7 @@ findTypeInDN(const OUString& rRawString, const OUString& sTypeName) strings for type names. Instead it uses OIDs. */ -OUString replaceTagSWithTagST(OUString oldDN) +OUString replaceTagSWithTagST(OUString const & oldDN) { std::pair<sal_Int32, sal_Int32 > pairIndex = findTypeInDN(oldDN, "S"); @@ -170,19 +170,19 @@ OUString replaceTagSWithTagST(OUString oldDN) /* end */ X509Certificate_MSCryptImpl::X509Certificate_MSCryptImpl() : - m_pCertContext( NULL ) + m_pCertContext( nullptr ) { } X509Certificate_MSCryptImpl::~X509Certificate_MSCryptImpl() { - if( m_pCertContext != NULL ) { + if( m_pCertContext != nullptr ) { CertFreeCertificateContext( m_pCertContext ) ; } } //Methods from XCertificate sal_Int16 SAL_CALL X509Certificate_MSCryptImpl::getVersion() throw ( css::uno::RuntimeException) { - if( m_pCertContext != NULL && m_pCertContext->pCertInfo != NULL ) { + if( m_pCertContext != nullptr && m_pCertContext->pCertInfo != nullptr ) { return ( char )m_pCertContext->pCertInfo->dwVersion ; } else { return -1 ; @@ -190,7 +190,7 @@ sal_Int16 SAL_CALL X509Certificate_MSCryptImpl::getVersion() throw ( css::uno::R } css::uno::Sequence< sal_Int8 > SAL_CALL X509Certificate_MSCryptImpl::getSerialNumber() throw ( css::uno::RuntimeException) { - if( m_pCertContext != NULL && m_pCertContext->pCertInfo != NULL ) { + if( m_pCertContext != nullptr && m_pCertContext->pCertInfo != nullptr ) { Sequence< sal_Int8 > serial( m_pCertContext->pCertInfo->SerialNumber.cbData ) ; for( unsigned int i = 0 ; i < m_pCertContext->pCertInfo->SerialNumber.cbData ; i ++ ) serial[i] = *( m_pCertContext->pCertInfo->SerialNumber.pbData + m_pCertContext->pCertInfo->SerialNumber.cbData - i - 1 ) ; @@ -202,14 +202,14 @@ css::uno::Sequence< sal_Int8 > SAL_CALL X509Certificate_MSCryptImpl::getSerialNu } OUString SAL_CALL X509Certificate_MSCryptImpl::getIssuerName() throw ( css::uno::RuntimeException) { - if( m_pCertContext != NULL && m_pCertContext->pCertInfo != NULL ) { + if( m_pCertContext != nullptr && m_pCertContext->pCertInfo != nullptr ) { DWORD cbIssuer ; cbIssuer = CertNameToStr( X509_ASN_ENCODING | PKCS_7_ASN_ENCODING , &( m_pCertContext->pCertInfo->Issuer ), CERT_X500_NAME_STR | CERT_NAME_STR_REVERSE_FLAG , - NULL, 0 + nullptr, 0 ) ; // Here the cbIssuer count the last 0x00 , take care. @@ -230,7 +230,7 @@ OUString SAL_CALL X509Certificate_MSCryptImpl::getIssuerName() throw ( css::uno: // for correct encoding sal_uInt16 encoding ; - rtl_Locale *pLocale = NULL ; + rtl_Locale *pLocale = nullptr ; osl_getProcessLocale( &pLocale ) ; encoding = osl_getTextEncodingFromLocale( pLocale ) ; @@ -249,7 +249,7 @@ OUString SAL_CALL X509Certificate_MSCryptImpl::getIssuerName() throw ( css::uno: OUString SAL_CALL X509Certificate_MSCryptImpl::getSubjectName() throw ( css::uno::RuntimeException) { - if( m_pCertContext != NULL && m_pCertContext->pCertInfo != NULL ) + if( m_pCertContext != nullptr && m_pCertContext->pCertInfo != nullptr ) { DWORD cbSubject ; @@ -257,7 +257,7 @@ OUString SAL_CALL X509Certificate_MSCryptImpl::getSubjectName() throw ( css::uno X509_ASN_ENCODING | PKCS_7_ASN_ENCODING , &( m_pCertContext->pCertInfo->Subject ), CERT_X500_NAME_STR | CERT_NAME_STR_REVERSE_FLAG , - NULL, 0 + nullptr, 0 ) ; if( cbSubject != 0 ) @@ -292,7 +292,7 @@ OUString SAL_CALL X509Certificate_MSCryptImpl::getSubjectName() throw ( css::uno } css::util::DateTime SAL_CALL X509Certificate_MSCryptImpl::getNotValidBefore() throw ( css::uno::RuntimeException ) { - if( m_pCertContext != NULL && m_pCertContext->pCertInfo != NULL ) { + if( m_pCertContext != nullptr && m_pCertContext->pCertInfo != nullptr ) { SYSTEMTIME explTime ; DateTime dateTime ; FILETIME localFileTime; @@ -318,7 +318,7 @@ css::util::DateTime SAL_CALL X509Certificate_MSCryptImpl::getNotValidBefore() th } css::util::DateTime SAL_CALL X509Certificate_MSCryptImpl::getNotValidAfter() throw ( css::uno::RuntimeException) { - if( m_pCertContext != NULL && m_pCertContext->pCertInfo != NULL ) { + if( m_pCertContext != nullptr && m_pCertContext->pCertInfo != nullptr ) { SYSTEMTIME explTime ; DateTime dateTime ; FILETIME localFileTime; @@ -344,7 +344,7 @@ css::util::DateTime SAL_CALL X509Certificate_MSCryptImpl::getNotValidAfter() thr } css::uno::Sequence< sal_Int8 > SAL_CALL X509Certificate_MSCryptImpl::getIssuerUniqueID() throw ( css::uno::RuntimeException) { - if( m_pCertContext != NULL && m_pCertContext->pCertInfo != NULL ) { + if( m_pCertContext != nullptr && m_pCertContext->pCertInfo != nullptr ) { Sequence< sal_Int8 > issuerUid( m_pCertContext->pCertInfo->IssuerUniqueId.cbData ) ; for( unsigned int i = 0 ; i < m_pCertContext->pCertInfo->IssuerUniqueId.cbData; i ++ ) issuerUid[i] = *( m_pCertContext->pCertInfo->IssuerUniqueId.pbData + i ) ; @@ -356,7 +356,7 @@ css::uno::Sequence< sal_Int8 > SAL_CALL X509Certificate_MSCryptImpl::getIssuerUn } css::uno::Sequence< sal_Int8 > SAL_CALL X509Certificate_MSCryptImpl::getSubjectUniqueID() throw ( css::uno::RuntimeException ) { - if( m_pCertContext != NULL && m_pCertContext->pCertInfo != NULL ) { + if( m_pCertContext != nullptr && m_pCertContext->pCertInfo != nullptr ) { Sequence< sal_Int8 > subjectUid( m_pCertContext->pCertInfo->SubjectUniqueId.cbData ) ; for( unsigned int i = 0 ; i < m_pCertContext->pCertInfo->SubjectUniqueId.cbData; i ++ ) subjectUid[i] = *( m_pCertContext->pCertInfo->SubjectUniqueId.pbData + i ) ; @@ -368,7 +368,7 @@ css::uno::Sequence< sal_Int8 > SAL_CALL X509Certificate_MSCryptImpl::getSubjectU } css::uno::Sequence< css::uno::Reference< css::security::XCertificateExtension > > SAL_CALL X509Certificate_MSCryptImpl::getExtensions() throw ( css::uno::RuntimeException ) { - if( m_pCertContext != NULL && m_pCertContext->pCertInfo != NULL && m_pCertContext->pCertInfo->cExtension != 0 ) { + if( m_pCertContext != nullptr && m_pCertContext->pCertInfo != nullptr && m_pCertContext->pCertInfo->cExtension != 0 ) { CertificateExtension_XmlSecImpl* xExtn ; Sequence< Reference< XCertificateExtension > > xExtns( m_pCertContext->pCertInfo->cExtension ) ; @@ -379,13 +379,13 @@ css::uno::Sequence< css::uno::Reference< css::security::XCertificateExtension > OUString objId = OUString::createFromAscii( pExtn->pszObjId ); if ( objId == "2.5.29.17" ) - xExtn = (CertificateExtension_XmlSecImpl*) new SanExtensionImpl() ; + xExtn = reinterpret_cast<CertificateExtension_XmlSecImpl*>(new SanExtensionImpl()); else xExtn = new CertificateExtension_XmlSecImpl() ; - if( xExtn == NULL ) + if( xExtn == nullptr ) throw RuntimeException() ; - xExtn->setCertExtn( pExtn->Value.pbData, pExtn->Value.cbData, ( unsigned char* )pExtn->pszObjId, strlen( pExtn->pszObjId ), pExtn->fCritical ) ; + xExtn->setCertExtn( pExtn->Value.pbData, pExtn->Value.cbData, reinterpret_cast<unsigned char*>(pExtn->pszObjId), strlen( pExtn->pszObjId ), pExtn->fCritical ) ; xExtns[i] = xExtn ; } @@ -397,32 +397,32 @@ css::uno::Sequence< css::uno::Reference< css::security::XCertificateExtension > } css::uno::Reference< css::security::XCertificateExtension > SAL_CALL X509Certificate_MSCryptImpl::findCertificateExtension( const css::uno::Sequence< sal_Int8 >& /*oid*/ ) throw (css::uno::RuntimeException) { - if( m_pCertContext != NULL && m_pCertContext->pCertInfo != NULL && m_pCertContext->pCertInfo->cExtension != 0 ) { + if( m_pCertContext != nullptr && m_pCertContext->pCertInfo != nullptr && m_pCertContext->pCertInfo->cExtension != 0 ) { CertificateExtension_XmlSecImpl* xExtn ; - xExtn = NULL ; + xExtn = nullptr ; for( unsigned int i = 0; i < m_pCertContext->pCertInfo->cExtension; i++ ) { CERT_EXTENSION* pExtn = &( m_pCertContext->pCertInfo->rgExtension[i] ) ; //TODO: Compare the oid - if( 0 ) { + if( false ) { xExtn = new CertificateExtension_XmlSecImpl() ; - if( xExtn == NULL ) + if( xExtn == nullptr ) throw RuntimeException() ; - xExtn->setCertExtn( pExtn->Value.pbData, pExtn->Value.cbData, ( unsigned char* )pExtn->pszObjId, strlen( pExtn->pszObjId ), pExtn->fCritical ) ; + xExtn->setCertExtn( pExtn->Value.pbData, pExtn->Value.cbData, reinterpret_cast<unsigned char*>(pExtn->pszObjId), strlen( pExtn->pszObjId ), pExtn->fCritical ) ; } } return xExtn ; } else { - return NULL ; + return nullptr ; } } css::uno::Sequence< sal_Int8 > SAL_CALL X509Certificate_MSCryptImpl::getEncoded() throw ( css::uno::RuntimeException) { - if( m_pCertContext != NULL && m_pCertContext->cbCertEncoded > 0 ) { + if( m_pCertContext != nullptr && m_pCertContext->cbCertEncoded > 0 ) { Sequence< sal_Int8 > rawCert( m_pCertContext->cbCertEncoded ) ; for( unsigned int i = 0 ; i < m_pCertContext->cbCertEncoded ; i ++ ) @@ -436,39 +436,39 @@ css::uno::Sequence< sal_Int8 > SAL_CALL X509Certificate_MSCryptImpl::getEncoded( //Helper methods void X509Certificate_MSCryptImpl::setMswcryCert( const CERT_CONTEXT* cert ) { - if( m_pCertContext != NULL ) { + if( m_pCertContext != nullptr ) { CertFreeCertificateContext( m_pCertContext ) ; - m_pCertContext = NULL ; + m_pCertContext = nullptr ; } - if( cert != NULL ) { + if( cert != nullptr ) { m_pCertContext = CertDuplicateCertificateContext( cert ) ; } } const CERT_CONTEXT* X509Certificate_MSCryptImpl::getMswcryCert() const { - if( m_pCertContext != NULL ) { + if( m_pCertContext != nullptr ) { return m_pCertContext ; } else { - return NULL ; + return nullptr ; } } -void X509Certificate_MSCryptImpl::setRawCert( Sequence< sal_Int8 > rawCert ) throw ( css::uno::RuntimeException) { - if( m_pCertContext != NULL ) { +void X509Certificate_MSCryptImpl::setRawCert( Sequence< sal_Int8 > const & rawCert ) throw ( css::uno::RuntimeException) { + if( m_pCertContext != nullptr ) { CertFreeCertificateContext( m_pCertContext ) ; - m_pCertContext = NULL ; + m_pCertContext = nullptr ; } if( rawCert.getLength() != 0 ) { - m_pCertContext = CertCreateCertificateContext( X509_ASN_ENCODING, ( const sal_uInt8* )&rawCert[0], rawCert.getLength() ) ; + m_pCertContext = CertCreateCertificateContext( X509_ASN_ENCODING, reinterpret_cast<const sal_uInt8*>(&rawCert[0]), rawCert.getLength() ) ; } } /* XUnoTunnel */ sal_Int64 SAL_CALL X509Certificate_MSCryptImpl::getSomething( const Sequence< sal_Int8 >& aIdentifier ) throw( RuntimeException ) { if( aIdentifier.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(), aIdentifier.getConstArray(), 16 ) ) { - return ( sal_Int64 )this ; + return reinterpret_cast<sal_Int64>(this); } return 0 ; } @@ -488,9 +488,9 @@ const Sequence< sal_Int8>& X509Certificate_MSCryptImpl::getUnoTunnelId() { X509Certificate_MSCryptImpl* X509Certificate_MSCryptImpl::getImplementation( const Reference< XInterface >& rObj ) { Reference< XUnoTunnel > xUT( rObj , UNO_QUERY ) ; if( xUT.is() ) { - return ( X509Certificate_MSCryptImpl* )xUT->getSomething( getUnoTunnelId() ) ; + return reinterpret_cast<X509Certificate_MSCryptImpl*>(xUT->getSomething( getUnoTunnelId() )); } else - return NULL ; + return nullptr ; } OUString findOIDDescription(char *oid) @@ -510,11 +510,11 @@ OUString findOIDDescription(char *oid) css::uno::Sequence< sal_Int8 > getThumbprint(const CERT_CONTEXT* pCertContext, DWORD dwPropId) { - if( pCertContext != NULL ) + if( pCertContext != nullptr ) { DWORD cbData = dwPropId == CERT_SHA256_HASH_PROP_ID ? 32 : 20; unsigned char fingerprint[32]; - if (CertGetCertificateContextProperty(pCertContext, dwPropId, (void*)fingerprint, &cbData)) + if (CertGetCertificateContextProperty(pCertContext, dwPropId, fingerprint, &cbData)) { Sequence< sal_Int8 > thumbprint( cbData ) ; for( unsigned int i = 0 ; i < cbData ; i ++ ) @@ -537,7 +537,7 @@ css::uno::Sequence< sal_Int8 > getThumbprint(const CERT_CONTEXT* pCertContext, D OUString SAL_CALL X509Certificate_MSCryptImpl::getSubjectPublicKeyAlgorithm() throw ( css::uno::RuntimeException) { - if( m_pCertContext != NULL && m_pCertContext->pCertInfo != NULL ) + if( m_pCertContext != nullptr && m_pCertContext->pCertInfo != nullptr ) { CRYPT_ALGORITHM_IDENTIFIER algorithm = m_pCertContext->pCertInfo->SubjectPublicKeyInfo.Algorithm; return findOIDDescription( algorithm.pszObjId ) ; @@ -551,7 +551,7 @@ OUString SAL_CALL X509Certificate_MSCryptImpl::getSubjectPublicKeyAlgorithm() css::uno::Sequence< sal_Int8 > SAL_CALL X509Certificate_MSCryptImpl::getSubjectPublicKeyValue() throw ( css::uno::RuntimeException) { - if( m_pCertContext != NULL && m_pCertContext->pCertInfo != NULL ) + if( m_pCertContext != nullptr && m_pCertContext->pCertInfo != nullptr ) { CRYPT_BIT_BLOB publicKey = m_pCertContext->pCertInfo->SubjectPublicKeyInfo.PublicKey; @@ -572,7 +572,7 @@ css::uno::Sequence< sal_Int8 > SAL_CALL X509Certificate_MSCryptImpl::getSubjectP OUString SAL_CALL X509Certificate_MSCryptImpl::getSignatureAlgorithm() throw ( css::uno::RuntimeException) { - if( m_pCertContext != NULL && m_pCertContext->pCertInfo != NULL ) + if( m_pCertContext != nullptr && m_pCertContext->pCertInfo != nullptr ) { CRYPT_ALGORITHM_IDENTIFIER algorithm = m_pCertContext->pCertInfo->SignatureAlgorithm; return findOIDDescription( algorithm.pszObjId ) ; @@ -612,14 +612,14 @@ sal_Int32 SAL_CALL X509Certificate_MSCryptImpl::getCertificateUsage( ) CERT_NON_REPUDIATION_KEY_USAGE | CERT_OFFLINE_CRL_SIGN_KEY_USAGE; - if( m_pCertContext != NULL && m_pCertContext->pCertInfo != NULL && m_pCertContext->pCertInfo->cExtension != 0 ) + if( m_pCertContext != nullptr && m_pCertContext->pCertInfo != nullptr && m_pCertContext->pCertInfo->cExtension != 0 ) { CERT_EXTENSION* pExtn = CertFindExtension( szOID_KEY_USAGE, m_pCertContext->pCertInfo->cExtension, m_pCertContext->pCertInfo->rgExtension); - if (pExtn != NULL) + if (pExtn != nullptr) { DWORD length = 0; bool rc = CryptDecodeObject( @@ -628,7 +628,7 @@ sal_Int32 SAL_CALL X509Certificate_MSCryptImpl::getCertificateUsage( ) pExtn->Value.pbData, pExtn->Value.cbData, 0, - NULL, + nullptr, &length); if (!rc) @@ -643,10 +643,10 @@ sal_Int32 SAL_CALL X509Certificate_MSCryptImpl::getCertificateUsage( ) pExtn->Value.pbData, pExtn->Value.cbData, 0, - (void *)buffer.data(), + buffer.data(), &length); - CRYPT_BIT_BLOB *blob = (CRYPT_BIT_BLOB*)buffer.data(); + CRYPT_BIT_BLOB *blob = reinterpret_cast<CRYPT_BIT_BLOB*>(buffer.data()); if (!rc) SAL_WARN("xmlsecurity.xmlsec", "CryptDecodeObject failed: " << WindowsErrorString(GetLastError())); else if (blob->cbData == 1) diff --git a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.hxx b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.hxx index 09fd6b3826ae..54997cdad2c2 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.hxx +++ b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.hxx @@ -47,7 +47,7 @@ class X509Certificate_MSCryptImpl : public ::cppu::WeakImplHelper< public: X509Certificate_MSCryptImpl() ; - virtual ~X509Certificate_MSCryptImpl() ; + virtual ~X509Certificate_MSCryptImpl() override; //Methods from XCertificate virtual sal_Int16 SAL_CALL getVersion() throw ( css::uno::RuntimeException) override; @@ -87,7 +87,7 @@ class X509Certificate_MSCryptImpl : public ::cppu::WeakImplHelper< //Helper methods void setMswcryCert( const CERT_CONTEXT* cert ) ; const CERT_CONTEXT* getMswcryCert() const ; - void setRawCert( css::uno::Sequence< sal_Int8 > rawCert ) throw ( css::uno::RuntimeException) ; + void setRawCert( css::uno::Sequence< sal_Int8 > const & rawCert ) throw ( css::uno::RuntimeException) ; } ; #endif // INCLUDED_XMLSECURITY_SOURCE_XMLSEC_MSCRYPT_X509CERTIFICATE_MSCRYPTIMPL_HXX diff --git a/xmlsecurity/source/xmlsec/mscrypt/xmlencryption_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/xmlencryption_mscryptimpl.cxx index 0ff4c0ba891f..2e54951eee84 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/xmlencryption_mscryptimpl.cxx +++ b/xmlsecurity/source/xmlsec/mscrypt/xmlencryption_mscryptimpl.cxx @@ -61,10 +61,10 @@ SAL_CALL XMLEncryption_MSCryptImpl::encrypt( ) throw( css::xml::crypto::XMLEncryptionException, css::uno::SecurityException ) { - 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,8 +78,8 @@ SAL_CALL XMLEncryption_MSCryptImpl::encrypt( throw RuntimeException() ; } - SecurityEnvironment_MSCryptImpl* pSecEnv = ( SecurityEnvironment_MSCryptImpl* )xSecTunnel->getSomething( SecurityEnvironment_MSCryptImpl::getUnoTunnelId() ) ; - if( pSecEnv == NULL ) + SecurityEnvironment_MSCryptImpl* pSecEnv = reinterpret_cast<SecurityEnvironment_MSCryptImpl*>(xSecTunnel->getSomething( SecurityEnvironment_MSCryptImpl::getUnoTunnelId() )); + if( pSecEnv == nullptr ) throw RuntimeException() ; //Get the encryption template @@ -93,8 +93,8 @@ SAL_CALL XMLEncryption_MSCryptImpl::encrypt( throw RuntimeException() ; } - XMLElementWrapper_XmlSecImpl* pTemplate = ( XMLElementWrapper_XmlSecImpl* )xTplTunnel->getSomething( XMLElementWrapper_XmlSecImpl::getUnoTunnelImplementationId() ) ; - if( pTemplate == NULL ) { + XMLElementWrapper_XmlSecImpl* pTemplate = reinterpret_cast<XMLElementWrapper_XmlSecImpl*>(xTplTunnel->getSomething( XMLElementWrapper_XmlSecImpl::getUnoTunnelImplementationId() )); + if( pTemplate == nullptr ) { throw RuntimeException() ; } @@ -103,28 +103,28 @@ SAL_CALL XMLEncryption_MSCryptImpl::encrypt( //Find the element to be encrypted. //This element is wrapped in the CipherValue sub-element. xmlNodePtr pCipherData = pEncryptedData->children; - while (pCipherData != NULL && stricmp((const char *)(pCipherData->name), "CipherData")) + while (pCipherData != nullptr && stricmp(reinterpret_cast<const char *>(pCipherData->name), "CipherData")) { pCipherData = pCipherData->next; } - if( pCipherData == NULL ) { + if( pCipherData == nullptr ) { throw XMLEncryptionException() ; } xmlNodePtr pCipherValue = pCipherData->children; - while (pCipherValue != NULL && stricmp((const char *)(pCipherValue->name), "CipherValue")) + while (pCipherValue != nullptr && stricmp(reinterpret_cast<const char *>(pCipherValue->name), "CipherValue")) { pCipherValue = pCipherValue->next; } - if( pCipherValue == NULL ) { + if( pCipherValue == nullptr ) { throw XMLEncryptionException() ; } pContent = pCipherValue->children; - if( pContent == NULL ) { + if( pContent == nullptr ) { throw XMLEncryptionException() ; } @@ -132,7 +132,7 @@ SAL_CALL XMLEncryption_MSCryptImpl::encrypt( xmlAddNextSibling(pEncryptedData, pContent); //remember the position of the element to be signed - sal_Bool isParentRef = sal_True; + bool isParentRef = true; xmlNodePtr pParent = pEncryptedData->parent; xmlNodePtr referenceNode; @@ -143,7 +143,7 @@ SAL_CALL XMLEncryption_MSCryptImpl::encrypt( else { referenceNode = pEncryptedData->prev; - isParentRef = sal_False; + isParentRef = false; } setErrorRecorder( ); @@ -155,7 +155,7 @@ SAL_CALL XMLEncryption_MSCryptImpl::encrypt( //Create Encryption context pEncCtx = xmlSecEncCtxCreate( pMngr ) ; - if( pEncCtx == NULL ) + if( pEncCtx == nullptr ) { pSecEnv->destroyKeysManager( pMngr ); //throw XMLEncryptionException() ; @@ -196,9 +196,9 @@ XMLEncryption_MSCryptImpl::decrypt( const Reference< XXMLSecurityContext >& aSecurityCtx ) throw( css::xml::crypto::XMLEncryptionException , css::uno::SecurityException) { - xmlSecKeysMngrPtr pMngr = NULL ; - xmlSecEncCtxPtr pEncCtx = NULL ; - xmlNodePtr pEncryptedData = NULL ; + xmlSecKeysMngrPtr pMngr = nullptr ; + xmlSecEncCtxPtr pEncCtx = nullptr ; + xmlNodePtr pEncryptedData = nullptr ; if( !aTemplate.is() ) throw RuntimeException() ; @@ -215,8 +215,8 @@ XMLEncryption_MSCryptImpl::decrypt( throw RuntimeException() ; } - SecurityEnvironment_MSCryptImpl* pSecEnv = ( SecurityEnvironment_MSCryptImpl* )xSecTunnel->getSomething( SecurityEnvironment_MSCryptImpl::getUnoTunnelId() ) ; - if( pSecEnv == NULL ) + SecurityEnvironment_MSCryptImpl* pSecEnv = reinterpret_cast<SecurityEnvironment_MSCryptImpl*>(xSecTunnel->getSomething( SecurityEnvironment_MSCryptImpl::getUnoTunnelId() )); + if( pSecEnv == nullptr ) throw RuntimeException() ; //Get the encryption template @@ -230,15 +230,15 @@ XMLEncryption_MSCryptImpl::decrypt( throw RuntimeException() ; } - XMLElementWrapper_XmlSecImpl* pTemplate = ( XMLElementWrapper_XmlSecImpl* )xTplTunnel->getSomething( XMLElementWrapper_XmlSecImpl::getUnoTunnelImplementationId() ) ; - if( pTemplate == NULL ) { + XMLElementWrapper_XmlSecImpl* pTemplate = reinterpret_cast<XMLElementWrapper_XmlSecImpl*>(xTplTunnel->getSomething( XMLElementWrapper_XmlSecImpl::getUnoTunnelImplementationId() )); + if( pTemplate == nullptr ) { throw RuntimeException() ; } pEncryptedData = pTemplate->getNativeElement() ; //remember the position of the element to be signed - sal_Bool isParentRef = sal_True; + bool isParentRef = true; xmlNodePtr pParent = pEncryptedData->parent; xmlNodePtr referenceNode; @@ -249,7 +249,7 @@ XMLEncryption_MSCryptImpl::decrypt( else { referenceNode = pEncryptedData->prev; - isParentRef = sal_False; + isParentRef = false; } setErrorRecorder( ); @@ -261,7 +261,7 @@ XMLEncryption_MSCryptImpl::decrypt( //Create Encryption context pEncCtx = xmlSecEncCtxCreate( pMngr ) ; - if( pEncCtx == NULL ) + if( pEncCtx == nullptr ) { pSecEnv->destroyKeysManager( pMngr ); //throw XMLEncryptionException() ; @@ -270,7 +270,7 @@ XMLEncryption_MSCryptImpl::decrypt( } //Decrypt the template - if( xmlSecEncCtxDecrypt( pEncCtx , pEncryptedData ) < 0 || pEncCtx->result == NULL ) { + if( xmlSecEncCtxDecrypt( pEncCtx , pEncryptedData ) < 0 || pEncCtx->result == nullptr ) { aTemplate->setStatus(css::xml::crypto::SecurityOperationStatus_UNKNOWN); xmlSecEncCtxDestroy( pEncCtx ) ; pSecEnv->destroyKeysManager( pMngr ); @@ -330,9 +330,9 @@ sal_Bool SAL_CALL XMLEncryption_MSCryptImpl::supportsService( const OUString& se const OUString* pArray = seqServiceNames.getConstArray() ; for( sal_Int32 i = 0 ; i < seqServiceNames.getLength() ; i ++ ) { if( *( pArray + i ) == serviceName ) - return sal_True ; + return true ; } - return sal_False ; + return false ; } /* XServiceInfo */ diff --git a/xmlsecurity/source/xmlsec/mscrypt/xmlencryption_mscryptimpl.hxx b/xmlsecurity/source/xmlsec/mscrypt/xmlencryption_mscryptimpl.hxx index 87c9408c7afd..27c0b80a2c8b 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/xmlencryption_mscryptimpl.hxx +++ b/xmlsecurity/source/xmlsec/mscrypt/xmlencryption_mscryptimpl.hxx @@ -43,7 +43,7 @@ class XMLEncryption_MSCryptImpl : public ::cppu::WeakImplHelper< public: explicit XMLEncryption_MSCryptImpl(const css::uno::Reference<css::lang::XMultiServiceFactory>& rFactory); - virtual ~XMLEncryption_MSCryptImpl() ; + virtual ~XMLEncryption_MSCryptImpl() override; //Methods from XXMLEncryption virtual css::uno::Reference< css::xml::crypto::XXMLEncryptionTemplate > SAL_CALL encrypt( @@ -51,22 +51,22 @@ class XMLEncryption_MSCryptImpl : public ::cppu::WeakImplHelper< const css::uno::Reference< css::xml::crypto::XSecurityEnvironment >& aEnvironment) // ) throw( css::uno::Exception , css::uno::RuntimeException ) ; throw ( css::xml::crypto::XMLEncryptionException , - css::uno::SecurityException); + css::uno::SecurityException) override; virtual css::uno::Reference< css::xml::crypto::XXMLEncryptionTemplate > SAL_CALL decrypt( const css::uno::Reference< css::xml::crypto::XXMLEncryptionTemplate >& aTemplate , const css::uno::Reference< css::xml::crypto::XXMLSecurityContext >& aContext ) throw( css::xml::crypto::XMLEncryptionException , - css::uno::SecurityException) ; + css::uno::SecurityException) override; //Methods from XServiceInfo - virtual OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException ) ; + virtual OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException ) override; virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName - ) throw( css::uno::RuntimeException ) ; + ) throw( css::uno::RuntimeException ) override; - virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw( css::uno::RuntimeException ) ; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw( css::uno::RuntimeException ) override; //Helper for XServiceInfo static css::uno::Sequence< OUString > impl_getSupportedServiceNames() ; diff --git a/xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.cxx index 8615671ed291..e1de76a5473d 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.cxx +++ b/xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.cxx @@ -36,7 +36,7 @@ using ::com::sun::star::xml::crypto::XXMLSecurityContext ; XMLSecurityContext_MSCryptImpl::XMLSecurityContext_MSCryptImpl() ://m_pKeysMngr( NULL ) , - m_xSecurityEnvironment( NULL ) + m_xSecurityEnvironment( nullptr ) { //Init xmlsec library if( xmlSecInit() < 0 ) { @@ -126,9 +126,9 @@ sal_Bool SAL_CALL XMLSecurityContext_MSCryptImpl::supportsService( const OUStrin const OUString* pArray = seqServiceNames.getConstArray() ; for( sal_Int32 i = 0 ; i < seqServiceNames.getLength() ; i ++ ) { if( *( pArray + i ) == serviceName ) - return sal_True ; + return true ; } - return sal_False ; + return false ; } /* XServiceInfo */ diff --git a/xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.hxx b/xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.hxx index 516546221f22..ae8eabab9d7c 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.hxx +++ b/xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.hxx @@ -45,41 +45,41 @@ class XMLSecurityContext_MSCryptImpl : public ::cppu::WeakImplHelper< public: XMLSecurityContext_MSCryptImpl(); - virtual ~XMLSecurityContext_MSCryptImpl(); + virtual ~XMLSecurityContext_MSCryptImpl() override; //Methods from XXMLSecurityContext virtual sal_Int32 SAL_CALL addSecurityEnvironment( const css::uno::Reference< css::xml::crypto::XSecurityEnvironment >& aSecurityEnvironment - ) throw (css::security::SecurityInfrastructureException, css::uno::RuntimeException); + ) throw (css::security::SecurityInfrastructureException, css::uno::RuntimeException) override; virtual ::sal_Int32 SAL_CALL getSecurityEnvironmentNumber( ) - throw (css::uno::RuntimeException); + throw (css::uno::RuntimeException) override; virtual css::uno::Reference< css::xml::crypto::XSecurityEnvironment > SAL_CALL getSecurityEnvironmentByIndex( ::sal_Int32 index ) - throw (css::uno::RuntimeException); + throw (css::uno::RuntimeException) override; virtual css::uno::Reference< css::xml::crypto::XSecurityEnvironment > SAL_CALL getSecurityEnvironment( ) - throw (css::uno::RuntimeException); + throw (css::uno::RuntimeException) override; virtual ::sal_Int32 SAL_CALL getDefaultSecurityEnvironmentIndex( ) - throw (css::uno::RuntimeException); + throw (css::uno::RuntimeException) override; virtual void SAL_CALL setDefaultSecurityEnvironmentIndex( sal_Int32 nDefaultEnvIndex ) - throw (css::uno::RuntimeException); + throw (css::uno::RuntimeException) override; //Methods from XServiceInfo - virtual OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException ) ; + virtual OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException ) override; virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName - ) throw( css::uno::RuntimeException ) ; + ) throw( css::uno::RuntimeException ) override; - virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw( css::uno::RuntimeException ) ; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw( css::uno::RuntimeException ) override; //Helper for XServiceInfo static css::uno::Sequence< OUString > impl_getSupportedServiceNames() ; diff --git a/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx index a23af537a925..cfc701fa96e2 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx +++ b/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx @@ -58,9 +58,9 @@ SAL_CALL XMLSignature_MSCryptImpl::generate( ) throw( css::xml::crypto::XMLSignatureException, css::uno::SecurityException ) { - xmlSecKeysMngrPtr pMngr = NULL ; - xmlSecDSigCtxPtr pDsigCtx = NULL ; - xmlNodePtr pNode = NULL ; + xmlSecKeysMngrPtr pMngr = nullptr ; + xmlSecDSigCtxPtr pDsigCtx = nullptr ; + xmlNodePtr pNode = nullptr ; if( !aTemplate.is() ) throw RuntimeException() ; @@ -74,8 +74,8 @@ SAL_CALL XMLSignature_MSCryptImpl::generate( throw RuntimeException() ; } - SecurityEnvironment_MSCryptImpl* pSecEnv = ( SecurityEnvironment_MSCryptImpl* )xSecTunnel->getSomething( SecurityEnvironment_MSCryptImpl::getUnoTunnelId() ) ; - if( pSecEnv == NULL ) + SecurityEnvironment_MSCryptImpl* pSecEnv = reinterpret_cast<SecurityEnvironment_MSCryptImpl*>(xSecTunnel->getSomething( SecurityEnvironment_MSCryptImpl::getUnoTunnelId() )); + if( pSecEnv == nullptr ) throw RuntimeException() ; //Get the xml node @@ -89,8 +89,8 @@ SAL_CALL XMLSignature_MSCryptImpl::generate( throw RuntimeException() ; } - XMLElementWrapper_XmlSecImpl* pElement = ( XMLElementWrapper_XmlSecImpl* )xNodTunnel->getSomething( XMLElementWrapper_XmlSecImpl::getUnoTunnelImplementationId() ) ; - if( pElement == NULL ) { + XMLElementWrapper_XmlSecImpl* pElement = reinterpret_cast<XMLElementWrapper_XmlSecImpl*>(xNodTunnel->getSomething( XMLElementWrapper_XmlSecImpl::getUnoTunnelImplementationId() )); + if( pElement == nullptr ) { throw RuntimeException() ; } @@ -113,7 +113,7 @@ SAL_CALL XMLSignature_MSCryptImpl::generate( //Create Signature context pDsigCtx = xmlSecDSigCtxCreate( pMngr ) ; - if( pDsigCtx == NULL ) + if( pDsigCtx == nullptr ) { //throw XMLSignatureException() ; pSecEnv->destroyKeysManager( pMngr ); @@ -154,9 +154,9 @@ SAL_CALL XMLSignature_MSCryptImpl::validate( ) throw( css::uno::RuntimeException, css::uno::SecurityException, css::xml::crypto::XMLSignatureException ) { - xmlSecKeysMngrPtr pMngr = NULL ; - xmlSecDSigCtxPtr pDsigCtx = NULL ; - xmlNodePtr pNode = NULL ; + xmlSecKeysMngrPtr pMngr = nullptr ; + xmlSecDSigCtxPtr pDsigCtx = nullptr ; + xmlNodePtr pNode = nullptr ; if( !aTemplate.is() ) throw RuntimeException() ; @@ -173,8 +173,8 @@ SAL_CALL XMLSignature_MSCryptImpl::validate( throw RuntimeException() ; } - SecurityEnvironment_MSCryptImpl* pSecEnv = ( SecurityEnvironment_MSCryptImpl* )xSecTunnel->getSomething( SecurityEnvironment_MSCryptImpl::getUnoTunnelId() ) ; - if( pSecEnv == NULL ) + SecurityEnvironment_MSCryptImpl* pSecEnv = reinterpret_cast<SecurityEnvironment_MSCryptImpl*>(xSecTunnel->getSomething( SecurityEnvironment_MSCryptImpl::getUnoTunnelId() )); + if( pSecEnv == nullptr ) throw RuntimeException() ; //Get the xml node @@ -187,8 +187,8 @@ SAL_CALL XMLSignature_MSCryptImpl::validate( throw RuntimeException() ; } - XMLElementWrapper_XmlSecImpl* pElement = ( XMLElementWrapper_XmlSecImpl* )xNodTunnel->getSomething( XMLElementWrapper_XmlSecImpl::getUnoTunnelImplementationId() ) ; - if( pElement == NULL ) + XMLElementWrapper_XmlSecImpl* pElement = reinterpret_cast<XMLElementWrapper_XmlSecImpl*>(xNodTunnel->getSomething( XMLElementWrapper_XmlSecImpl::getUnoTunnelImplementationId() )); + if( pElement == nullptr ) throw RuntimeException() ; pNode = pElement->getNativeElement() ; @@ -210,7 +210,7 @@ SAL_CALL XMLSignature_MSCryptImpl::validate( //Create Signature context pDsigCtx = xmlSecDSigCtxCreate( pMngr ) ; - if( pDsigCtx == NULL ) + if( pDsigCtx == nullptr ) { pSecEnv->destroyKeysManager( pMngr ); clearErrorRecorder(); @@ -275,9 +275,9 @@ sal_Bool SAL_CALL XMLSignature_MSCryptImpl::supportsService( const OUString& ser const OUString* pArray = seqServiceNames.getConstArray() ; for( sal_Int32 i = 0 ; i < seqServiceNames.getLength() ; i ++ ) { if( *( pArray + i ) == serviceName ) - return sal_True ; + return true ; } - return sal_False ; + return false ; } /* XServiceInfo */ diff --git a/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.hxx b/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.hxx index bc8b1540628f..ea551f5930f5 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.hxx +++ b/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.hxx @@ -43,30 +43,30 @@ class XMLSignature_MSCryptImpl : public ::cppu::WeakImplHelper< public: explicit XMLSignature_MSCryptImpl(const css::uno::Reference<css::lang::XMultiServiceFactory >& rFactory); - virtual ~XMLSignature_MSCryptImpl() ; + virtual ~XMLSignature_MSCryptImpl() override; //Methods from XXMLSignature virtual css::uno::Reference< css::xml::crypto::XXMLSignatureTemplate > SAL_CALL generate( const css::uno::Reference< css::xml::crypto::XXMLSignatureTemplate >& aTemplate , const css::uno::Reference< css::xml::crypto::XSecurityEnvironment >& aEnvironment ) throw( css::xml::crypto::XMLSignatureException, - css::uno::SecurityException) ; + css::uno::SecurityException) override; virtual css::uno::Reference< css::xml::crypto::XXMLSignatureTemplate > SAL_CALL validate( const css::uno::Reference< css::xml::crypto::XXMLSignatureTemplate >& aTemplate , const css::uno::Reference< css::xml::crypto::XXMLSecurityContext >& aContext ) throw( css::uno::RuntimeException, css::uno::SecurityException, - css::xml::crypto::XMLSignatureException); + css::xml::crypto::XMLSignatureException) override; //Methods from XServiceInfo - virtual OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException ) ; + virtual OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException ) override; virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName - ) throw( css::uno::RuntimeException ) ; + ) throw( css::uno::RuntimeException ) override; - virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw( css::uno::RuntimeException ) ; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw( css::uno::RuntimeException ) override; //Helper for XServiceInfo static css::uno::Sequence< OUString > impl_getSupportedServiceNames() ; diff --git a/xmlsecurity/source/xmlsec/mscrypt/xsec_mscrypt.cxx b/xmlsecurity/source/xmlsec/mscrypt/xsec_mscrypt.cxx index 47dac9444828..3b682e147f7a 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/xsec_mscrypt.cxx +++ b/xmlsecurity/source/xmlsec/mscrypt/xsec_mscrypt.cxx @@ -41,21 +41,21 @@ extern "C" void* SAL_CALL mscrypt_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 ) { if( XMLSignature_MSCryptImpl::impl_getImplementationName().equalsAscii( pImplName ) ) { - xFactory = XMLSignature_MSCryptImpl::impl_createFactory( reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ; + xFactory = XMLSignature_MSCryptImpl::impl_createFactory( static_cast< XMultiServiceFactory* >( pServiceManager ) ) ; } else if( XMLSecurityContext_MSCryptImpl::impl_getImplementationName().equalsAscii( pImplName ) ) { - xFactory = XMLSecurityContext_MSCryptImpl::impl_createFactory( reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ; + xFactory = XMLSecurityContext_MSCryptImpl::impl_createFactory( static_cast< XMultiServiceFactory* >( pServiceManager ) ) ; } else if( SecurityEnvironment_MSCryptImpl::impl_getImplementationName().equalsAscii( pImplName ) ) { - xFactory = SecurityEnvironment_MSCryptImpl::impl_createFactory( reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ; + xFactory = SecurityEnvironment_MSCryptImpl::impl_createFactory( static_cast< XMultiServiceFactory* >( pServiceManager ) ) ; } else if( XMLEncryption_MSCryptImpl::impl_getImplementationName().equalsAscii( pImplName ) ) { - xFactory = XMLEncryption_MSCryptImpl::impl_createFactory( reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ; + xFactory = XMLEncryption_MSCryptImpl::impl_createFactory( static_cast< XMultiServiceFactory* >( pServiceManager ) ) ; } else if( SEInitializer_MSCryptImpl_getImplementationName().equalsAscii( pImplName ) ) { xFactory.set( createSingleFactory( - reinterpret_cast< XMultiServiceFactory * >( pServiceManager ), + static_cast< XMultiServiceFactory * >( pServiceManager ), OUString::createFromAscii( pImplName ), SEInitializer_MSCryptImpl_createInstance, SEInitializer_MSCryptImpl_getSupportedServiceNames() ) ); } diff --git a/xmlsecurity/source/xmlsec/nss/xsec_nss.cxx b/xmlsecurity/source/xmlsec/nss/xsec_nss.cxx index 33ab82c265f4..7bee0f072471 100644 --- a/xmlsecurity/source/xmlsec/nss/xsec_nss.cxx +++ b/xmlsecurity/source/xmlsec/nss/xsec_nss.cxx @@ -75,7 +75,7 @@ void* SAL_CALL nss_component_getFactory( const sal_Char* pImplName , void* pServ if( ONSSInitializer_getImplementationName().equalsAscii( pImplName ) ) { xFactory.set( createSingleFactory( - reinterpret_cast< XMultiServiceFactory * >( pServiceManager ), + static_cast< XMultiServiceFactory * >( pServiceManager ), OUString::createFromAscii( pImplName ), ONSSInitializer_createInstance, ONSSInitializer_getSupportedServiceNames() ) ); } diff --git a/xmlsecurity/source/xmlsec/xsec_xmlsec.cxx b/xmlsecurity/source/xmlsec/xsec_xmlsec.cxx index 3b973e16b7b7..7b71312be167 100644 --- a/xmlsecurity/source/xmlsec/xsec_xmlsec.cxx +++ b/xmlsecurity/source/xmlsec/xsec_xmlsec.cxx @@ -73,7 +73,7 @@ SAL_DLLPUBLIC_EXPORT void* SAL_CALL xsec_xmlsec_component_getFactory( const sal_ #if defined( XMLSEC_CRYPTO_MSCRYPTO ) pRet = mscrypt_component_getFactory( pImplName, pServiceManager, pRegistryKey ) ; - if( pRet != NULL ) + if( pRet != nullptr ) return pRet ; #endif } |