diff options
author | Arnaud Versini <arnaud.versini@gmail.com> | 2012-07-28 22:01:59 +0200 |
---|---|---|
committer | Arnaud Versini <arnaud.versini@gmail.com> | 2012-07-29 15:01:55 +0200 |
commit | 4be123fed2b8d7e10bb98cd753e3b5cbc1d7293a (patch) | |
tree | bef4471311bb3b1c3a6b5594fe1a08bb9f8ac091 /package | |
parent | e2b7dc3fcd8cc926d54ddcca0d268fbd3b123a7f (diff) |
Use memcpy & memcmp insteadof rtl_copyMemory & rtl_compareMemory in package
Change-Id: Ia24406ff31949e00725db74bbe5b016894a22f50
Diffstat (limited to 'package')
-rw-r--r-- | package/source/zipapi/XUnbufferedStream.cxx | 4 | ||||
-rw-r--r-- | package/source/zipapi/ZipFile.cxx | 18 | ||||
-rw-r--r-- | package/source/zippackage/ZipPackage.cxx | 2 | ||||
-rw-r--r-- | package/source/zippackage/ZipPackageFolder.cxx | 4 | ||||
-rw-r--r-- | package/source/zippackage/ZipPackageStream.cxx | 3 |
5 files changed, 17 insertions, 14 deletions
diff --git a/package/source/zipapi/XUnbufferedStream.cxx b/package/source/zipapi/XUnbufferedStream.cxx index 961cfff17dc9..7ef9b09e505e 100644 --- a/package/source/zipapi/XUnbufferedStream.cxx +++ b/package/source/zipapi/XUnbufferedStream.cxx @@ -182,7 +182,7 @@ sal_Int32 SAL_CALL XUnbufferedStream::readBytes( Sequence< sal_Int8 >& aData, sa { sal_Int16 nHeadRead = static_cast< sal_Int16 >(( nRequestedBytes > mnHeaderToRead ? mnHeaderToRead : nRequestedBytes )); - rtl_copyMemory ( aData.getArray(), maHeader.getConstArray() + maHeader.getLength() - mnHeaderToRead, nHeadRead ); + memcpy ( aData.getArray(), maHeader.getConstArray() + maHeader.getLength() - mnHeaderToRead, nHeadRead ); mnHeaderToRead = mnHeaderToRead - nHeadRead; if ( nHeadRead < nRequestedBytes ) @@ -275,7 +275,7 @@ sal_Int32 SAL_CALL XUnbufferedStream::readBytes( Sequence< sal_Int8 >& aData, sa { sal_Int32 nOldLen = maCompBuffer.getLength(); maCompBuffer.realloc( nOldLen + aSuffix.getLength() ); - rtl_copyMemory( maCompBuffer.getArray() + nOldLen, aSuffix.getConstArray(), aSuffix.getLength() ); + memcpy( maCompBuffer.getArray() + nOldLen, aSuffix.getConstArray(), aSuffix.getLength() ); } } } diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx index e67b07e7beee..81f1793e6c55 100644 --- a/package/source/zipapi/ZipFile.cxx +++ b/package/source/zipapi/ZipFile.cxx @@ -276,19 +276,19 @@ void ZipFile::StaticFillHeader( const ::rtl::Reference< EncryptionData >& rData, *(pHeader++) = static_cast< sal_Int8 >(( nMediaTypeLength >> 8 ) & 0xFF); // Then the salt content - rtl_copyMemory ( pHeader, rData->m_aSalt.getConstArray(), nSaltLength ); + memcpy ( pHeader, rData->m_aSalt.getConstArray(), nSaltLength ); pHeader += nSaltLength; // Then the IV content - rtl_copyMemory ( pHeader, rData->m_aInitVector.getConstArray(), nIVLength ); + memcpy ( pHeader, rData->m_aInitVector.getConstArray(), nIVLength ); pHeader += nIVLength; // Then the digest content - rtl_copyMemory ( pHeader, rData->m_aDigest.getConstArray(), nDigestLength ); + memcpy ( pHeader, rData->m_aDigest.getConstArray(), nDigestLength ); pHeader += nDigestLength; // Then the mediatype itself - rtl_copyMemory ( pHeader, aMediaType.getStr(), nMediaTypeLength ); + memcpy ( pHeader, aMediaType.getStr(), nMediaTypeLength ); pHeader += nMediaTypeLength; } @@ -356,15 +356,15 @@ sal_Bool ZipFile::StaticFillData ( ::rtl::Reference< BaseEncryptionData > & rDa if ( nSaltLength == rStream->readBytes ( aBuffer, nSaltLength ) ) { rData->m_aSalt.realloc ( nSaltLength ); - rtl_copyMemory ( rData->m_aSalt.getArray(), aBuffer.getConstArray(), nSaltLength ); + memcpy ( rData->m_aSalt.getArray(), aBuffer.getConstArray(), nSaltLength ); if ( nIVLength == rStream->readBytes ( aBuffer, nIVLength ) ) { rData->m_aInitVector.realloc ( nIVLength ); - rtl_copyMemory ( rData->m_aInitVector.getArray(), aBuffer.getConstArray(), nIVLength ); + memcpy ( rData->m_aInitVector.getArray(), aBuffer.getConstArray(), nIVLength ); if ( nDigestLength == rStream->readBytes ( aBuffer, nDigestLength ) ) { rData->m_aDigest.realloc ( nDigestLength ); - rtl_copyMemory ( rData->m_aDigest.getArray(), aBuffer.getConstArray(), nDigestLength ); + memcpy ( rData->m_aDigest.getArray(), aBuffer.getConstArray(), nDigestLength ); if ( nMediaTypeLength == rStream->readBytes ( aBuffer, nMediaTypeLength ) ) { @@ -464,7 +464,7 @@ sal_Bool ZipFile::StaticHasValidPassword( const uno::Reference< lang::XMultiServ { sal_Int32 nOldLen = aDecryptBuffer.getLength(); aDecryptBuffer.realloc( nOldLen + aDecryptBuffer2.getLength() ); - rtl_copyMemory( aDecryptBuffer.getArray() + nOldLen, aDecryptBuffer2.getArray(), aDecryptBuffer2.getLength() ); + memcpy( aDecryptBuffer.getArray() + nOldLen, aDecryptBuffer2.getArray(), aDecryptBuffer2.getLength() ); } if ( aDecryptBuffer.getLength() > n_ConstDigestLength ) @@ -479,7 +479,7 @@ sal_Bool ZipFile::StaticHasValidPassword( const uno::Reference< lang::XMultiServ // If we don't have a digest, then we have to assume that the password is correct if ( rData->m_aDigest.getLength() != 0 && ( aDigestSeq.getLength() != rData->m_aDigest.getLength() || - 0 != rtl_compareMemory ( aDigestSeq.getConstArray(), + 0 != memcmp ( aDigestSeq.getConstArray(), rData->m_aDigest.getConstArray(), aDigestSeq.getLength() ) ) ) { diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx index 8cd044ff16da..35c737996eb1 100644 --- a/package/source/zippackage/ZipPackage.cxx +++ b/package/source/zippackage/ZipPackage.cxx @@ -1697,7 +1697,7 @@ Sequence< sal_Int8 > ZipPackage::getUnoTunnelImplementationId( void ) sal_Int64 SAL_CALL ZipPackage::getSomething( const uno::Sequence< sal_Int8 >& aIdentifier ) throw( RuntimeException ) { - if ( aIdentifier.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelImplementationId().getConstArray(), aIdentifier.getConstArray(), 16 ) ) + if ( aIdentifier.getLength() == 16 && 0 == memcmp( getUnoTunnelImplementationId().getConstArray(), aIdentifier.getConstArray(), 16 ) ) return reinterpret_cast < sal_Int64 > ( this ); return 0; } diff --git a/package/source/zippackage/ZipPackageFolder.cxx b/package/source/zippackage/ZipPackageFolder.cxx index b9c19c9a3ce2..60de629b6384 100644 --- a/package/source/zippackage/ZipPackageFolder.cxx +++ b/package/source/zippackage/ZipPackageFolder.cxx @@ -17,6 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <string.h> + #include <ZipPackageFolder.hxx> #include <ZipFile.hxx> #include <ZipOutputStream.hxx> @@ -764,7 +766,7 @@ sal_Int64 SAL_CALL ZipPackageFolder::getSomething( const uno::Sequence< sal_Int8 { sal_Int64 nMe = 0; if ( aIdentifier.getLength() == 16 && - 0 == rtl_compareMemory(static_getImplementationId().getConstArray(), aIdentifier.getConstArray(), 16 ) ) + 0 == memcmp(static_getImplementationId().getConstArray(), aIdentifier.getConstArray(), 16 ) ) nMe = reinterpret_cast < sal_Int64 > ( this ); return nMe; } diff --git a/package/source/zippackage/ZipPackageStream.cxx b/package/source/zippackage/ZipPackageStream.cxx index e816c496cb12..fa066bd07b8c 100644 --- a/package/source/zippackage/ZipPackageStream.cxx +++ b/package/source/zippackage/ZipPackageStream.cxx @@ -28,6 +28,7 @@ #include <com/sun/star/xml/crypto/DigestID.hpp> #include <com/sun/star/xml/crypto/CipherID.hpp> +#include <string.h> #include <ZipPackageStream.hxx> #include <ZipPackage.hxx> @@ -691,7 +692,7 @@ sal_Int64 SAL_CALL ZipPackageStream::getSomething( const Sequence< sal_Int8 >& a { sal_Int64 nMe = 0; if ( aIdentifier.getLength() == 16 && - 0 == rtl_compareMemory( static_getImplementationId().getConstArray(), aIdentifier.getConstArray(), 16 ) ) + 0 == memcmp( static_getImplementationId().getConstArray(), aIdentifier.getConstArray(), 16 ) ) nMe = reinterpret_cast < sal_Int64 > ( this ); return nMe; } |