Replace usage of rtl/memory.h in xmlsecurity their equivalent from string.h

Change-Id: Id4a088864ee28163160d6ac408592952fe6c797d
This commit is contained in:
Arnaud Versini 2012-08-04 11:56:03 +02:00
parent 1af0e36fb6
commit 9b2e6d4536
6 changed files with 17 additions and 15 deletions

View File

@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 . * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ */
#include <string.h>
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning(push,1) #pragma warning(push,1)
@ -48,8 +49,6 @@
#include <osl/nlsupport.h> #include <osl/nlsupport.h>
#include <osl/process.h> #include <osl/process.h>
#include <rtl/memory.h>
#include "../diagnose.hxx" #include "../diagnose.hxx"
using namespace xmlsecurity; using namespace xmlsecurity;
@ -211,7 +210,7 @@ Reference< XSingleServiceFactory > SecurityEnvironment_MSCryptImpl :: impl_creat
sal_Int64 SAL_CALL SecurityEnvironment_MSCryptImpl :: getSomething( const Sequence< sal_Int8 >& aIdentifier ) sal_Int64 SAL_CALL SecurityEnvironment_MSCryptImpl :: getSomething( const Sequence< sal_Int8 >& aIdentifier )
throw( RuntimeException ) throw( RuntimeException )
{ {
if( aIdentifier.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), aIdentifier.getConstArray(), 16 ) ) { if( aIdentifier.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(), aIdentifier.getConstArray(), 16 ) ) {
return ( sal_Int64 )this ; return ( sal_Int64 )this ;
} }
return 0 ; return 0 ;
@ -947,7 +946,7 @@ sal_Int32 SecurityEnvironment_MSCryptImpl :: verifyCertificate(
CERT_ENHKEY_USAGE enhKeyUsage ; CERT_ENHKEY_USAGE enhKeyUsage ;
CERT_USAGE_MATCH certUsage ; CERT_USAGE_MATCH certUsage ;
CERT_CHAIN_PARA chainPara ; CERT_CHAIN_PARA chainPara ;
rtl_zeroMemory(&chainPara, sizeof(CERT_CHAIN_PARA)); memset(&chainPara, 0, sizeof(CERT_CHAIN_PARA));
//Prepare parameter for CertGetCertificateChain //Prepare parameter for CertGetCertificateChain
enhKeyUsage.cUsageIdentifier = 0 ; enhKeyUsage.cUsageIdentifier = 0 ;

View File

@ -17,6 +17,8 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 . * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ */
#include <string.h>
#include <sal/config.h> #include <sal/config.h>
#include <comphelper/servicehelper.hxx> #include <comphelper/servicehelper.hxx>
#include "x509certificate_mscryptimpl.hxx" #include "x509certificate_mscryptimpl.hxx"
@ -471,7 +473,7 @@ void X509Certificate_MSCryptImpl :: setRawCert( Sequence< sal_Int8 > rawCert ) t
/* XUnoTunnel */ /* XUnoTunnel */
sal_Int64 SAL_CALL X509Certificate_MSCryptImpl :: getSomething( const Sequence< sal_Int8 >& aIdentifier ) throw( RuntimeException ) { sal_Int64 SAL_CALL X509Certificate_MSCryptImpl :: getSomething( const Sequence< sal_Int8 >& aIdentifier ) throw( RuntimeException ) {
if( aIdentifier.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), aIdentifier.getConstArray(), 16 ) ) { if( aIdentifier.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(), aIdentifier.getConstArray(), 16 ) ) {
return ( sal_Int64 )this ; return ( sal_Int64 )this ;
} }
return 0 ; return 0 ;

View File

