Kaydet (Commit) 37f9fdc1 authored tarafından Noel Grandin's avatar Noel Grandin

replace rtl_allocateMemory with std::malloc

where used directly, since rtl_allocateMemory now just calls into std::malloc

Change-Id: I59f85bdb7efdf6baa30e8fcd2370c0f8e9c999ad
Reviewed-on: https://gerrit.libreoffice.org/59685
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 4c91b89d
......@@ -55,7 +55,7 @@ namespace binaryurp {
namespace {
void * allocate(sal_Size size) {
void * p = rtl_allocateMemory(size);
void * p = std::malloc(size);
if (p == nullptr) {
throw std::bad_alloc();
}
......
......@@ -132,7 +132,7 @@ type_info * RTTInfos::getRTTI( OUString const & rUNOname ) throw ()
{
// insert new type_info
OString aRawName( OUStringToOString( toRTTIname( rUNOname ), RTL_TEXTENCODING_ASCII_US ) );
__type_info * pRTTI = new( ::rtl_allocateMemory( sizeof(__type_info) + aRawName.getLength() ) )
__type_info * pRTTI = new( std::malloc( sizeof(__type_info) + aRawName.getLength() ) )
__type_info( NULL, aRawName.getStr() );
// put into map
......@@ -162,7 +162,7 @@ RTTInfos::~RTTInfos() throw ()
{
__type_info * pType = reinterpret_cast<__type_info*>(iPos->second);
pType->~__type_info(); // obsolete, but good style...
::rtl_freeMemory( pType );
std::free( pType );
}
}
......@@ -184,7 +184,7 @@ struct ObjectFunction
inline void * ObjectFunction::operator new ( size_t nSize )
{
void * pMem = rtl_allocateMemory( nSize );
void * pMem = std::malloc( nSize );
if (pMem != 0)
{
DWORD old_protect;
......@@ -198,7 +198,7 @@ inline void * ObjectFunction::operator new ( size_t nSize )
inline void ObjectFunction::operator delete ( void * pMem )
{
rtl_freeMemory( pMem );
std::free( pMem );
}
......@@ -329,7 +329,7 @@ RaiseInfo::RaiseInfo( typelib_TypeDescription * pTypeDescr ) throw ()
}
// info count accompanied by type info ptrs: type, base type, base base type, ...
_types = ::rtl_allocateMemory( sizeof(sal_Int32) + (sizeof(ExceptionType *) * nLen) );
_types = std::malloc( sizeof(sal_Int32) + (sizeof(ExceptionType *) * nLen) );
*(sal_Int32 *)_types = nLen;
ExceptionType ** ppTypes = (ExceptionType **)((sal_Int32 *)_types + 1);
......@@ -349,7 +349,7 @@ RaiseInfo::~RaiseInfo() throw ()
{
delete ppTypes[nTypes];
}
::rtl_freeMemory( _types );
std::free( _types );
delete _pDtor;
}
......
......@@ -371,7 +371,7 @@ type_info_descriptor * RTTInfos::insert_new_type_info_descriptor(OUString const
// insert new type_info
OString aRawName(OUStringToOString(toRTTIname(rUNOname), RTL_TEXTENCODING_ASCII_US));
type_info_descriptor * pRTTI = new(::rtl_allocateMemory(sizeof(type_info_descriptor) + aRawName.getLength()))
type_info_descriptor * pRTTI = new(std::malloc(sizeof(type_info_descriptor) + aRawName.getLength()))
type_info_descriptor(nullptr, aRawName.getStr());
// put into map
......@@ -621,7 +621,7 @@ RaiseInfo::RaiseInfo(typelib_TypeDescription * pTD)throw ()
// 32 bit offsets
const int totalSize = codeSize + typeInfoArraySize + excTypeAddLen;
unsigned char * pCode = _code =
static_cast<unsigned char *>(::rtl_allocateMemory(totalSize));
static_cast<unsigned char *>(std::malloc(totalSize));
int pCodeOffset = 0;
// New base of types array, starts after Trampoline D-Tor / C-Tors
......
......@@ -205,9 +205,9 @@ inline JLocalAutoRef & JLocalAutoRef::operator = ( JLocalAutoRef & auto_ref )
struct rtl_mem
{
static void * operator new ( size_t nSize )
{ return rtl_allocateMemory( nSize ); }
{ return std::malloc( nSize ); }
static void operator delete ( void * mem )
{ if (mem) rtl_freeMemory( mem ); }
{ std::free( mem ); }
static void * operator new ( size_t, void * mem )
{ return mem; }
static void operator delete ( void *, void * )
......@@ -218,7 +218,7 @@ struct rtl_mem
inline rtl_mem * rtl_mem::allocate( std::size_t bytes )
{
void * p = rtl_allocateMemory( bytes );
void * p = std::malloc( bytes );
if (nullptr == p)
throw BridgeRuntimeError( "out of memory!" );
return static_cast<rtl_mem *>(p);
......
......@@ -116,9 +116,9 @@ struct BridgeRuntimeError
struct rtl_mem
{
inline static void * operator new ( size_t nSize )
{ return rtl_allocateMemory( nSize ); }
{ return std::malloc( nSize ); }
inline static void operator delete ( void * mem )
{ if (mem) rtl_freeMemory( mem ); }
{ std::free( mem ); }
inline static void * operator new ( size_t, void * mem )
{ return mem; }
inline static void operator delete ( void *, void * )
......@@ -129,7 +129,7 @@ struct rtl_mem
inline std::unique_ptr< rtl_mem > rtl_mem::allocate( std::size_t bytes )
{
void * p = rtl_allocateMemory( bytes );
void * p = std::malloc( bytes );
if (0 == p)
throw BridgeRuntimeError("out of memory!" );
return std::unique_ptr< rtl_mem >( (rtl_mem *)p );
......
......@@ -38,7 +38,7 @@ inline uno_Sequence * allocSeq(
sal_uInt32 nSize = calcSeqMemSize( nElementSize, nElements );
if (nSize > 0)
{
pSeq = static_cast<uno_Sequence *>(rtl_allocateMemory( nSize ));
pSeq = static_cast<uno_Sequence *>(std::malloc( nSize ));
if (pSeq != nullptr)
{
// header init
......@@ -137,21 +137,21 @@ inline void _copyConstructAnyFromData(
if (sizeof(void *) >= sizeof(sal_Int64))
pDestAny->pData = &pDestAny->pReserved;
else
pDestAny->pData = ::rtl_allocateMemory( sizeof(sal_Int64) );
pDestAny->pData = std::malloc( sizeof(sal_Int64) );
*static_cast<sal_Int64 *>(pDestAny->pData) = *static_cast<sal_Int64 *>(pSource);
break;
case typelib_TypeClass_FLOAT:
if (sizeof(void *) >= sizeof(float))
pDestAny->pData = &pDestAny->pReserved;
else
pDestAny->pData = ::rtl_allocateMemory( sizeof(float) );
pDestAny->pData = std::malloc( sizeof(float) );
*static_cast<float *>(pDestAny->pData) = *static_cast<float *>(pSource);
break;
case typelib_TypeClass_DOUBLE:
if (sizeof(void *) >= sizeof(double))
pDestAny->pData = &pDestAny->pReserved;
else
pDestAny->pData = ::rtl_allocateMemory( sizeof(double) );
pDestAny->pData = std::malloc( sizeof(double) );
*static_cast<double *>(pDestAny->pData) = *static_cast<double *>(pSource);
break;
case typelib_TypeClass_STRING:
......@@ -176,7 +176,7 @@ inline void _copyConstructAnyFromData(
case typelib_TypeClass_EXCEPTION:
if (pTypeDescr)
{
pDestAny->pData = ::rtl_allocateMemory( pTypeDescr->nSize );
pDestAny->pData = std::malloc( pTypeDescr->nSize );
_copyConstructStruct(
pDestAny->pData, pSource,
reinterpret_cast<typelib_CompoundTypeDescription *>(pTypeDescr),
......@@ -185,7 +185,7 @@ inline void _copyConstructAnyFromData(
else
{
TYPELIB_DANGER_GET( &pTypeDescr, pType );
pDestAny->pData = ::rtl_allocateMemory( pTypeDescr->nSize );
pDestAny->pData = std::malloc( pTypeDescr->nSize );
_copyConstructStruct(
pDestAny->pData, pSource,
reinterpret_cast<typelib_CompoundTypeDescription *>(pTypeDescr),
......@@ -296,21 +296,21 @@ inline void _copyConstructAny(
if (sizeof(void *) >= sizeof(sal_Int64))
pDestAny->pData = &pDestAny->pReserved;
else
pDestAny->pData = ::rtl_allocateMemory( sizeof(sal_Int64) );
pDestAny->pData = std::malloc( sizeof(sal_Int64) );
*static_cast<sal_Int64 *>(pDestAny->pData) = 0;
break;
case typelib_TypeClass_FLOAT:
if (sizeof(void *) >= sizeof(float))
pDestAny->pData = &pDestAny->pReserved;
else
pDestAny->pData = ::rtl_allocateMemory( sizeof(float) );
pDestAny->pData = std::malloc( sizeof(float) );
*static_cast<float *>(pDestAny->pData) = 0.0;
break;
case typelib_TypeClass_DOUBLE:
if (sizeof(void *) >= sizeof(double))
pDestAny->pData = &pDestAny->pReserved;
else
pDestAny->pData = ::rtl_allocateMemory( sizeof(double) );
pDestAny->pData = std::malloc( sizeof(double) );
*static_cast<double *>(pDestAny->pData) = 0.0;
break;
case typelib_TypeClass_STRING:
......@@ -339,14 +339,14 @@ inline void _copyConstructAny(
case typelib_TypeClass_EXCEPTION:
if (pTypeDescr)
{
pDestAny->pData = ::rtl_allocateMemory( pTypeDescr->nSize );
pDestAny->pData = std::malloc( pTypeDescr->nSize );
_defaultConstructStruct(
pDestAny->pData, reinterpret_cast<typelib_CompoundTypeDescription *>(pTypeDescr) );
}
else
{
TYPELIB_DANGER_GET( &pTypeDescr, pType );
pDestAny->pData = ::rtl_allocateMemory( pTypeDescr->nSize );
pDestAny->pData = std::malloc( pTypeDescr->nSize );
_defaultConstructStruct(
pDestAny->pData, reinterpret_cast<typelib_CompoundTypeDescription *>(pTypeDescr) );
TYPELIB_DANGER_RELEASE( pTypeDescr );
......
......@@ -79,19 +79,19 @@ inline void _destructAny(
case typelib_TypeClass_UNSIGNED_HYPER:
if (sizeof(void *) < sizeof(sal_Int64))
{
::rtl_freeMemory( pAny->pData );
std::free( pAny->pData );
}
break;
case typelib_TypeClass_FLOAT:
if (sizeof(void *) < sizeof(float))
{
::rtl_freeMemory( pAny->pData );
std::free( pAny->pData );
}
break;
case typelib_TypeClass_DOUBLE:
if (sizeof(void *) < sizeof(double))
{
::rtl_freeMemory( pAny->pData );
std::free( pAny->pData );
}
break;
case typelib_TypeClass_STRING:
......@@ -104,7 +104,7 @@ inline void _destructAny(
case typelib_TypeClass_ANY:
OSL_FAIL( "### unexpected nested any!" );
::uno_any_destruct( static_cast<uno_Any *>(pAny->pData), release );
::rtl_freeMemory( pAny->pData );
std::free( pAny->pData );
break;
case typelib_TypeClass_TYPEDEF:
OSL_FAIL( "### unexpected typedef!" );
......@@ -116,7 +116,7 @@ inline void _destructAny(
TYPELIB_DANGER_GET( &pTypeDescr, pType );
_destructStruct( pAny->pData, reinterpret_cast<typelib_CompoundTypeDescription *>(pTypeDescr), release );
TYPELIB_DANGER_RELEASE( pTypeDescr );
::rtl_freeMemory( pAny->pData );
std::free( pAny->pData );
break;
}
case typelib_TypeClass_SEQUENCE:
......@@ -285,7 +285,7 @@ inline void idestroySequence(
TYPELIB_DANGER_RELEASE( pTypeDescr );
}
}
::rtl_freeMemory( pSeq );
std::free( pSeq );
}
inline void idestructSequence(
......
......@@ -51,11 +51,11 @@ static inline uno_Sequence * reallocSeq(
{
if (pReallocate == nullptr)
{
pNew = static_cast<uno_Sequence *>(rtl_allocateMemory( nSize ));
pNew = static_cast<uno_Sequence *>(std::malloc( nSize ));
}
else
{
pNew = static_cast<uno_Sequence *>(rtl_reallocateMemory( pReallocate, nSize ));
pNew = static_cast<uno_Sequence *>(std::realloc( pReallocate, nSize ));
}
if (pNew != nullptr)
{
......@@ -618,7 +618,7 @@ static inline bool ireallocSequence(
pSeq->elements, pElementType,
0, nElements, release );
}
rtl_freeMemory( pSeq );
std::free( pSeq );
}
*ppSequence = pNew;
}
......@@ -818,7 +818,7 @@ sal_Bool SAL_CALL uno_type_sequence_reference2One(
{
// easy destruction of empty sequence:
if (osl_atomic_decrement( &pSequence->nRefCount ) == 0)
rtl_freeMemory( pSequence );
std::free( pSequence );
*ppSequence = pNew;
}
}
......@@ -861,7 +861,7 @@ sal_Bool SAL_CALL uno_sequence_reference2One(
{
// easy destruction of empty sequence:
if (osl_atomic_decrement( &pSequence->nRefCount ) == 0)
rtl_freeMemory( pSequence );
std::free( pSequence );
*ppSequence = pNew;
}
}
......
......@@ -481,7 +481,7 @@ void ComponentContext::disposing()
assert(envs[i]->dispose != nullptr);
(*envs[i]->dispose)(envs[i]);
}
rtl_freeMemory(envs);
std::free(envs);
}
}
......
......@@ -197,26 +197,26 @@ void PCDReader::ReadImage()
nW2=nWidth>>1;
nH2=nHeight>>1;
pL0 =static_cast<sal_uInt8*>(rtl_allocateMemory( nWidth ));
pL1 =static_cast<sal_uInt8*>(rtl_allocateMemory( nWidth ));
pCb =static_cast<sal_uInt8*>(rtl_allocateMemory( nW2+1 ));
pCr =static_cast<sal_uInt8*>(rtl_allocateMemory( nW2+1 ));
pL0N=static_cast<sal_uInt8*>(rtl_allocateMemory( nWidth ));
pL1N=static_cast<sal_uInt8*>(rtl_allocateMemory( nWidth ));
pCbN=static_cast<sal_uInt8*>(rtl_allocateMemory( nW2+1 ));
pCrN=static_cast<sal_uInt8*>(rtl_allocateMemory( nW2+1 ));
pL0 =static_cast<sal_uInt8*>(std::malloc( nWidth ));
pL1 =static_cast<sal_uInt8*>(std::malloc( nWidth ));
pCb =static_cast<sal_uInt8*>(std::malloc( nW2+1 ));
pCr =static_cast<sal_uInt8*>(std::malloc( nW2+1 ));
pL0N=static_cast<sal_uInt8*>(std::malloc( nWidth ));
pL1N=static_cast<sal_uInt8*>(std::malloc( nWidth ));
pCbN=static_cast<sal_uInt8*>(std::malloc( nW2+1 ));
pCrN=static_cast<sal_uInt8*>(std::malloc( nW2+1 ));
if ( pL0 == nullptr || pL1 == nullptr || pCb == nullptr || pCr == nullptr ||
pL0N == nullptr || pL1N == nullptr || pCbN == nullptr || pCrN == nullptr)
{
rtl_freeMemory(static_cast<void*>(pL0) );
rtl_freeMemory(static_cast<void*>(pL1) );
rtl_freeMemory(static_cast<void*>(pCb) );
rtl_freeMemory(static_cast<void*>(pCr) );
rtl_freeMemory(static_cast<void*>(pL0N));
rtl_freeMemory(static_cast<void*>(pL1N));
rtl_freeMemory(static_cast<void*>(pCbN));
rtl_freeMemory(static_cast<void*>(pCrN));
std::free(static_cast<void*>(pL0) );
std::free(static_cast<void*>(pL1) );
std::free(static_cast<void*>(pCb) );
std::free(static_cast<void*>(pCr) );
std::free(static_cast<void*>(pL0N));
std::free(static_cast<void*>(pL1N));
std::free(static_cast<void*>(pCbN));
std::free(static_cast<void*>(pCrN));
bStatus = false;
return;
}
......@@ -340,14 +340,14 @@ void PCDReader::ReadImage()
if ( !bStatus )
break;
}
rtl_freeMemory(static_cast<void*>(pL0) );
rtl_freeMemory(static_cast<void*>(pL1) );
rtl_freeMemory(static_cast<void*>(pCb) );
rtl_freeMemory(static_cast<void*>(pCr) );
rtl_freeMemory(static_cast<void*>(pL0N));
rtl_freeMemory(static_cast<void*>(pL1N));
rtl_freeMemory(static_cast<void*>(pCbN));
rtl_freeMemory(static_cast<void*>(pCrN));
std::free(static_cast<void*>(pL0) );
std::free(static_cast<void*>(pL1) );
std::free(static_cast<void*>(pCb) );
std::free(static_cast<void*>(pCr) );
std::free(static_cast<void*>(pL0N));
std::free(static_cast<void*>(pL1N));
std::free(static_cast<void*>(pCbN));
std::free(static_cast<void*>(pCrN));
}
//================== GraphicImport - the exported Function ================
......
......@@ -374,7 +374,7 @@ static bool parseDuration(const xmlChar* aString, bool& bNegative, sal_Int32& nY
{
bool bTime = false; // in part after T
sal_Int32 nLength = strlen(reinterpret_cast<char const *>(aString))+1;
char *pString = static_cast<char*>(rtl_allocateMemory(nLength));
char *pString = static_cast<char*>(std::malloc(nLength));
char *pString0 = pString;
strncpy(pString, reinterpret_cast<char const *>(aString), nLength);
......@@ -385,7 +385,7 @@ static bool parseDuration(const xmlChar* aString, bool& bNegative, sal_Int32& nY
if (pString[0] != 'P')
{
rtl_freeMemory(pString0);
std::free(pString0);
return false;
}
......@@ -430,7 +430,7 @@ static bool parseDuration(const xmlChar* aString, bool& bNegative, sal_Int32& nY
pToken++;
}
}
rtl_freeMemory(pString0);
std::free(pString0);
return true;
}
......
......@@ -38,7 +38,7 @@ AstStack::~AstStack()
delete m_stack[i];
}
rtl_freeMemory(m_stack);
std::free(m_stack);
}
......@@ -97,7 +97,7 @@ AstStack* AstStack::push(AstScope* pScope)
for(i=0; i < m_size; i++)
tmp[i] = m_stack[i];
rtl_freeMemory(m_stack);
std::free(m_stack);
m_stack = tmp;
}
......
......@@ -344,11 +344,11 @@ sal_Int32 compileFile(const OString * pathname)
pathname == nullptr ? "" : "file ", fileName.getStr());
osl_freeProcessHandle(hProcess);
rtl_freeMemory(pCmdArgs);
std::free(pCmdArgs);
exit(hInfo.Code ? hInfo.Code : 99);
}
osl_freeProcessHandle(hProcess);
rtl_freeMemory(pCmdArgs);
std::free(pCmdArgs);
if (unlink(tmpFile.getStr()) != 0)
{
......
......@@ -58,9 +58,7 @@ MemRingBuffer::MemRingBuffer()
MemRingBuffer::~MemRingBuffer()
{
if( m_p ) {
rtl_freeMemory( m_p );
}
std::free( m_p );
}
void MemRingBuffer::resizeBuffer( sal_Int32 nMinSize )
......@@ -77,7 +75,7 @@ void MemRingBuffer::resizeBuffer( sal_Int32 nMinSize )
}
if( nNewLen != m_nBufferLen ) {
m_p = static_cast<sal_Int8 *>(rtl_reallocateMemory( m_p , nNewLen ));
m_p = static_cast<sal_Int8 *>(std::realloc( m_p , nNewLen ));
if( !m_p ) {
throw css::io::BufferSizeExceededException(
"MemRingBuffer::resizeBuffer BufferSizeExceededException");
......
......@@ -53,7 +53,7 @@ inline OUString jstring_to_oustring( jstring jstr, JNIEnv * jni_env )
OSL_ASSERT( sizeof (sal_Unicode) == sizeof (jchar) );
jsize len = jni_env->GetStringLength( jstr );
rtl_uString * ustr =
static_cast<rtl_uString *>(rtl_allocateMemory( sizeof (rtl_uString) + (len * sizeof (sal_Unicode)) ));
static_cast<rtl_uString *>(std::malloc( sizeof (rtl_uString) + (len * sizeof (sal_Unicode)) ));
jni_env->GetStringRegion( jstr, 0, len, reinterpret_cast<jchar *>(ustr->buffer) );
OSL_ASSERT( !jni_env->ExceptionCheck() );
ustr->refCount = 1;
......
This diff is collapsed.
......@@ -1369,14 +1369,14 @@ RegError ORegistry::dumpValue(const OUString& sPath, const OUString& sName, sal_
break;
case RegValueType::STRING:
{
sal_Char* value = static_cast<sal_Char*>(rtl_allocateMemory(valueSize));
sal_Char* value = static_cast<sal_Char*>(std::malloc(valueSize));
readUtf8(aBuffer.data(), value, valueSize);
fprintf(stdout, "%sValue: Type = RegValueType::STRING\n", indent);
fprintf(
stdout, "%s Size = %lu\n", indent,
sal::static_int_cast< unsigned long >(valueSize));
fprintf(stdout, "%s Data = \"%s\"\n", indent, value);
rtl_freeMemory(value);
std::free(value);
}
break;
case RegValueType::UNICODE:
......@@ -1462,7 +1462,7 @@ RegError ORegistry::dumpValue(const OUString& sPath, const OUString& sName, sal_
offset += 4; // 4 bytes (sal_uInt32) for the string size
sal_Char *pValue = static_cast<sal_Char*>(rtl_allocateMemory(sLen));
sal_Char *pValue = static_cast<sal_Char*>(std::malloc(sLen));
readUtf8(aBuffer.data() + offset, pValue, sLen);
if (offset > 8)
......@@ -1471,7 +1471,7 @@ RegError ORegistry::dumpValue(const OUString& sPath, const OUString& sName, sal_
fprintf(
stdout, "%lu = \"%s\"\n",
sal::static_int_cast< unsigned long >(i), pValue);
rtl_freeMemory(pValue);
std::free(pValue);
offset += sLen;
}
}
......@@ -1500,7 +1500,7 @@ RegError ORegistry::dumpValue(const OUString& sPath, const OUString& sName, sal_
offset += 4; // 4 bytes (sal_uInt32) for the string size
sal_Unicode *pValue = static_cast<sal_Unicode*>(rtl_allocateMemory((sLen / 2) * sizeof(sal_Unicode)));
sal_Unicode *pValue = static_cast<sal_Unicode*>(std::malloc((sLen / 2) * sizeof(sal_Unicode)));
readString(aBuffer.data() + offset, pValue, sLen);
if (offset > 8)
......@@ -1514,7 +1514,7 @@ RegError ORegistry::dumpValue(const OUString& sPath, const OUString& sName, sal_
offset += sLen;
rtl_freeMemory(pValue);
std::free(pValue);
}
}
break;
......
......@@ -154,7 +154,7 @@ RegError REGISTRY_CALLTYPE closeSubKeys(RegKeyHandle* phSubKeys,
{
(void) pReg->closeKey(phSubKeys[i]);
}
rtl_freeMemory(phSubKeys);
std::free(phSubKeys);
return RegError::NO_ERROR;
}
......@@ -576,7 +576,7 @@ RegError REGISTRY_CALLTYPE freeValueList(RegValueType valueType,
{
case RegValueType::LONGLIST:
{
rtl_freeMemory(pValueList);
std::free(pValueList);
}
break;
case RegValueType::STRINGLIST:
......@@ -584,10 +584,10 @@ RegError REGISTRY_CALLTYPE freeValueList(RegValueType valueType,
sal_Char** pVList = static_cast<sal_Char**>(pValueList);
for (sal_uInt32 i=0; i < len; i++)
{
rtl_freeMemory(pVList[i]);
std::free(pVList[i]);
}
rtl_freeMemory(pVList);
std::free(pVList);
}
break;
case RegValueType::UNICODELIST:
......@@ -595,10 +595,10 @@ RegError REGISTRY_CALLTYPE freeValueList(RegValueType valueType,
sal_Unicode** pVList = static_cast<sal_Unicode**>(pValueList);
for (sal_uInt32 i=0; i < len; i++)
{
rtl_freeMemory(pVList[i]);
std::free(pVList[i]);
}
rtl_freeMemory(pVList);
std::free(pVList);
}
break;
default:
......@@ -660,7 +660,7 @@ RegError REGISTRY_CALLTYPE freeKeyNames(rtl_uString** pKeyNames,
rtl_uString_release(pKeyNames[i]);
}
rtl_freeMemory(pKeyNames);
std::free(pKeyNames);
return RegError::NO_ERROR;
}
......
......@@ -133,7 +133,7 @@ void test_coreReflection()
REG_ENSURE(!key2.setValue(OUString(), RegValueType::BINARY, (void*)pBlop, aBlopSize), "testCoreReflection error 9");
sal_uInt8* readBlop = (sal_uInt8*)rtl_allocateMemory(aBlopSize);
sal_uInt8* readBlop = (sal_uInt8*)std::malloc(aBlopSize);
REG_ENSURE(!key2.getValue(OUString(), (void*)readBlop) , "testCoreReflection error 9a");
RegistryTypeReader reader(readBlop, aBlopSize, sal_True);
......@@ -248,7 +248,7 @@ void test_coreReflection()
REG_ENSURE(!key5.setValue(OUString(), RegValueType::BINARY, (void*)pBlop, aBlopSize), "testCoreReflection error 9c");
sal_uInt8* readBlop = (sal_uInt8*)rtl_allocateMemory(aBlopSize);
sal_uInt8* readBlop = (sal_uInt8*)std::malloc(aBlopSize);
REG_ENSURE(!key5.getValue(OUString(), (void*)readBlop) , "testCoreReflection error 9c1");
RegistryTypeReader reader(readBlop, aBlopSize, sal_True);
......@@ -313,7 +313,7 @@ void test_coreReflection()
sal_uInt32 aBlopSize = writer.getBlopSize();
REG_ENSURE(!key7.setValue(OUString(), RegValueType::BINARY, (void*)pBlop, aBlopSize), "testCoreReflection error 9e");
sal_uInt8* readBlop = (sal_uInt8*)rtl_allocateMemory(aBlopSize);
sal_uInt8* readBlop = (sal_uInt8*)std::malloc(aBlopSize);
REG_ENSURE(!key7.getValue(OUString(), (void*)readBlop) , "testCoreReflection error 9e2");
RegistryTypeReader reader(readBlop, aBlopSize, sal_True);
......@@ -499,13 +499,13 @@ void test_registry_CppApi()
sal_Char* readValue;
REG_ENSURE(!rootKey.getValueInfo(OUString("mySecondKey"), &valueType, &valueSize), "test_registry_CppApi error 9a");
readValue = (sal_Char*)rtl_allocateMemory(valueSize);
readValue = (sal_Char*)std::malloc(valueSize);
REG_ENSURE(!key2.getValue(OUString(), readValue), "test_registry_CppApi error 10");
REG_ENSURE(valueType == RegValueType::STRING, "test_registry_CppApi error 11");
REG_ENSURE(valueSize == 18, "test_registry_CppApi error 12");
REG_ENSURE(strcmp(readValue, Value) == 0, "test_registry_CppApi error 13");
rtl_freeMemory(readValue);
std::free(readValue);
const sal_Char* pList[3];
const sal_Char* n1= "Hello";
......@@ -550,7 +550,7 @@ void test_registry_CppApi()
(rtl_ustr_getLength(wTestValue)+1)*sizeof(sal_Unicode)), "test_registry_CppApi error 13j1");
REG_ENSURE(!rootKey.getValueInfo(OUString("mySixthKey"), &valueType, &valueSize), "test_registry_CppApi error 13j2");
sal_Unicode* pTmpValue = (sal_Unicode*)rtl_allocateMemory(valueSize);
sal_Unicode* pTmpValue = (sal_Unicode*)std::malloc(valueSize);
REG_ENSURE(!rootKey.getValue(OUString("mySixthKey"), pTmpValue), "test_registry_CppApi error 13j3");
REG_ENSURE(rtl_ustr_getLength(wTestValue) == rtl_ustr_getLength(pTmpValue), "test_registry_CppApi error 13j4");
REG_ENSURE(rtl_ustr_compare(wTestValue, pTmpValue) == 0, "test_registry_CppApi error 13j4");
......
......@@ -23,6 +23,7 @@
#include <rtllifecycle.h>
#include <cassert>
#include <cstdlib>
#include <string.h>
#include <stdio.h>
......@@ -144,13 +145,13 @@ void * SAL_CALL rtl_cache_alloc(rtl_cache_type * cache) SAL_THROW_EXTERN_C()
if (!cache)
return nullptr;
obj = rtl_allocateMemory(cache->m_type_size);
obj = std::malloc(cache->m_type_size);
if (obj && cache->m_constructor)
{
if (!(cache->m_constructor)(obj, cache->m_userarg))
{
/* construction failure */
rtl_freeMemory(obj);
std::free(obj);
obj = nullptr;
}
}
......@@ -169,7 +170,7 @@ void SAL_CALL rtl_cache_free(
/* destruct object */
(cache->m_destructor)(obj, cache->m_userarg);
}
rtl_freeMemory(obj);
std::free(obj);
}
}
......
......@@ -273,7 +273,7 @@ struct PDFObject : public PDFContainer
private:
// returns true if stream is deflated
// fills *ppStream and *pBytes with start of stream and count of bytes
// memory returned in *ppStream must be freed with rtl_freeMemory afterwards
// memory returned in *ppStream must be freed with std::free afterwards
// fills in NULL and 0 in case of error
bool getDeflatedStream( char** ppStream, unsigned int* pBytes, const PDFContainer* pObjectContainer, EmitContext& rContext ) const;
};
......
......@@ -658,11 +658,11 @@ bool PDFObject::getDeflatedStream( char** ppStream, unsigned int* pBytes, const
)
{
unsigned int nOuterStreamLen = m_pStream->m_nEndOffset - m_pStream->m_nBeginOffset;
*ppStream = static_cast<char*>(rtl_allocateMemory( nOuterStreamLen ));
*ppStream = static_cast<char*>(std::malloc( nOuterStreamLen ));
unsigned int nRead = rContext.readOrigBytes( m_pStream->m_nBeginOffset, nOuterStreamLen, *ppStream );