From c5f1e8c3bbf6bb534b387cdafd1983204f82dd37 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Thu, 26 Mar 2015 15:32:44 +0100 Subject: const_cast: convert some C-style casts and remove some redundant ones Change-Id: I42fdc042ed7317b5b6c337e7b38966e616f8e24b --- xmlsecurity/source/xmlsec/nss/ciphercontext.cxx | 4 ++-- xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'xmlsecurity/source/xmlsec/nss') diff --git a/xmlsecurity/source/xmlsec/nss/ciphercontext.cxx b/xmlsecurity/source/xmlsec/nss/ciphercontext.cxx index fbf99a799e67..1a5b47319c8f 100644 --- a/xmlsecurity/source/xmlsec/nss/ciphercontext.cxx +++ b/xmlsecurity/source/xmlsec/nss/ciphercontext.cxx @@ -157,7 +157,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL OCipherContext::convertWithCipherContext( c { int nResultLen = 0; aResult.realloc( aToConvert.getLength() + m_nBlockSize ); - if ( PK11_CipherOp( m_pContext, reinterpret_cast< unsigned char* >( aResult.getArray() ), &nResultLen, aResult.getLength(), const_cast< unsigned char* >( reinterpret_cast< const unsigned char* >( aToConvert.getConstArray() ) ), aToConvert.getLength() ) != SECSuccess ) + if ( PK11_CipherOp( m_pContext, reinterpret_cast< unsigned char* >( aResult.getArray() ), &nResultLen, aResult.getLength(), reinterpret_cast< const unsigned char* >( aToConvert.getConstArray() ), aToConvert.getLength() ) != SECSuccess ) { m_bBroken = true; Dispose(); @@ -221,7 +221,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL OCipherContext::finalizeCipherContextAndDis { int nPrefResLen = 0; aResult.realloc( m_aLastBlock.getLength() + m_nBlockSize ); - if ( PK11_CipherOp( m_pContext, reinterpret_cast< unsigned char* >( aResult.getArray() ), &nPrefResLen, aResult.getLength(), const_cast< unsigned char* >( reinterpret_cast< const unsigned char* >( m_aLastBlock.getConstArray() ) ), m_aLastBlock.getLength() ) != SECSuccess ) + if ( PK11_CipherOp( m_pContext, reinterpret_cast< unsigned char* >( aResult.getArray() ), &nPrefResLen, aResult.getLength(), reinterpret_cast< const unsigned char* >( m_aLastBlock.getConstArray() ), m_aLastBlock.getLength() ) != SECSuccess ) { m_bBroken = true; Dispose(); diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx index cfa3b8a9a896..0355e27bb7a6 100644 --- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx @@ -437,7 +437,7 @@ Reference< XCertificate > SecurityEnvironment_NssImpl :: getCertificate( const O // Create cert info from issue and serial OString ostr = OUStringToOString( issuerName , RTL_TEXTENCODING_UTF8 ) ; - chIssuer = PL_strndup( ( char* )ostr.getStr(), ( int )ostr.getLength() ) ; + chIssuer = PL_strndup( ostr.getStr(), ( int )ostr.getLength() ) ; nmIssuer = CERT_AsciiToName( chIssuer ) ; if( nmIssuer == NULL ) { PL_strfree( chIssuer ) ; @@ -508,7 +508,7 @@ Sequence< Reference < XCertificate > > SecurityEnvironment_NssImpl :: buildCerti //Get the system clock time timeboundary = PR_Now() ; - certChain = CERT_GetCertChainFromCert( ( CERTCertificate* )cert, timeboundary, certUsageAnyCA ) ; + certChain = CERT_GetCertChainFromCert( const_cast(cert), timeboundary, certUsageAnyCA ) ; } else { certChain = NULL ; } @@ -844,13 +844,13 @@ sal_Int32 SecurityEnvironment_NssImpl::getCertificateCharacters( if (cert->slot != NULL) { - priKey = PK11_FindPrivateKeyFromCert( cert->slot, ( CERTCertificate* )cert, NULL ) ; + priKey = PK11_FindPrivateKeyFromCert( cert->slot, const_cast(cert), NULL ) ; } if(priKey == NULL) { for (CIT_SLOTS is = m_Slots.begin(); is != m_Slots.end(); is++) { - priKey = PK11_FindPrivateKeyFromCert(*is, (CERTCertificate*)cert, NULL); + priKey = PK11_FindPrivateKeyFromCert(*is, const_cast(cert), NULL); if (priKey) break; } -- cgit