summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaud Versini <arnaud.versini@gmail.com>2012-07-23 21:17:15 +0200
committerArnaud Versini <arnaud.versini@gmail.com>2012-07-24 20:35:21 +0200
commitb8d562018155d7bb961198dc1f1dfd5e7a0d1d62 (patch)
tree0fae92af345bfbac69a8c9a515b5ddd08e61d219
parent10f08195b8195640016a6eab42818c662f4541d2 (diff)
Use memset and memcmp insteadof rtl_zeroMemory and rtl_compareMemory in cppu
Change-Id: I88976b215bc23ce5001916ccf123bc3561c2a33a
-rw-r--r--cppu/source/typelib/typelib.cxx6
-rw-r--r--cppu/source/uno/constr.hxx4
-rw-r--r--cppu/source/uno/eq.hxx12
-rw-r--r--cppu/source/uno/sequence.cxx21
4 files changed, 26 insertions, 17 deletions
diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx
index 06b0b9fc2703..90f7ba6bffdf 100644
--- a/cppu/source/typelib/typelib.cxx
+++ b/cppu/source/typelib/typelib.cxx
@@ -1735,8 +1735,10 @@ extern "C" CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_register(
pTDR->pType->nSize = (*ppNewDescription)->nSize;
pTDR->pType->nAlignment = (*ppNewDescription)->nAlignment;
- ::rtl_zeroMemory(
- *ppNewDescription +1, nSize - sizeof( typelib_TypeDescription ) );
+ memset(
+ *ppNewDescription +1,
+ 0,
+ nSize - sizeof( typelib_TypeDescription ) );
if( pTDR->pType->bOnDemand && !(*ppNewDescription)->bOnDemand )
{
diff --git a/cppu/source/uno/constr.hxx b/cppu/source/uno/constr.hxx
index 06107cae5004..dd0343a5247f 100644
--- a/cppu/source/uno/constr.hxx
+++ b/cppu/source/uno/constr.hxx
@@ -19,9 +19,9 @@
#ifndef CONSTR_HXX
#define CONSTR_HXX
+#include <string.h>
#include "prim.hxx"
-
namespace cppu
{
@@ -90,7 +90,7 @@ inline void _defaultConstructArray(
case typelib_TypeClass_FLOAT:
case typelib_TypeClass_DOUBLE:
case typelib_TypeClass_INTERFACE:
- ::rtl_zeroMemory(pMem, nElementSize * nTotalElements);
+ memset(pMem, 0, nElementSize * nTotalElements);
break;
case typelib_TypeClass_STRING:
diff --git a/cppu/source/uno/eq.hxx b/cppu/source/uno/eq.hxx
index 396a8dcb6775..a270f6e6f75e 100644
--- a/cppu/source/uno/eq.hxx
+++ b/cppu/source/uno/eq.hxx
@@ -127,7 +127,7 @@ inline sal_Bool _equalSequence(
switch (pElementType->eTypeClass)
{
case typelib_TypeClass_CHAR:
- return (0 == ::rtl_compareMemory( pDestElements, pSourceElements, sizeof(sal_Unicode) * nElements ));
+ return (0 == memcmp( pDestElements, pSourceElements, sizeof(sal_Unicode) * nElements ));
case typelib_TypeClass_BOOLEAN:
{
for ( sal_Int32 nPos = nElements; nPos--; )
@@ -141,16 +141,16 @@ inline sal_Bool _equalSequence(
return sal_True;
}
case typelib_TypeClass_BYTE:
- return (0 == ::rtl_compareMemory( pDestElements, pSourceElements, sizeof(sal_Int8) * nElements ));
+ return (0 == memcmp( pDestElements, pSourceElements, sizeof(sal_Int8) * nElements ));
case typelib_TypeClass_SHORT:
case typelib_TypeClass_UNSIGNED_SHORT:
- return (0 == ::rtl_compareMemory( pDestElements, pSourceElements, sizeof(sal_Int16) * nElements ));
+ return (0 == memcmp( pDestElements, pSourceElements, sizeof(sal_Int16) * nElements ));
case typelib_TypeClass_LONG:
case typelib_TypeClass_UNSIGNED_LONG:
- return (0 == ::rtl_compareMemory( pDestElements, pSourceElements, sizeof(sal_Int32) * nElements ));
+ return (0 == memcmp( pDestElements, pSourceElements, sizeof(sal_Int32) * nElements ));
case typelib_TypeClass_HYPER:
case typelib_TypeClass_UNSIGNED_HYPER:
- return (0 == ::rtl_compareMemory( pDestElements, pSourceElements, sizeof(sal_Int64) * nElements ));
+ return (0 == memcmp( pDestElements, pSourceElements, sizeof(sal_Int64) * nElements ));
case typelib_TypeClass_FLOAT:
{
for ( sal_Int32 nPos = nElements; nPos--; )
@@ -206,7 +206,7 @@ inline sal_Bool _equalSequence(
return sal_True;
}
case typelib_TypeClass_ENUM:
- return (0 == ::rtl_compareMemory( pDestElements, pSourceElements, sizeof(sal_Int32) * nElements ));
+ return (0 == memcmp( pDestElements, pSourceElements, sizeof(sal_Int32) * nElements ));
case typelib_TypeClass_STRUCT:
case typelib_TypeClass_EXCEPTION:
{
diff --git a/cppu/source/uno/sequence.cxx b/cppu/source/uno/sequence.cxx
index a431973e6c46..1397a8932af9 100644
--- a/cppu/source/uno/sequence.cxx
+++ b/cppu/source/uno/sequence.cxx
@@ -78,8 +78,9 @@ static inline bool idefaultConstructElements(
pSeq = reallocSeq( pSeq, sizeof(sal_Unicode), nAlloc );
if (pSeq != 0)
{
- ::rtl_zeroMemory(
+ memset(
pSeq->elements + (sizeof(sal_Unicode) * nStartIndex),
+ 0,
sizeof(sal_Unicode) * (nStopIndex - nStartIndex) );
}
break;
@@ -88,8 +89,9 @@ static inline bool idefaultConstructElements(
pSeq = reallocSeq( pSeq, sizeof(sal_Bool), nAlloc );
if (pSeq != 0)
{
- ::rtl_zeroMemory(
+ memset(
pSeq->elements + (sizeof(sal_Bool) * nStartIndex),
+ 0,
sizeof(sal_Bool) * (nStopIndex - nStartIndex) );
}
break;
@@ -98,8 +100,9 @@ static inline bool idefaultConstructElements(
pSeq = reallocSeq( pSeq, sizeof(sal_Int8), nAlloc );
if (pSeq != 0)
{
- ::rtl_zeroMemory(
+ memset(
pSeq->elements + (sizeof(sal_Int8) * nStartIndex),
+ 0,
sizeof(sal_Int8) * (nStopIndex - nStartIndex) );
}
break;
@@ -109,8 +112,9 @@ static inline bool idefaultConstructElements(
pSeq = reallocSeq( pSeq, sizeof(sal_Int16), nAlloc );
if (pSeq != 0)
{
- ::rtl_zeroMemory(
+ memset(
pSeq->elements + (sizeof(sal_Int16) * nStartIndex),
+ 0,
sizeof(sal_Int16) * (nStopIndex - nStartIndex) );
}
break;
@@ -120,8 +124,9 @@ static inline bool idefaultConstructElements(
pSeq = reallocSeq( pSeq, sizeof(sal_Int32), nAlloc );
if (pSeq != 0)
{
- ::rtl_zeroMemory(
+ memset(
pSeq->elements + (sizeof(sal_Int32) * nStartIndex),
+ 0,
sizeof(sal_Int32) * (nStopIndex - nStartIndex) );
}
break;
@@ -131,8 +136,9 @@ static inline bool idefaultConstructElements(
pSeq = reallocSeq( pSeq, sizeof(sal_Int64), nAlloc );
if (pSeq != 0)
{
- ::rtl_zeroMemory(
+ memset(
pSeq->elements + (sizeof(sal_Int64) * nStartIndex),
+ 0,
sizeof(sal_Int64) * (nStopIndex - nStartIndex) );
}
break;
@@ -334,8 +340,9 @@ static inline bool idefaultConstructElements(
pSeq = reallocSeq( pSeq, sizeof(void *), nAlloc );
if (pSeq != 0)
{
- ::rtl_zeroMemory(
+ memset(
pSeq->elements + (sizeof(void *) * nStartIndex),
+ 0,
sizeof(void *) * (nStopIndex - nStartIndex) );
}
break;