summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorArnaud Versini <arnaud.versini@gmail.com>2012-07-25 20:03:22 +0200
committerArnaud Versini <arnaud.versini@gmail.com>2012-07-27 20:19:13 +0200
commitd6c284e4b146a44ba69a96836c59a98d077bb934 (patch)
tree13f4f278cd9642eadcbadbc84581573aafb28c58 /sal
parent5dbbe223c8586bd653685d27c664aa8395632e4a (diff)
Use memset and memcpy insteadof rtl_zeroMemory and rtl_copyMemory in sal
Change-Id: I4f9649ca61c988d425b59e41549d1c46bb808f2c
Diffstat (limited to 'sal')
-rw-r--r--sal/inc/osl/file.hxx6
-rw-r--r--sal/osl/w32/pipe.c8
-rw-r--r--sal/osl/w32/procimpl.cxx3
-rw-r--r--sal/qa/osl/file/osl_File.cxx4
-rw-r--r--sal/rtl/source/byteseq.cxx12
-rw-r--r--sal/rtl/source/cipher.cxx8
-rw-r--r--sal/rtl/source/digest.cxx72
-rw-r--r--sal/rtl/source/strbuf.cxx10
-rw-r--r--sal/rtl/source/string.cxx10
-rw-r--r--sal/rtl/source/unload.cxx4
-rw-r--r--sal/rtl/source/ustrbuf.cxx10
-rw-r--r--sal/rtl/source/ustring.cxx20
-rw-r--r--sal/workben/testfile.cxx4
13 files changed, 94 insertions, 77 deletions
diff --git a/sal/inc/osl/file.hxx b/sal/inc/osl/file.hxx
index e93682d10827..431685a5cc1d 100644
--- a/sal/inc/osl/file.hxx
+++ b/sal/inc/osl/file.hxx
@@ -31,6 +31,8 @@
#include "sal/config.h"
+#include <string.h>
+
#include <cassert>
#include <osl/time.h>
@@ -444,7 +446,7 @@ public:
VolumeInfo( sal_uInt32 nMask ): _nMask( nMask )
{
_aInfo.uStructSize = sizeof( oslVolumeInfo );
- rtl_zeroMemory( &_aInfo.uValidFields, sizeof( oslVolumeInfo ) - sizeof( sal_uInt32 ) );
+ memset( &_aInfo.uValidFields, 0, sizeof( oslVolumeInfo ) - sizeof( sal_uInt32 ) );
_aInfo.pDeviceHandle = &_aDevice._aHandle;
}
@@ -692,7 +694,7 @@ public:
FileStatus( sal_uInt32 nMask ): _nMask( nMask )
{
_aStatus.uStructSize = sizeof( oslFileStatus );
- rtl_zeroMemory( &_aStatus.uValidFields, sizeof( oslFileStatus ) - sizeof( sal_uInt32 ) );
+ memset( &_aStatus.uValidFields, 0, sizeof( oslFileStatus ) - sizeof( sal_uInt32 ) );
}
/** Destructor.
diff --git a/sal/osl/w32/pipe.c b/sal/osl/w32/pipe.c
index 0532f82d1057..e02692362028 100644
--- a/sal/osl/w32/pipe.c
+++ b/sal/osl/w32/pipe.c
@@ -26,6 +26,8 @@
*
************************************************************************/
+#include <string.h>
+
#include "system.h"
#include <osl/pipe.h>
@@ -314,7 +316,7 @@ oslPipe SAL_CALL osl_acceptPipe(oslPipe pPipe)
OSL_ASSERT(pPipe);
OSL_ASSERT(pPipe->m_File != INVALID_HANDLE_VALUE);
- rtl_zeroMemory(&os, sizeof(OVERLAPPED));
+ memset(&os, 0, sizeof(OVERLAPPED));
os.hEvent = pPipe->m_AcceptEvent;
ResetEvent(pPipe->m_AcceptEvent);
@@ -389,7 +391,7 @@ sal_Int32 SAL_CALL osl_receivePipe(oslPipe pPipe,
OSL_ASSERT(pPipe);
- rtl_zeroMemory(&os,sizeof(OVERLAPPED));
+ memset(&os, 0, sizeof(OVERLAPPED));
os.hEvent = pPipe->m_ReadEvent;
ResetEvent(pPipe->m_ReadEvent);
@@ -428,7 +430,7 @@ sal_Int32 SAL_CALL osl_sendPipe(oslPipe pPipe,
OSL_ASSERT(pPipe);
- rtl_zeroMemory(&os, sizeof(OVERLAPPED));
+ memset(&os, 0, sizeof(OVERLAPPED));
os.hEvent = pPipe->m_WriteEvent;
ResetEvent(pPipe->m_WriteEvent);
diff --git a/sal/osl/w32/procimpl.cxx b/sal/osl/w32/procimpl.cxx
index 9dc0959b7742..2b7d6ba6b066 100644
--- a/sal/osl/w32/procimpl.cxx
+++ b/sal/osl/w32/procimpl.cxx
@@ -53,6 +53,7 @@
#include <vector>
#include <algorithm>
#include <string>
+#include <string.h>
//#################################################
extern "C" oslFileHandle SAL_CALL osl_createFileHandleFromOSHandle( HANDLE hFile, sal_uInt32 uFlags );
@@ -218,7 +219,7 @@ namespace /* private */
OSL_ASSERT(envv.getLength());
sal_uInt32 n = envv.getLength() + 1; // copy the final '\0', too
- rtl_copyMemory(
+ memcpy(
reinterpret_cast<void*>(&environment[pos]),
reinterpret_cast<const void*>(envv.getStr()),
n * sizeof(sal_Unicode));
diff --git a/sal/qa/osl/file/osl_File.cxx b/sal/qa/osl/file/osl_File.cxx
index dff2840fc80e..b50735d16867 100644
--- a/sal/qa/osl/file/osl_File.cxx
+++ b/sal/qa/osl/file/osl_File.cxx
@@ -6063,7 +6063,7 @@ namespace osl_Directory
void rm_test_path(const OUString& path)
{
sal_Unicode buffer[PATH_BUFFER_SIZE];
- rtl_copyMemory(buffer, path.getStr(), (path.getLength() + 1) * sizeof(sal_Unicode));
+ memcpy(buffer, path.getStr(), (path.getLength() + 1) * sizeof(sal_Unicode));
sal_Int32 i = rtl_ustr_lastIndexOfChar(buffer, '/');
if (i == path.getLength())
@@ -6185,7 +6185,7 @@ namespace osl_Directory
{
char* drv = get_unused_drive_letter();
char buff[PATH_BUFFER_SIZE];
- rtl_zeroMemory(buff, sizeof(buff));
+ memset(buff, 0, sizeof(buff));
strncpy(buff, drv, 1);
strcat(buff, ":\\");
diff --git a/sal/rtl/source/byteseq.cxx b/sal/rtl/source/byteseq.cxx
index 76423f78f1f9..432483c1e3f5 100644
--- a/sal/rtl/source/byteseq.cxx
+++ b/sal/rtl/source/byteseq.cxx
@@ -26,6 +26,8 @@
*
************************************************************************/
+#include <string.h>
+
#include <osl/diagnose.h>
#include <osl/interlck.h>
@@ -61,7 +63,7 @@ void SAL_CALL rtl_byte_sequence_reference2One(
pNew = (sal_Sequence *)rtl_allocateMemory( SAL_SEQUENCE_HEADER_SIZE + nElements );
if ( pNew != 0 )
- rtl_copyMemory( pNew->elements, pSequence->elements, nElements );
+ memcpy( pNew->elements, pSequence->elements, nElements );
if (! osl_decrementInterlockedCount( &pSequence->nRefCount ))
rtl_freeMemory( pSequence );
@@ -103,12 +105,12 @@ void SAL_CALL rtl_byte_sequence_realloc(
{
if (nSize > nElements)
{
- rtl_copyMemory( pNew->elements, pSequence->elements, nElements );
- rtl_zeroMemory( pNew->elements + nElements, nSize - nElements );
+ memcpy( pNew->elements, pSequence->elements, nElements );
+ memset( pNew->elements + nElements, 0, nSize - nElements );
}
else
{
- rtl_copyMemory( pNew->elements, pSequence->elements, nSize );
+ memcpy( pNew->elements, pSequence->elements, nSize );
}
}
@@ -207,7 +209,7 @@ void SAL_CALL rtl_byte_sequence_constructFromArray(
{
rtl_byte_sequence_constructNoDefault( ppSequence , nLength );
if ( *ppSequence != 0 )
- rtl_copyMemory( (*ppSequence)->elements, pData, nLength );
+ memcpy( (*ppSequence)->elements, pData, nLength );
}
//==================================================================================================
diff --git a/sal/rtl/source/cipher.cxx b/sal/rtl/source/cipher.cxx
index 7a57ac0e9d4a..29408b362191 100644
--- a/sal/rtl/source/cipher.cxx
+++ b/sal/rtl/source/cipher.cxx
@@ -26,6 +26,8 @@
*
************************************************************************/
+#include <string.h>
+
#include <sal/types.h>
#include <rtl/alloc.h>
#include <rtl/memory.h>
@@ -668,8 +670,8 @@ static rtlCipherError __rtl_cipherBF_init (
key = &(ctx->m_key);
- rtl_copyMemory (key, &__rtl_cipherBF_key, sizeof (CipherKeyBF));
- rtl_zeroMemory (&(ctx->m_iv), sizeof(ctx->m_iv));
+ memcpy (key, &__rtl_cipherBF_key, sizeof (CipherKeyBF));
+ memset (&(ctx->m_iv), 0, sizeof(ctx->m_iv));
ctx->m_offset = 0;
for (i = 0, k = 0; i < CIPHER_ROUNDS_BF + 2; ++i)
@@ -710,7 +712,7 @@ static rtlCipherError __rtl_cipherBF_init (
nArgLen = ((nArgLen < 8) ? nArgLen : 8);
if (eMode == rtl_Cipher_ModeStream)
{
- rtl_copyMemory (ctx->m_iv.m_byte, pArgData, nArgLen);
+ memcpy (ctx->m_iv.m_byte, pArgData, nArgLen);
}
else
{
diff --git a/sal/rtl/source/digest.cxx b/sal/rtl/source/digest.cxx
index feec3b4b832f..58a179b13c2f 100644
--- a/sal/rtl/source/digest.cxx
+++ b/sal/rtl/source/digest.cxx
@@ -26,6 +26,8 @@
*
************************************************************************/
+#include <string.h>
+
#include <sal/types.h>
#include <sal/macros.h>
#include <osl/endian.h>
@@ -298,7 +300,7 @@ static const Digest_Impl __rtl_digest_MD2 =
*/
static void __rtl_digest_initMD2 (DigestContextMD2 *ctx)
{
- rtl_zeroMemory (ctx, sizeof (DigestContextMD2));
+ memset (ctx, 0, sizeof (DigestContextMD2));
}
/*
@@ -342,8 +344,8 @@ static void __rtl_digest_updateMD2 (DigestContextMD2 *ctx)
t = ((t + i) & 0xff);
}
- rtl_copyMemory (sp1, state, 16 * sizeof(sal_uInt32));
- rtl_zeroMemory (state, 48 * sizeof(sal_uInt32));
+ memcpy (sp1, state, 16 * sizeof(sal_uInt32));
+ memset (state, 0, 48 * sizeof(sal_uInt32));
}
/*
@@ -390,7 +392,7 @@ rtlDigestError SAL_CALL rtl_digest_MD2 (
if (result == rtl_Digest_E_None)
result = rtl_digest_getMD2 (&digest, pBuffer, nBufLen);
- rtl_zeroMemory (&digest, sizeof (digest));
+ memset (&digest, 0, sizeof (digest));
return (result);
}
@@ -439,13 +441,13 @@ rtlDigestError SAL_CALL rtl_digest_updateMD2 (
if (nDatLen < n)
{
- rtl_copyMemory (p, d, nDatLen);
+ memcpy (p, d, nDatLen);
ctx->m_nDatLen += nDatLen;
return rtl_Digest_E_None;
}
- rtl_copyMemory (p, d, n);
+ memcpy (p, d, n);
d += n;
nDatLen -= n;
@@ -455,14 +457,14 @@ rtlDigestError SAL_CALL rtl_digest_updateMD2 (
while (nDatLen >= DIGEST_CBLOCK_MD2)
{
- rtl_copyMemory (ctx->m_pData, d, DIGEST_CBLOCK_MD2);
+ memcpy (ctx->m_pData, d, DIGEST_CBLOCK_MD2);
d += DIGEST_CBLOCK_MD2;
nDatLen -= DIGEST_CBLOCK_MD2;
__rtl_digest_updateMD2 (ctx);
}
- rtl_copyMemory (ctx->m_pData, d, nDatLen);
+ memcpy (ctx->m_pData, d, nDatLen);
ctx->m_nDatLen = nDatLen;
return rtl_Digest_E_None;
@@ -584,7 +586,7 @@ static const Digest_Impl __rtl_digest_MD5 =
*/
static void __rtl_digest_initMD5 (DigestContextMD5 *ctx)
{
- rtl_zeroMemory (ctx, sizeof (DigestContextMD5));
+ memset (ctx, 0, sizeof (DigestContextMD5));
ctx->m_nA = (sal_uInt32)0x67452301L;
ctx->m_nB = (sal_uInt32)0xefcdab89L;
@@ -757,7 +759,7 @@ rtlDigestError SAL_CALL rtl_digest_MD5 (
if (result == rtl_Digest_E_None)
result = rtl_digest_getMD5 (&digest, pBuffer, nBufLen);
- rtl_zeroMemory (&digest, sizeof (digest));
+ memset (&digest, 0, sizeof (digest));
return (result);
}
@@ -812,13 +814,13 @@ rtlDigestError SAL_CALL rtl_digest_updateMD5 (
if (nDatLen < n)
{
- rtl_copyMemory (p, d, nDatLen);
+ memcpy (p, d, nDatLen);
ctx->m_nDatLen += nDatLen;
return rtl_Digest_E_None;
}
- rtl_copyMemory (p, d, n);
+ memcpy (p, d, n);
d += n;
nDatLen -= n;
@@ -832,7 +834,7 @@ rtlDigestError SAL_CALL rtl_digest_updateMD5 (
while (nDatLen >= DIGEST_CBLOCK_MD5)
{
- rtl_copyMemory (ctx->m_pData, d, DIGEST_CBLOCK_MD5);
+ memcpy (ctx->m_pData, d, DIGEST_CBLOCK_MD5);
d += DIGEST_CBLOCK_MD5;
nDatLen -= DIGEST_CBLOCK_MD5;
@@ -843,7 +845,7 @@ rtlDigestError SAL_CALL rtl_digest_updateMD5 (
__rtl_digest_updateMD5 (ctx);
}
- rtl_copyMemory (ctx->m_pData, d, nDatLen);
+ memcpy (ctx->m_pData, d, nDatLen);
ctx->m_nDatLen = nDatLen;
return rtl_Digest_E_None;
@@ -1012,7 +1014,7 @@ static void __rtl_digest_endSHA (DigestContextSHA *ctx);
static void __rtl_digest_initSHA (
DigestContextSHA *ctx, DigestSHA_update_t *fct)
{
- rtl_zeroMemory (ctx, sizeof (DigestContextSHA));
+ memset (ctx, 0, sizeof (DigestContextSHA));
ctx->m_update = fct;
ctx->m_nA = (sal_uInt32)0x67452301L;
@@ -1237,7 +1239,7 @@ rtlDigestError SAL_CALL rtl_digest_SHA (
if (result == rtl_Digest_E_None)
result = rtl_digest_getSHA (&digest, pBuffer, nBufLen);
- rtl_zeroMemory (&digest, sizeof (digest));
+ memset (&digest, 0, sizeof (digest));
return (result);
}
@@ -1292,13 +1294,13 @@ rtlDigestError SAL_CALL rtl_digest_updateSHA (
if (nDatLen < n)
{
- rtl_copyMemory (p, d, nDatLen);
+ memcpy (p, d, nDatLen);
ctx->m_nDatLen += nDatLen;
return rtl_Digest_E_None;
}
- rtl_copyMemory (p, d, n);
+ memcpy (p, d, n);
d += n;
nDatLen -= n;
@@ -1312,7 +1314,7 @@ rtlDigestError SAL_CALL rtl_digest_updateSHA (
while (nDatLen >= DIGEST_CBLOCK_SHA)
{
- rtl_copyMemory (ctx->m_pData, d, DIGEST_CBLOCK_SHA);
+ memcpy (ctx->m_pData, d, DIGEST_CBLOCK_SHA);
d += DIGEST_CBLOCK_SHA;
nDatLen -= DIGEST_CBLOCK_SHA;
@@ -1323,7 +1325,7 @@ rtlDigestError SAL_CALL rtl_digest_updateSHA (
__rtl_digest_updateSHA (ctx);
}
- rtl_copyMemory (ctx->m_pData, d, nDatLen);
+ memcpy (ctx->m_pData, d, nDatLen);
ctx->m_nDatLen = nDatLen;
return rtl_Digest_E_None;
@@ -1427,7 +1429,7 @@ rtlDigestError SAL_CALL rtl_digest_SHA1 (
if (result == rtl_Digest_E_None)
result = rtl_digest_getSHA1 (&digest, pBuffer, nBufLen);
- rtl_zeroMemory (&digest, sizeof (digest));
+ memset (&digest, 0, sizeof (digest));
return (result);
}
@@ -1482,13 +1484,13 @@ rtlDigestError SAL_CALL rtl_digest_updateSHA1 (
if (nDatLen < n)
{
- rtl_copyMemory (p, d, nDatLen);
+ memcpy (p, d, nDatLen);
ctx->m_nDatLen += nDatLen;
return rtl_Digest_E_None;
}
- rtl_copyMemory (p, d, n);
+ memcpy (p, d, n);
d += n;
nDatLen -= n;
@@ -1502,7 +1504,7 @@ rtlDigestError SAL_CALL rtl_digest_updateSHA1 (
while (nDatLen >= DIGEST_CBLOCK_SHA)
{
- rtl_copyMemory (ctx->m_pData, d, DIGEST_CBLOCK_SHA);
+ memcpy (ctx->m_pData, d, DIGEST_CBLOCK_SHA);
d += DIGEST_CBLOCK_SHA;
nDatLen -= DIGEST_CBLOCK_SHA;
@@ -1513,7 +1515,7 @@ rtlDigestError SAL_CALL rtl_digest_updateSHA1 (
__rtl_digest_updateSHA (ctx);
}
- rtl_copyMemory (ctx->m_pData, d, nDatLen);
+ memcpy (ctx->m_pData, d, nDatLen);
ctx->m_nDatLen = nDatLen;
return rtl_Digest_E_None;
@@ -1615,7 +1617,7 @@ static void __rtl_digest_initHMAC_MD5 (ContextHMAC_MD5 * ctx)
pImpl->m_digest = __rtl_digest_MD5;
__rtl_digest_initMD5 (&(pImpl->m_context));
- rtl_zeroMemory (ctx->m_opad, DIGEST_CBLOCK_HMAC_MD5);
+ memset (ctx->m_opad, 0, DIGEST_CBLOCK_HMAC_MD5);
}
/*
@@ -1670,7 +1672,7 @@ rtlDigestError SAL_CALL rtl_digest_HMAC_MD5 (
result = rtl_digest_getHMAC_MD5 (&digest, pBuffer, nBufLen);
}
- rtl_zeroMemory (&digest, sizeof (digest));
+ memset (&digest, 0, sizeof (digest));
return (result);
}
@@ -1719,7 +1721,7 @@ rtlDigestError SAL_CALL rtl_digest_initHMAC_MD5 (
else
{
/* Initialize 'opad' with plain 'KeyData' */
- rtl_copyMemory (ctx->m_opad, pKeyData, nKeyLen);
+ memcpy (ctx->m_opad, pKeyData, nKeyLen);
}
__rtl_digest_ipadHMAC_MD5 (ctx);
@@ -1847,7 +1849,7 @@ static void __rtl_digest_initHMAC_SHA1 (ContextHMAC_SHA1 * ctx)
pImpl->m_digest = __rtl_digest_SHA_1;
__rtl_digest_initSHA (&(pImpl->m_context), __rtl_digest_updateSHA_1);
- rtl_zeroMemory (ctx->m_opad, DIGEST_CBLOCK_HMAC_SHA1);
+ memset (ctx->m_opad, 0, DIGEST_CBLOCK_HMAC_SHA1);
}
/*
@@ -1902,7 +1904,7 @@ rtlDigestError SAL_CALL rtl_digest_HMAC_SHA1 (
result = rtl_digest_getHMAC_SHA1 (&digest, pBuffer, nBufLen);
}
- rtl_zeroMemory (&digest, sizeof (digest));
+ memset (&digest, 0, sizeof (digest));
return (result);
}
@@ -1951,7 +1953,7 @@ rtlDigestError SAL_CALL rtl_digest_initHMAC_SHA1 (
else
{
/* Initialize 'opad' with plain 'KeyData' */
- rtl_copyMemory (ctx->m_opad, pKeyData, nKeyLen);
+ memcpy (ctx->m_opad, pKeyData, nKeyLen);
}
__rtl_digest_ipadHMAC_SHA1 (ctx);
@@ -2072,7 +2074,7 @@ static void __rtl_digest_updatePBKDF2 (
for (k = 0; k < DIGEST_CBLOCK_PBKDF2; k++) T[k] ^= U[k];
}
- rtl_zeroMemory (U, DIGEST_CBLOCK_PBKDF2);
+ memset (U, 0, DIGEST_CBLOCK_PBKDF2);
}
/*========================================================================
@@ -2124,11 +2126,11 @@ rtlDigestError SAL_CALL rtl_digest_PBKDF2 (
nCount, OSL_NETDWORD(i));
/* DK ||= T_(i) */
- rtl_copyMemory (pKeyData, T, nKeyLen);
- rtl_zeroMemory (T, DIGEST_CBLOCK_PBKDF2);
+ memcpy (pKeyData, T, nKeyLen);
+ memset (T, 0, DIGEST_CBLOCK_PBKDF2);
}
- rtl_zeroMemory (&digest, sizeof (digest));
+ memset (&digest, 0, sizeof (digest));
return rtl_Digest_E_None;
}
diff --git a/sal/rtl/source/strbuf.cxx b/sal/rtl/source/strbuf.cxx
index d4a5a75ba929..953e6302ccc3 100644
--- a/sal/rtl/source/strbuf.cxx
+++ b/sal/rtl/source/strbuf.cxx
@@ -26,6 +26,8 @@
*
************************************************************************/
+#include <string.h>
+
#include <osl/interlck.h>
#include <rtl/strbuf.hxx>
#include <rtl/memory.h>
@@ -45,7 +47,7 @@ void SAL_CALL rtl_stringbuffer_newFromStr_WithLength( rtl_String ** newStr,
rtl_string_new_WithLength( newStr, count + 16 );
(*newStr)->length = count;
- rtl_copyMemory( (*newStr)->buffer, value, count );
+ memcpy( (*newStr)->buffer, value, count );
return;
}
@@ -64,7 +66,7 @@ sal_Int32 SAL_CALL rtl_stringbuffer_newFromStringBuffer( rtl_String ** newStr,
rtl_string_new_WithLength( newStr, newCapacity );
if (oldStr->length > 0) {
(*newStr)->length = oldStr->length;
- rtl_copyMemory( (*newStr)->buffer, oldStr->buffer, oldStr->length );
+ memcpy( (*newStr)->buffer, oldStr->buffer, oldStr->length );
}
return newCapacity;
}
@@ -88,7 +90,7 @@ void SAL_CALL rtl_stringbuffer_ensureCapacity
pNew->length = (*This)->length;
*This = pNew;
- rtl_copyMemory( (*This)->buffer, pTmp->buffer, pTmp->length );
+ memcpy( (*This)->buffer, pTmp->buffer, pTmp->length );
rtl_string_release( pTmp );
}
}
@@ -131,7 +133,7 @@ void SAL_CALL rtl_stringbuffer_insert( rtl_String ** This,
/* optimized for 1 character */
pBuf[offset] = *str;
else if( n > 1 )
- rtl_copyMemory( pBuf + offset, str, len * sizeof(sal_Char) );
+ memcpy( pBuf + offset, str, len * sizeof(sal_Char) );
(*This)->length = nOldLen + len;
pBuf[ nOldLen + len ] = 0;
}
diff --git a/sal/rtl/source/string.cxx b/sal/rtl/source/string.cxx
index 42c8ae2a3fdc..78874b668b38 100644
--- a/sal/rtl/source/string.cxx
+++ b/sal/rtl/source/string.cxx
@@ -93,7 +93,7 @@ sal_Int32 SAL_CALL rtl_str_valueOfFloat(sal_Char * pStr, float f)
sal_True);
nLen = pResult->length;
OSL_ASSERT(nLen < RTL_STR_MAX_VALUEOFFLOAT);
- rtl_copyMemory(pStr, pResult->buffer, (nLen + 1) * sizeof(sal_Char));
+ memcpy(pStr, pResult->buffer, (nLen + 1) * sizeof(sal_Char));
rtl_string_release(pResult);
return nLen;
}
@@ -109,7 +109,7 @@ sal_Int32 SAL_CALL rtl_str_valueOfDouble(sal_Char * pStr, double d)
0, sal_True);
nLen = pResult->length;
OSL_ASSERT(nLen < RTL_STR_MAX_VALUEOFDOUBLE);
- rtl_copyMemory(pStr, pResult->buffer, (nLen + 1) * sizeof(sal_Char));
+ memcpy(pStr, pResult->buffer, (nLen + 1) * sizeof(sal_Char));
rtl_string_release(pResult);
return nLen;
}
@@ -362,9 +362,9 @@ void rtl_string_newReplaceFirst(
if (n != 0) {
(*newStr)->length = n;
assert(i >= 0 && i < str->length);
- rtl_copyMemory((*newStr)->buffer, str->buffer, i);
- rtl_copyMemory((*newStr)->buffer + i, to, toLength);
- rtl_copyMemory(
+ memcpy((*newStr)->buffer, str->buffer, i);
+ memcpy((*newStr)->buffer + i, to, toLength);
+ memcpy(
(*newStr)->buffer + i + toLength, str->buffer + i + fromLength,
str->length - i - fromLength);
}
diff --git a/sal/rtl/source/unload.cxx b/sal/rtl/source/unload.cxx
index 9d30bb303c26..5e9cdf1e0482 100644
--- a/sal/rtl/source/unload.cxx
+++ b/sal/rtl/source/unload.cxx
@@ -26,6 +26,8 @@
*
************************************************************************/
+#include <string.h>
+
#include <rtl/unload.h>
#include <rtl/alloc.h>
#include <rtl/ustring.hxx>
@@ -203,7 +205,7 @@ extern "C" sal_Bool rtl_moduleCount_canUnload( rtl_StandardModuleCount * that, T
MutexGuard guard( getUnloadingMutex());
if (libUnused && (that->counter == 0))
{
- rtl_copyMemory(libUnused, &that->unusedSince, sizeof(TimeValue));
+ memcpy(libUnused, &that->unusedSince, sizeof(TimeValue));
}
}
return (that->counter == 0);
diff --git a/sal/rtl/source/ustrbuf.cxx b/sal/rtl/source/ustrbuf.cxx
index 72cf4c47c041..23b6cb8f4e62 100644
--- a/sal/rtl/source/ustrbuf.cxx
+++ b/sal/rtl/source/ustrbuf.cxx
@@ -26,6 +26,8 @@
*
************************************************************************/
+#include <string.h>
+
#include <osl/interlck.h>
#include <rtl/ustrbuf.hxx>
@@ -44,7 +46,7 @@ void SAL_CALL rtl_uStringbuffer_newFromStr_WithLength( rtl_uString ** newStr,
rtl_uString_new_WithLength( newStr, count + 16 );
(*newStr)->length = count;
- rtl_copyMemory( (*newStr)->buffer, value, count * sizeof(sal_Unicode));
+ memcpy( (*newStr)->buffer, value, count * sizeof(sal_Unicode));
RTL_LOG_STRING_NEW( *newStr );
return;
}
@@ -84,7 +86,7 @@ sal_Int32 SAL_CALL rtl_uStringbuffer_newFromStringBuffer( rtl_uString ** newStr,
if (oldStr->length > 0) {
(*newStr)->length = oldStr->length;
- rtl_copyMemory( (*newStr)->buffer, oldStr->buffer, oldStr->length * sizeof(sal_Unicode));
+ memcpy( (*newStr)->buffer, oldStr->buffer, oldStr->length * sizeof(sal_Unicode));
}
RTL_LOG_STRING_NEW( *newStr );
return newCapacity;
@@ -106,7 +108,7 @@ void SAL_CALL rtl_uStringbuffer_ensureCapacity
pNew->length = (*This)->length;
*This = pNew;
- rtl_copyMemory( (*This)->buffer, pTmp->buffer, pTmp->length * sizeof(sal_Unicode) );
+ memcpy( (*This)->buffer, pTmp->buffer, pTmp->length * sizeof(sal_Unicode) );
RTL_LOG_STRING_NEW( pTmp ); // with accurate contents
rtl_uString_release( pTmp );
@@ -147,7 +149,7 @@ void SAL_CALL rtl_uStringbuffer_insert( rtl_uString ** This,
/* optimized for 1 character */
pBuf[offset] = *str;
else if( len > 1 )
- rtl_copyMemory( pBuf + offset, str, len * sizeof(sal_Unicode) );
+ memcpy( pBuf + offset, str, len * sizeof(sal_Unicode) );
(*This)->length = nOldLen + len;
pBuf[ nOldLen + len ] = 0;
}
diff --git a/sal/rtl/source/ustring.cxx b/sal/rtl/source/ustring.cxx
index 2909432345a2..23ec82b28f68 100644
--- a/sal/rtl/source/ustring.cxx
+++ b/sal/rtl/source/ustring.cxx
@@ -130,7 +130,7 @@ sal_Int32 SAL_CALL rtl_ustr_valueOfFloat(sal_Unicode * pStr, float f)
0, sal_True);
nLen = pResult->length;
OSL_ASSERT(nLen < RTL_USTR_MAX_VALUEOFFLOAT);
- rtl_copyMemory(pStr, pResult->buffer, (nLen + 1) * sizeof(sal_Unicode));
+ memcpy(pStr, pResult->buffer, (nLen + 1) * sizeof(sal_Unicode));
rtl_uString_release(pResult);
return nLen;
}
@@ -146,7 +146,7 @@ sal_Int32 SAL_CALL rtl_ustr_valueOfDouble(sal_Unicode * pStr, double d)
0, sal_True);
nLen = pResult->length;
OSL_ASSERT(nLen < RTL_USTR_MAX_VALUEOFDOUBLE);
- rtl_copyMemory(pStr, pResult->buffer, (nLen + 1) * sizeof(sal_Unicode));
+ memcpy(pStr, pResult->buffer, (nLen + 1) * sizeof(sal_Unicode));
rtl_uString_release(pResult);
return nLen;
}
@@ -1055,12 +1055,12 @@ void rtl_uString_newReplaceFirst(
if (n != 0) {
(*newStr)->length = n;
assert(i >= 0 && i < str->length);
- rtl_copyMemory(
+ memcpy(
(*newStr)->buffer, str->buffer, i * sizeof (sal_Unicode));
- rtl_copyMemory(
+ memcpy(
(*newStr)->buffer + i, to->buffer,
to->length * sizeof (sal_Unicode));
- rtl_copyMemory(
+ memcpy(
(*newStr)->buffer + i + to->length,
str->buffer + i + from->length,
(str->length - i - from->length) * sizeof (sal_Unicode));
@@ -1097,12 +1097,12 @@ void rtl_uString_newReplaceFirstAsciiL(
rtl_uString_new_WithLength(newStr, n);
(*newStr)->length = n;
assert(i >= 0 && i < str->length);
- rtl_copyMemory(
+ memcpy(
(*newStr)->buffer, str->buffer, i * sizeof (sal_Unicode));
- rtl_copyMemory(
+ memcpy(
(*newStr)->buffer + i, to->buffer,
to->length * sizeof (sal_Unicode));
- rtl_copyMemory(
+ memcpy(
(*newStr)->buffer + i + to->length,
str->buffer + i + fromLength,
(str->length - i - fromLength) * sizeof (sal_Unicode));
@@ -1140,13 +1140,13 @@ void rtl_uString_newReplaceFirstAsciiLAsciiL(
rtl_uString_new_WithLength(newStr, n);
(*newStr)->length = n;
assert(i >= 0 && i < str->length);
- rtl_copyMemory(
+ memcpy(
(*newStr)->buffer, str->buffer, i * sizeof (sal_Unicode));
for (sal_Int32 j = 0; j != toLength; ++j) {
assert(static_cast< unsigned char >(to[j]) <= 0x7F);
(*newStr)->buffer[i + j] = to[j];
}
- rtl_copyMemory(
+ memcpy(
(*newStr)->buffer + i + toLength,
str->buffer + i + fromLength,
(str->length - i - fromLength) * sizeof (sal_Unicode));
diff --git a/sal/workben/testfile.cxx b/sal/workben/testfile.cxx
index 22f05b840bae..0c6aff29a5a9 100644
--- a/sal/workben/testfile.cxx
+++ b/sal/workben/testfile.cxx
@@ -191,7 +191,7 @@ sal_Bool Initialize( void )
// read ini-File
rc=pFile->setPos( osl_Pos_Absolut, 0 );
pBuffer=(sal_Char*) rtl_allocateMemory( (sal_uInt32) (uBytesRequested+1)*sizeof(sal_Char) );
- rtl_zeroMemory( pBuffer, (sal_uInt32)(uBytesRequested+1)*sizeof(sal_Char) );
+ memset( pBuffer, 0, (sal_uInt32)(uBytesRequested+1)*sizeof(sal_Char) );
rc=pFile->read( pBuffer , uBytesRequested , uBytesRead );
if ( rc!=FileBase::E_None )
@@ -852,7 +852,7 @@ void FileWriteAndReadTest( void )
//----------------------------------------------------
pReadBuffer=(sal_Char*) rtl_allocateMemory( (sal_uInt32)(nLen+1)*sizeof(sal_Char) );
- rtl_zeroMemory( pReadBuffer, (sal_uInt32)(nLen+1)*sizeof(sal_Char) );
+ memset( pReadBuffer, 0, (sal_uInt32)(nLen+1)*sizeof(sal_Char) );
rc=pFile->read( pReadBuffer , nLen,uRead );
print_error( rtl::OString( "Read File" ), rc );