@ -130,23 +130,23 @@ uno::Sequence< ::sal_Int8 > SAL_CALL OCipherContext::convertWithCipherContext( c
if ( nToConvertLen == 0 ) if ( nToConvertLen == 0 )
{ {
m_aLastBlock.realloc( nOldLastBlockLen + aData.getLength() ); m_aLastBlock.realloc( nOldLastBlockLen + aData.getLength() );
rtl_copyMemory( m_aLastBlock.getArray() + nOldLastBlockLen, aData.getConstArray(), aData.getLength() ); memcpy( m_aLastBlock.getArray() + nOldLastBlockLen, aData.getConstArray(), aData.getLength() );
// aToConvert stays empty // aToConvert stays empty
} }
else if ( nToConvertLen < nOldLastBlockLen ) else if ( nToConvertLen < nOldLastBlockLen )
{ {
rtl_copyMemory( aToConvert.getArray(), m_aLastBlock.getConstArray(), nToConvertLen ); memcpy( aToConvert.getArray(), m_aLastBlock.getConstArray(), nToConvertLen );
rtl_copyMemory( m_aLastBlock.getArray(), m_aLastBlock.getConstArray() + nToConvertLen, nOldLastBlockLen - nToConvertLen ); memcpy( m_aLastBlock.getArray(), m_aLastBlock.getConstArray() + nToConvertLen, nOldLastBlockLen - nToConvertLen );
m_aLastBlock.realloc( nOldLastBlockLen - nToConvertLen + aData.getLength() ); m_aLastBlock.realloc( nOldLastBlockLen - nToConvertLen + aData.getLength() );
rtl_copyMemory( m_aLastBlock.getArray() + nOldLastBlockLen - nToConvertLen, aData.getConstArray(), aData.getLength() ); memcpy( m_aLastBlock.getArray() + nOldLastBlockLen - nToConvertLen, aData.getConstArray(), aData.getLength() );
} }
else else
{ {
rtl_copyMemory( aToConvert.getArray(), m_aLastBlock.getConstArray(), nOldLastBlockLen ); memcpy( aToConvert.getArray(), m_aLastBlock.getConstArray(), nOldLastBlockLen );
if ( nToConvertLen > nOldLastBlockLen ) if ( nToConvertLen > nOldLastBlockLen )
rtl_copyMemory( aToConvert.getArray() + nOldLastBlockLen, aData.getConstArray(), nToConvertLen - nOldLastBlockLen ); memcpy( aToConvert.getArray() + nOldLastBlockLen, aData.getConstArray(), nToConvertLen - nOldLastBlockLen );
m_aLastBlock.realloc( nAvailableData - nToConvertLen ); m_aLastBlock.realloc( nAvailableData - nToConvertLen );
rtl_copyMemory( m_aLastBlock.getArray(), aData.getConstArray() + nToConvertLen - nOldLastBlockLen, nAvailableData - nToConvertLen ); memcpy( m_aLastBlock.getArray(), aData.getConstArray() + nToConvertLen - nOldLastBlockLen, nAvailableData - nToConvertLen );
} }
} }

View File

@ -223,7 +223,7 @@ Reference< XSingleServiceFactory > SecurityEnvironment_NssImpl :: impl_createFac
sal_Int64 SAL_CALL SecurityEnvironment_NssImpl :: getSomething( const Sequence< sal_Int8 >& aIdentifier ) sal_Int64 SAL_CALL SecurityEnvironment_NssImpl :: getSomething( const Sequence< sal_Int8 >& aIdentifier )
throw( RuntimeException ) throw( RuntimeException )
{ {
if( aIdentifier.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), aIdentifier.getConstArray(), 16 ) ) { if( aIdentifier.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(), aIdentifier.getConstArray(), 16 ) ) {
return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this)); return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this));
} }
return 0 ; return 0 ;

View File

@ -304,7 +304,7 @@ void X509Certificate_NssImpl :: setRawCert( Sequence< sal_Int8 > rawCert ) throw
/* XUnoTunnel */ /* XUnoTunnel */
sal_Int64 SAL_CALL X509Certificate_NssImpl :: getSomething( const Sequence< sal_Int8 >& aIdentifier ) throw( RuntimeException ) { sal_Int64 SAL_CALL X509Certificate_NssImpl :: getSomething( const Sequence< sal_Int8 >& aIdentifier ) throw( RuntimeException ) {
if( aIdentifier.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), aIdentifier.getConstArray(), 16 ) ) { if( aIdentifier.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(), aIdentifier.getConstArray(), 16 ) ) {
return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this)); return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this));
} }
return 0 ; return 0 ;

View File

@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 . * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ */
#include <string.h>
#include "xmlelementwrapper_xmlsecimpl.hxx" #include "xmlelementwrapper_xmlsecimpl.hxx"
#include <cppuhelper/typeprovider.hxx> #include <cppuhelper/typeprovider.hxx>
@ -56,7 +57,7 @@ sal_Int64 SAL_CALL XMLElementWrapper_XmlSecImpl::getSomething( const cssu::Seque
throw (cssu::RuntimeException) throw (cssu::RuntimeException)
{ {
if (aIdentifier.getLength() == 16 && if (aIdentifier.getLength() == 16 &&
0 == rtl_compareMemory( 0 == memcmp(
getUnoTunnelImplementationId().getConstArray(), getUnoTunnelImplementationId().getConstArray(),
aIdentifier.getConstArray(), aIdentifier.getConstArray(),
16 )) 16 ))