diff options
51 files changed, 265 insertions, 266 deletions
diff --git a/binaryurp/source/unmarshal.cxx b/binaryurp/source/unmarshal.cxx index 3ea3d2058553..41145ccffca5 100644 --- a/binaryurp/source/unmarshal.cxx +++ b/binaryurp/source/unmarshal.cxx @@ -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(); } diff --git a/bridges/source/cpp_uno/msvc_win32_intel/except.cxx b/bridges/source/cpp_uno/msvc_win32_intel/except.cxx index 82fcf345cd0d..8e6a1795f898 100644 --- a/bridges/source/cpp_uno/msvc_win32_intel/except.cxx +++ b/bridges/source/cpp_uno/msvc_win32_intel/except.cxx @@ -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; } diff --git a/bridges/source/cpp_uno/msvc_win32_x86-64/except.cxx b/bridges/source/cpp_uno/msvc_win32_x86-64/except.cxx index f2e0cdc594a5..b1e14fbdf234 100644 --- a/bridges/source/cpp_uno/msvc_win32_x86-64/except.cxx +++ b/bridges/source/cpp_uno/msvc_win32_x86-64/except.cxx @@ -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 diff --git a/bridges/source/jni_uno/jni_base.h b/bridges/source/jni_uno/jni_base.h index c7ab58a0078d..6fc2aeb7b447 100644 --- a/bridges/source/jni_uno/jni_base.h +++ b/bridges/source/jni_uno/jni_base.h @@ -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); diff --git a/cli_ure/source/uno_bridge/cli_base.h b/cli_ure/source/uno_bridge/cli_base.h index 13f1dc7bff36..48e2de42d680 100644 --- a/cli_ure/source/uno_bridge/cli_base.h +++ b/cli_ure/source/uno_bridge/cli_base.h @@ -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 ); diff --git a/cppu/source/uno/copy.hxx b/cppu/source/uno/copy.hxx index b6ecb3036577..31f70092c279 100644 --- a/cppu/source/uno/copy.hxx +++ b/cppu/source/uno/copy.hxx @@ -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 ); diff --git a/cppu/source/uno/destr.hxx b/cppu/source/uno/destr.hxx index 4c017615d987..2a6f0de62000 100644 --- a/cppu/source/uno/destr.hxx +++ b/cppu/source/uno/destr.hxx @@ -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( diff --git a/cppu/source/uno/sequence.cxx b/cppu/source/uno/sequence.cxx index 513ae613c93a..1a15b1c8a8d6 100644 --- a/cppu/source/uno/sequence.cxx +++ b/cppu/source/uno/sequence.cxx @@ -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; } } diff --git a/cppuhelper/source/component_context.cxx b/cppuhelper/source/component_context.cxx index 496e5ae75b1d..7fc86360c692 100644 --- a/cppuhelper/source/component_context.cxx +++ b/cppuhelper/source/component_context.cxx @@ -481,7 +481,7 @@ void ComponentContext::disposing() assert(envs[i]->dispose != nullptr); (*envs[i]->dispose)(envs[i]); } - rtl_freeMemory(envs); + std::free(envs); } } diff --git a/filter/source/graphicfilter/ipcd/ipcd.cxx b/filter/source/graphicfilter/ipcd/ipcd.cxx index cd2f306b499d..d0af67317cf4 100644 --- a/filter/source/graphicfilter/ipcd/ipcd.cxx +++ b/filter/source/graphicfilter/ipcd/ipcd.cxx @@ -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 ================ diff --git a/forms/source/xforms/xpathlib/xpathlib.cxx b/forms/source/xforms/xpathlib/xpathlib.cxx index d0d7dba791fc..177251bb1709 100644 --- a/forms/source/xforms/xpathlib/xpathlib.cxx +++ b/forms/source/xforms/xpathlib/xpathlib.cxx @@ -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; } diff --git a/idlc/source/aststack.cxx b/idlc/source/aststack.cxx index f5a3315e3b24..464879794d53 100644 --- a/idlc/source/aststack.cxx +++ b/idlc/source/aststack.cxx @@ -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; } diff --git a/idlc/source/idlccompile.cxx b/idlc/source/idlccompile.cxx index c8a389025325..8d6386b66a44 100644 --- a/idlc/source/idlccompile.cxx +++ b/idlc/source/idlccompile.cxx @@ -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) { diff --git a/io/source/stm/streamhelper.cxx b/io/source/stm/streamhelper.cxx index ffd1726c6754..0ef0d3e1f7ae 100644 --- a/io/source/stm/streamhelper.cxx +++ b/io/source/stm/streamhelper.cxx @@ -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"); diff --git a/javaunohelper/source/bootstrap.cxx b/javaunohelper/source/bootstrap.cxx index 9cf76b72a03c..fe5b9aa7b3ee 100644 --- a/javaunohelper/source/bootstrap.cxx +++ b/javaunohelper/source/bootstrap.cxx @@ -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; diff --git a/registry/source/keyimpl.cxx b/registry/source/keyimpl.cxx index 75b1e7d7101d..7dcd088ceaa5 100644 --- a/registry/source/keyimpl.cxx +++ b/registry/source/keyimpl.cxx @@ -117,7 +117,7 @@ RegError ORegKey::openSubKeys(const OUString& keyName, RegKeyHandle** phOpenSubK { *phOpenSubKeys = nullptr; *pnSubKeys = 0; - rtl_freeMemory(pSubKeys); // @@@ leaking 'pSubKeys[0...nSubkeys-1]' + std::free(pSubKeys); // @@@ leaking 'pSubKeys[0...nSubkeys-1]' return _ret; // @@@ leaking 'pKey' } @@ -238,17 +238,17 @@ RegError ORegKey::getValueInfo(const OUString& valueName, RegValueType* pValueTy return RegError::VALUE_NOT_EXISTS; } - pBuffer = static_cast<sal_uInt8*>(rtl_allocateMemory(VALUE_HEADERSIZE)); + pBuffer = static_cast<sal_uInt8*>(std::malloc(VALUE_HEADERSIZE)); sal_uInt32 readBytes; if ( rValue.readAt(0, pBuffer, VALUE_HEADERSIZE, readBytes) ) { - rtl_freeMemory(pBuffer); + std::free(pBuffer); return RegError::INVALID_VALUE; } if (readBytes != VALUE_HEADERSIZE) { - rtl_freeMemory(pBuffer); + std::free(pBuffer); return RegError::INVALID_VALUE; } @@ -264,8 +264,8 @@ RegError ORegKey::getValueInfo(const OUString& valueName, RegValueType* pValueTy // { if (*pValueType > RegValueType::BINARY) { - rtl_freeMemory(pBuffer); - pBuffer = static_cast<sal_uInt8*>(rtl_allocateMemory(4)); + std::free(pBuffer); + pBuffer = static_cast<sal_uInt8*>(std::malloc(4)); rValue.readAt(VALUE_HEADEROFFSET, pBuffer, 4, readBytes); readUINT32(pBuffer, size); @@ -274,7 +274,7 @@ RegError ORegKey::getValueInfo(const OUString& valueName, RegValueType* pValueTy *pValueSize = size; // } - rtl_freeMemory(pBuffer); + std::free(pBuffer); return RegError::NO_ERROR; } @@ -309,7 +309,7 @@ RegError ORegKey::setValue(const OUString& valueName, RegValueType vType, RegVal sal_uInt32 size = vSize; sal_uInt8 type = static_cast<sal_uInt8>(vType); - pBuffer = static_cast<sal_uInt8*>(rtl_allocateMemory(VALUE_HEADERSIZE + size)); + pBuffer = static_cast<sal_uInt8*>(std::malloc(VALUE_HEADERSIZE + size)); memcpy(pBuffer, &type, 1); writeUINT32(pBuffer+VALUE_TYPEOFFSET, size); @@ -339,17 +339,17 @@ RegError ORegKey::setValue(const OUString& valueName, RegValueType vType, RegVal sal_uInt32 writenBytes; if ( rValue.writeAt(0, pBuffer, VALUE_HEADERSIZE+size, writenBytes) ) { - rtl_freeMemory(pBuffer); + std::free(pBuffer); return RegError::SET_VALUE_FAILED; } if (writenBytes != (VALUE_HEADERSIZE+size)) { - rtl_freeMemory(pBuffer); + std::free(pBuffer); return RegError::SET_VALUE_FAILED; } setModified(); - rtl_freeMemory(pBuffer); + std::free(pBuffer); return RegError::NO_ERROR; } @@ -381,7 +381,7 @@ RegError ORegKey::setLongListValue(const OUString& valueName, sal_Int32 const * size += len * 4; sal_uInt8 type = sal_uInt8(RegValueType::LONGLIST); - pBuffer = static_cast<sal_uInt8*>(rtl_allocateMemory(VALUE_HEADERSIZE + size)); + pBuffer = static_cast<sal_uInt8*>(std::malloc(VALUE_HEADERSIZE + size)); memcpy(pBuffer, &type, 1); writeUINT32(pBuffer+VALUE_TYPEOFFSET, size); @@ -398,17 +398,17 @@ RegError ORegKey::setLongListValue(const OUString& valueName, sal_Int32 const * sal_uInt32 writenBytes; if ( rValue.writeAt(0, pBuffer, VALUE_HEADERSIZE+size, writenBytes) ) { - rtl_freeMemory(pBuffer); + std::free(pBuffer); return RegError::SET_VALUE_FAILED; } if (writenBytes != (VALUE_HEADEROFFSET+size)) { - rtl_freeMemory(pBuffer); + std::free(pBuffer); return RegError::SET_VALUE_FAILED; } setModified(); - rtl_freeMemory(pBuffer); + std::free(pBuffer); return RegError::NO_ERROR; } @@ -444,7 +444,7 @@ RegError ORegKey::setStringListValue(const OUString& valueName, sal_Char** pValu } sal_uInt8 type = sal_uInt8(RegValueType::STRINGLIST); - pBuffer = static_cast<sal_uInt8*>(rtl_allocateMemory(VALUE_HEADERSIZE + size)); + pBuffer = static_cast<sal_uInt8*>(std::malloc(VALUE_HEADERSIZE + size)); memcpy(pBuffer, &type, 1); writeUINT32(pBuffer+VALUE_TYPEOFFSET, size); @@ -466,17 +466,17 @@ RegError ORegKey::setStringListValue(const OUString& valueName, sal_Char** pValu sal_uInt32 writenBytes; if ( rValue.writeAt(0, pBuffer, VALUE_HEADERSIZE+size, writenBytes) ) { - rtl_freeMemory(pBuffer); + std::free(pBuffer); return RegError::SET_VALUE_FAILED; } if (writenBytes != (VALUE_HEADERSIZE+size)) { - rtl_freeMemory(pBuffer); + std::free(pBuffer); return RegError::SET_VALUE_FAILED; } setModified(); - rtl_freeMemory(pBuffer); + std::free(pBuffer); return RegError::NO_ERROR; } @@ -512,7 +512,7 @@ RegError ORegKey::setUnicodeListValue(const OUString& valueName, sal_Unicode** p } sal_uInt8 type = sal_uInt8(RegValueType::UNICODELIST); - pBuffer = static_cast<sal_uInt8*>(rtl_allocateMemory(VALUE_HEADERSIZE + size)); + pBuffer = static_cast<sal_uInt8*>(std::malloc(VALUE_HEADERSIZE + size)); memcpy(pBuffer, &type, 1); writeUINT32(pBuffer+VALUE_TYPEOFFSET, size); @@ -534,17 +534,17 @@ RegError ORegKey::setUnicodeListValue(const OUString& valueName, sal_Unicode** p sal_uInt32 writenBytes; if ( rValue.writeAt(0, pBuffer, VALUE_HEADERSIZE+size, writenBytes) ) { - rtl_freeMemory(pBuffer); + std::free(pBuffer); return RegError::SET_VALUE_FAILED; } if (writenBytes != (VALUE_HEADERSIZE+size)) { - rtl_freeMemory(pBuffer); + std::free(pBuffer); return RegError::SET_VALUE_FAILED; } setModified(); - rtl_freeMemory(pBuffer); + std::free(pBuffer); return RegError::NO_ERROR; } @@ -574,17 +574,17 @@ RegError ORegKey::getValue(const OUString& valueName, RegValue value) const return RegError::VALUE_NOT_EXISTS; } - pBuffer = static_cast<sal_uInt8*>(rtl_allocateMemory(VALUE_HEADERSIZE)); + pBuffer = static_cast<sal_uInt8*>(std::malloc(VALUE_HEADERSIZE)); sal_uInt32 readBytes; if ( rValue.readAt(0, pBuffer, VALUE_HEADERSIZE, readBytes) ) { - rtl_freeMemory(pBuffer); + std::free(pBuffer); return RegError::INVALID_VALUE; } if (readBytes != VALUE_HEADERSIZE) { - rtl_freeMemory(pBuffer); + std::free(pBuffer); return RegError::INVALID_VALUE; } @@ -592,23 +592,23 @@ RegError ORegKey::getValue(const OUString& valueName, RegValue value) const valueType = static_cast<RegValueType>(type); readUINT32(pBuffer+VALUE_TYPEOFFSET, valueSize); - rtl_freeMemory(pBuffer); + std::free(pBuffer); if (valueType > RegValueType::BINARY) { return RegError::INVALID_VALUE; } - pBuffer = static_cast<sal_uInt8*>(rtl_allocateMemory(valueSize)); + pBuffer = static_cast<sal_uInt8*>(std::malloc(valueSize)); if ( rValue.readAt(VALUE_HEADEROFFSET, pBuffer, valueSize, readBytes) ) { - rtl_freeMemory(pBuffer); + std::free(pBuffer); return RegError::INVALID_VALUE; } if (readBytes != valueSize) { - rtl_freeMemory(pBuffer); + std::free(pBuffer); return RegError::INVALID_VALUE; } @@ -638,7 +638,7 @@ RegError ORegKey::getValue(const OUString& valueName, RegValue value) const } - rtl_freeMemory(pBuffer); + std::free(pBuffer); return RegError::NO_ERROR; } @@ -670,21 +670,21 @@ RegError ORegKey::getLongListValue(const OUString& valueName, sal_Int32** pValue return RegError::VALUE_NOT_EXISTS; } - pBuffer = static_cast<sal_uInt8*>(rtl_allocateMemory(VALUE_HEADERSIZE)); + pBuffer = static_cast<sal_uInt8*>(std::malloc(VALUE_HEADERSIZE)); sal_uInt32 readBytes; if ( rValue.readAt(0, pBuffer, VALUE_HEADERSIZE, readBytes) ) { pValueList = nullptr; *pLen = 0; - rtl_freeMemory(pBuffer); + std::free(pBuffer); return RegError::INVALID_VALUE; } if (readBytes != VALUE_HEADERSIZE) { pValueList = nullptr; *pLen = 0; - rtl_freeMemory(pBuffer); + std::free(pBuffer); return RegError::INVALID_VALUE; } @@ -695,13 +695,13 @@ RegError ORegKey::getLongListValue(const OUString& valueName, sal_Int32** pValue { pValueList = nullptr; *pLen = 0; - rtl_freeMemory(pBuffer); + std::free(pBuffer); return RegError::INVALID_VALUE; } readUINT32(pBuffer+VALUE_TYPEOFFSET, valueSize); - rtl_freeMemory(pBuffer); + std::free(pBuffer); /* check for 'reasonable' value */ /* surely 10 millions entry in a registry list should be enough */ @@ -709,23 +709,23 @@ RegError ORegKey::getLongListValue(const OUString& valueName, sal_Int32** pValue { pValueList = nullptr; *pLen = 0; - rtl_freeMemory(pBuffer); + std::free(pBuffer); return RegError::INVALID_VALUE; } - pBuffer = static_cast<sal_uInt8*>(rtl_allocateMemory(valueSize)); + pBuffer = static_cast<sal_uInt8*>(std::malloc(valueSize)); if ( rValue.readAt(VALUE_HEADEROFFSET, pBuffer, valueSize, readBytes) ) { pValueList = nullptr; *pLen = 0; - rtl_freeMemory(pBuffer); + std::free(pBuffer); return RegError::INVALID_VALUE; } if (readBytes != valueSize) { pValueList = nullptr; *pLen = 0; - rtl_freeMemory(pBuffer); + std::free(pBuffer); return RegError::INVALID_VALUE; } @@ -737,7 +737,7 @@ RegError ORegKey::getLongListValue(const OUString& valueName, sal_Int32** pValue { pValueList = nullptr; *pLen = 0; - rtl_freeMemory(pBuffer); + std::free(pBuffer); return RegError::INVALID_VALUE; } *pLen = len; @@ -752,7 +752,7 @@ RegError ORegKey::getLongListValue(const OUString& valueName, sal_Int32** pValue } *pValueList = pVList; - rtl_freeMemory(pBuffer); + std::free(pBuffer); return RegError::NO_ERROR; } @@ -784,21 +784,21 @@ RegError ORegKey::getStringListValue(const OUString& valueName, sal_Char*** pVal return RegError::VALUE_NOT_EXISTS; } - pBuffer = static_cast<sal_uInt8*>(rtl_allocateMemory(VALUE_HEADERSIZE)); + pBuffer = static_cast<sal_uInt8*>(std::malloc(VALUE_HEADERSIZE)); sal_uInt32 readBytes; if ( rValue.readAt(0, pBuffer, VALUE_HEADERSIZE, readBytes) ) { pValueList = nullptr; *pLen = 0; - rtl_freeMemory(pBuffer); + std::free(pBuffer); return RegError::INVALID_VALUE; } if (readBytes != VALUE_HEADERSIZE) { pValueList = nullptr; *pLen = 0; - rtl_freeMemory(pBuffer); + std::free(pBuffer); return RegError::INVALID_VALUE; } @@ -809,28 +809,28 @@ RegError ORegKey::getStringListValue(const OUString& valueName, sal_Char*** pVal { pValueList = nullptr; *pLen = 0; - rtl_freeMemory(pBuffer); + std::free(pBuffer); return RegError::INVALID_VALUE; } readUINT32(pBuffer+VALUE_TYPEOFFSET, valueSize); - rtl_freeMemory(pBuffer); + std::free(pBuffer); - pBuffer = static_cast<sal_uInt8*>(rtl_allocateMemory(valueSize)); + pBuffer = static_cast<sal_uInt8*>(std::malloc(valueSize)); if ( rValue.readAt(VALUE_HEADEROFFSET, pBuffer, valueSize, readBytes) ) { pValueList = nullptr; *pLen = 0; - rtl_freeMemory(pBuffer); + std::free(pBuffer); return RegError::INVALID_VALUE; } if (readBytes != valueSize) { pValueList = nullptr; *pLen = 0; - rtl_freeMemory(pBuffer); + std::free(pBuffer); return RegError::INVALID_VALUE; } @@ -850,7 +850,7 @@ RegError ORegKey::getStringListValue(const OUString& valueName, sal_Char*** pVal offset += 4; - pValue = static_cast<sal_Char*>(rtl_allocateMemory(sLen)); + pValue = static_cast<sal_Char*>(std::malloc(sLen)); readUtf8(pBuffer+offset, pValue, sLen); pVList[i] = pValue; @@ -858,7 +858,7 @@ RegError ORegKey::getStringListValue(const OUString& valueName, sal_Char*** pVal } *pValueList = pVList; - rtl_freeMemory(pBuffer); + std::free(pBuffer); return RegError::NO_ERROR; } @@ -890,21 +890,21 @@ RegError ORegKey::getUnicodeListValue(const OUString& valueName, sal_Unicode*** return RegError::VALUE_NOT_EXISTS; } - pBuffer = static_cast<sal_uInt8*>(rtl_allocateMemory(VALUE_HEADERSIZE)); + pBuffer = static_cast<sal_uInt8*>(std::malloc(VALUE_HEADERSIZE)); sal_uInt32 readBytes; if ( rValue.readAt(0, pBuffer, VALUE_HEADERSIZE, readBytes) ) { pValueList = nullptr; *pLen = 0; - rtl_freeMemory(pBuffer); + std::free(pBuffer); return RegError::INVALID_VALUE; } if (readBytes != VALUE_HEADERSIZE) { pValueList = nullptr; *pLen = 0; - rtl_freeMemory(pBuffer); + std::free(pBuffer); return RegError::INVALID_VALUE; } @@ -915,28 +915,28 @@ RegError ORegKey::getUnicodeListValue(const OUString& valueName, sal_Unicode*** { pValueList = nullptr; *pLen = 0; - rtl_freeMemory(pBuffer); + std::free(pBuffer); return RegError::INVALID_VALUE; } readUINT32(pBuffer+VALUE_TYPEOFFSET, valueSize); - rtl_freeMemory(pBuffer); + std::free(pBuffer); - pBuffer = static_cast<sal_uInt8*>(rtl_allocateMemory(valueSize)); + pBuffer = static_cast<sal_uInt8*>(std::malloc(valueSize)); if ( rValue.readAt(VALUE_HEADEROFFSET, pBuffer, valueSize, readBytes) ) { pValueList = nullptr; *pLen = 0; - rtl_freeMemory(pBuffer); + std::free(pBuffer); return RegError::INVALID_VALUE; } if (readBytes != valueSize) { pValueList = nullptr; *pLen = 0; - rtl_freeMemory(pBuffer); + std::free(pBuffer); return RegError::INVALID_VALUE; } @@ -956,7 +956,7 @@ RegError ORegKey::getUnicodeListValue(const OUString& valueName, sal_Unicode*** offset += 4; - pValue = static_cast<sal_Unicode*>(rtl_allocateMemory((sLen / 2) * sizeof(sal_Unicode))); + pValue = static_cast<sal_Unicode*>(std::malloc((sLen / 2) * sizeof(sal_Unicode))); readString(pBuffer+offset, pValue, sLen); pVList[i] = pValue; @@ -964,7 +964,7 @@ RegError ORegKey::getUnicodeListValue(const OUString& valueName, sal_Unicode*** } *pValueList = pVList; - rtl_freeMemory(pBuffer); + std::free(pBuffer); return RegError::NO_ERROR; } diff --git a/registry/source/regimpl.cxx b/registry/source/regimpl.cxx index 43039fcddc29..d8a58141fce7 100644 --- a/registry/source/regimpl.cxx +++ b/registry/source/regimpl.cxx @@ -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; diff --git a/registry/source/regkey.cxx b/registry/source/regkey.cxx index bf4f464d7b52..52bb9105ac92 100644 --- a/registry/source/regkey.cxx +++ b/registry/source/regkey.cxx @@ -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; } diff --git a/registry/test/testregcpp.cxx b/registry/test/testregcpp.cxx index 837e91cf3ddb..fa038c19d4d6 100644 --- a/registry/test/testregcpp.cxx +++ b/registry/test/testregcpp.cxx @@ -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"); diff --git a/sal/rtl/alloc_cache.cxx b/sal/rtl/alloc_cache.cxx index d1eaf44cd142..1f165cca161c 100644 --- a/sal/rtl/alloc_cache.cxx +++ b/sal/rtl/alloc_cache.cxx @@ -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); } } diff --git a/sdext/source/pdfimport/inc/pdfparse.hxx b/sdext/source/pdfimport/inc/pdfparse.hxx index 90aaeab292ae..62edc35a015c 100644 --- a/sdext/source/pdfimport/inc/pdfparse.hxx +++ b/sdext/source/pdfimport/inc/pdfparse.hxx @@ -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; }; diff --git a/sdext/source/pdfimport/pdfparse/pdfentries.cxx b/sdext/source/pdfimport/pdfparse/pdfentries.cxx index 5288f57bb954..9c6b169b266e 100644 --- a/sdext/source/pdfimport/pdfparse/pdfentries.cxx +++ b/sdext/source/pdfimport/pdfparse/pdfentries.cxx @@ -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 ); if( nRead != nOuterStreamLen ) { - rtl_freeMemory( *ppStream ); + std::free( *ppStream ); *ppStream = nullptr; *pBytes = 0; return false; @@ -732,7 +732,7 @@ static void unzipToBuffer( char* pBegin, unsigned int nLen, const unsigned int buf_increment_size = 16384; - *pOutBuf = static_cast<sal_uInt8*>(rtl_reallocateMemory( *pOutBuf, buf_increment_size )); + *pOutBuf = static_cast<sal_uInt8*>(std::realloc( *pOutBuf, buf_increment_size )); aZStr.next_out = reinterpret_cast<Bytef*>(*pOutBuf); aZStr.avail_out = buf_increment_size; *pOutLen = buf_increment_size; @@ -744,7 +744,7 @@ static void unzipToBuffer( char* pBegin, unsigned int nLen, if( err != Z_STREAM_END ) { const int nNewAlloc = *pOutLen + buf_increment_size; - *pOutBuf = static_cast<sal_uInt8*>(rtl_reallocateMemory( *pOutBuf, nNewAlloc )); + *pOutBuf = static_cast<sal_uInt8*>(std::realloc( *pOutBuf, nNewAlloc )); aZStr.next_out = reinterpret_cast<Bytef*>(*pOutBuf + *pOutLen); aZStr.avail_out = buf_increment_size; *pOutLen = nNewAlloc; @@ -759,7 +759,7 @@ static void unzipToBuffer( char* pBegin, unsigned int nLen, inflateEnd(&aZStr); if( err < Z_OK ) { - rtl_freeMemory( *pOutBuf ); + std::free( *pOutBuf ); *pOutBuf = nullptr; *pOutLen = 0; } @@ -777,11 +777,11 @@ void PDFObject::writeStream( EmitContext& rWriteContext, const PDFFile* pParsedF sal_uInt32 nOutBytes = 0; unzipToBuffer( pStream, nBytes, &pOutBytes, &nOutBytes ); rWriteContext.write( pOutBytes, nOutBytes ); - rtl_freeMemory( pOutBytes ); + std::free( pOutBytes ); } else if( pStream && nBytes ) rWriteContext.write( pStream, nBytes ); - rtl_freeMemory( pStream ); + std::free( pStream ); } } @@ -874,15 +874,15 @@ bool PDFObject::emit( EmitContext& rWriteContext ) const if( bRet ) bRet = rWriteContext.write( "\nendstream\nendobj\n", 18 ); if( pOutBytes != reinterpret_cast<sal_uInt8*>(pStream) ) - rtl_freeMemory( pOutBytes ); - rtl_freeMemory( pStream ); + std::free( pOutBytes ); + std::free( pStream ); pEData->setDecryptObject( 0, 0 ); return bRet; } if( pOutBytes != reinterpret_cast<sal_uInt8*>(pStream) ) - rtl_freeMemory( pOutBytes ); + std::free( pOutBytes ); } - rtl_freeMemory( pStream ); + std::free( pStream ); } bool bRet = emitSubElements( rWriteContext ) && diff --git a/sdext/source/pdfimport/pdfparse/pdfparse.cxx b/sdext/source/pdfimport/pdfparse/pdfparse.cxx index 9e2eb4870a92..5e08c1e5ad5d 100644 --- a/sdext/source/pdfimport/pdfparse/pdfparse.cxx +++ b/sdext/source/pdfimport/pdfparse/pdfparse.cxx @@ -616,12 +616,12 @@ PDFEntry* PDFReader::read( const char* pFileName ) fseek( fp, 0, SEEK_END ); unsigned int nLen = static_cast<unsigned int>(ftell( fp )); fseek( fp, 0, SEEK_SET ); - char* pBuf = static_cast<char*>(rtl_allocateMemory( nLen )); + char* pBuf = static_cast<char*>(std::malloc( nLen )); if( pBuf ) { fread( pBuf, 1, nLen, fp ); pRet = read( pBuf, nLen ); - rtl_freeMemory( pBuf ); + std::free( pBuf ); } fclose( fp ); } diff --git a/sdext/source/pdfimport/test/pdfunzip.cxx b/sdext/source/pdfimport/test/pdfunzip.cxx index c6b24eda0414..2ccbffb5dcb3 100644 --- a/sdext/source/pdfimport/test/pdfunzip.cxx +++ b/sdext/source/pdfimport/test/pdfunzip.cxx @@ -178,7 +178,7 @@ bool FileEmitContext::copyOrigBytes( unsigned int nOrigOffset, unsigned int nLen fprintf( stderr, "could not seek to offset %u\n", nOrigOffset ); return false; } - void* pBuf = rtl_allocateMemory( nLen ); + void* pBuf = std::malloc( nLen ); if( ! pBuf ) return false; sal_uInt64 nBytesRead = 0; @@ -186,11 +186,11 @@ bool FileEmitContext::copyOrigBytes( unsigned int nOrigOffset, unsigned int nLen || nBytesRead != static_cast<sal_uInt64>(nLen) ) { fprintf( stderr, "could not read %u bytes\n", nLen ); - rtl_freeMemory( pBuf ); + std::free( pBuf ); return false; } bool bRet = write( pBuf, nLen ); - rtl_freeMemory( pBuf ); + std::free( pBuf ); return bRet; } diff --git a/store/source/lockbyte.cxx b/store/source/lockbyte.cxx index 09240505a7fb..444772e8ff8d 100644 --- a/store/source/lockbyte.cxx +++ b/store/source/lockbyte.cxx @@ -690,7 +690,7 @@ MemoryLockBytes::MemoryLockBytes() MemoryLockBytes::~MemoryLockBytes() { - rtl_freeMemory (m_pData); + std::free (m_pData); } storeError MemoryLockBytes::initialize_Impl (rtl::Reference< PageData::Allocator > & rxAllocator, sal_uInt16 nPageSize) @@ -776,7 +776,7 @@ storeError MemoryLockBytes::setSize_Impl (sal_uInt32 nSize) { if (nSize != m_nSize) { - sal_uInt8 * pData = static_cast<sal_uInt8*>(rtl_reallocateMemory (m_pData, nSize)); + sal_uInt8 * pData = static_cast<sal_uInt8*>(std::realloc (m_pData, nSize)); if (pData != nullptr) { if (nSize > m_nSize) diff --git a/store/source/storbase.hxx b/store/source/storbase.hxx index 042a467db1b5..accfdf7d73f9 100644 --- a/store/source/storbase.hxx +++ b/store/source/storbase.hxx @@ -529,11 +529,11 @@ public: */ static void * operator new (size_t n) { - return rtl_allocateMemory (sal_uInt32(n)); + return std::malloc(sal_uInt32(n)); } static void operator delete (void * p) { - rtl_freeMemory (p); + std::free (p); } /** State. diff --git a/store/source/storbios.cxx b/store/source/storbios.cxx index fa76b5cc345d..2ba25fd53e8c 100644 --- a/store/source/storbios.cxx +++ b/store/source/storbios.cxx @@ -170,11 +170,11 @@ struct SuperBlockPage */ static void * operator new (size_t n) { - return rtl_allocateMemory (sal::static_int_cast<sal_Size>(n)); + return std::malloc(sal::static_int_cast<sal_Size>(n)); } static void operator delete (void * p) { - rtl_freeMemory (p); + std::free (p); } static void * operator new (SAL_UNUSED_PARAMETER size_t, sal_uInt16 nPageSize) @@ -183,7 +183,7 @@ struct SuperBlockPage } static void operator delete (void * p, SAL_UNUSED_PARAMETER sal_uInt16) { - rtl_freeMemory (p); + std::free (p); } /** Construction. diff --git a/store/source/storcach.cxx b/store/source/storcach.cxx index 2f74a872e9d0..a1037095c933 100644 --- a/store/source/storcach.cxx +++ b/store/source/storcach.cxx @@ -208,7 +208,7 @@ PageCache::~PageCache() if (m_hash_table != m_hash_table_0) { - rtl_freeMemory (m_hash_table); + std::free (m_hash_table); m_hash_table = m_hash_table_0; m_hash_size = theTableSize; m_hash_shift = highbit(m_hash_size) - 1; @@ -219,7 +219,7 @@ PageCache::~PageCache() void PageCache::rescale_Impl (std::size_t new_size) { std::size_t new_bytes = new_size * sizeof(Entry*); - Entry ** new_table = static_cast<Entry**>(rtl_allocateMemory(new_bytes)); + Entry ** new_table = static_cast<Entry**>(std::malloc(new_bytes)); if (new_table != nullptr) { @@ -255,7 +255,7 @@ void PageCache::rescale_Impl (std::size_t new_size) if (old_table != m_hash_table_0) { - rtl_freeMemory (old_table); + std::free (old_table); } } } diff --git a/svl/source/misc/strmadpt.cxx b/svl/source/misc/strmadpt.cxx index 07e9b62fe310..1e9abecd1fb5 100644 --- a/svl/source/misc/strmadpt.cxx +++ b/svl/source/misc/strmadpt.cxx @@ -460,7 +460,7 @@ void SvDataPipe_Impl::remove(Page * pPage) pPage->m_pPrev->m_pNext = pPage->m_pNext; pPage->m_pNext->m_pPrev = pPage->m_pPrev; - rtl_freeMemory(pPage); + std::free(pPage); --m_nPages; } @@ -470,7 +470,7 @@ SvDataPipe_Impl::~SvDataPipe_Impl() for (Page * pPage = m_pFirstPage;;) { Page * pNext = pPage->m_pNext; - rtl_freeMemory(pPage); + std::free(pPage); if (pNext == m_pFirstPage) break; pPage = pNext; @@ -523,9 +523,9 @@ void SvDataPipe_Impl::write(sal_Int8 const * pBuffer, sal_uInt32 nSize) if (m_pWritePage == nullptr) { m_pFirstPage - = static_cast< Page * >(rtl_allocateMemory(sizeof (Page) - + m_nPageSize - - 1)); + = static_cast< Page * >(std::malloc(sizeof (Page) + + m_nPageSize + - 1)); m_pFirstPage->m_pPrev = m_pFirstPage; m_pFirstPage->m_pNext = m_pFirstPage; m_pFirstPage->m_pStart = m_pFirstPage->m_aBuffer; @@ -593,7 +593,7 @@ void SvDataPipe_Impl::write(sal_Int8 const * pBuffer, sal_uInt32 nSize) break; Page * pNew - = static_cast< Page * >(rtl_allocateMemory( + = static_cast< Page * >(std::malloc( sizeof (Page) + m_nPageSize - 1)); pNew->m_pPrev = m_pWritePage; diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 2db9fe80322d..d5fe4bde60b4 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -3082,7 +3082,7 @@ bool SwWW8ImplReader::ReadPlainChars(WW8_CP& rPos, sal_Int32 nEnd, sal_Int32 nCp if (m_pStrm->GetError()) { rPos = WW8_CP_MAX-10; // -> eof or other error - rtl_freeMemory(pStr); + std::free(pStr); delete [] p8Bits; return true; } diff --git a/ucb/source/ucp/ftp/ftpurl.cxx b/ucb/source/ucp/ftp/ftpurl.cxx index 2aa3d4c7a5ff..6a671ddd291c 100644 --- a/ucb/source/ucp/ftp/ftpurl.cxx +++ b/ucb/source/ucp/ftp/ftpurl.cxx @@ -70,7 +70,7 @@ MemoryContainer::MemoryContainer() MemoryContainer::~MemoryContainer() { - rtl_freeMemory(m_pBuffer); + std::free(m_pBuffer); } @@ -88,7 +88,7 @@ int MemoryContainer::append( m_nLen+=1024; } while(m_nLen < tmp); - m_pBuffer = rtl_reallocateMemory(m_pBuffer,m_nLen); + m_pBuffer = std::realloc(m_pBuffer,m_nLen); } memcpy(static_cast<sal_Int8*>(m_pBuffer)+m_nWritePos, diff --git a/vcl/headless/svpprn.cxx b/vcl/headless/svpprn.cxx index fd325227e1f7..b9c74f4d8aa5 100644 --- a/vcl/headless/svpprn.cxx +++ b/vcl/headless/svpprn.cxx @@ -139,7 +139,7 @@ static void copyJobDataToJobSetup( ImplJobSetup* pJobSetup, JobData& rData ) // copy the whole context if( pJobSetup->GetDriverData() ) - rtl_freeMemory( const_cast<sal_uInt8*>(pJobSetup->GetDriverData()) ); + std::free( const_cast<sal_uInt8*>(pJobSetup->GetDriverData()) ); sal_uInt32 nBytes; void* pBuffer = nullptr; diff --git a/vcl/osx/salprn.cxx b/vcl/osx/salprn.cxx index baeb6c6d71d9..c3d8e52fccd9 100644 --- a/vcl/osx/salprn.cxx +++ b/vcl/osx/salprn.cxx @@ -71,8 +71,8 @@ AquaSalInfoPrinter::AquaSalInfoPrinter( const SalPrinterQueueInfo& i_rQueue ) : mpGraphics = new AquaSalGraphics(); const int nWidth = 100, nHeight = 100; - mpContextMemory.reset(static_cast<sal_uInt8*>(rtl_allocateMemory(nWidth * 4 * nHeight)), - &rtl_freeMemory); + mpContextMemory.reset(static_cast<sal_uInt8*>(std::malloc(nWidth * 4 * nHeight)), + &std::free); if (mpContextMemory) { @@ -188,7 +188,7 @@ bool AquaSalInfoPrinter::SetPrinterData( ImplJobSetup* io_pSetupData ) io_pSetupData->SetOrientation( mePageOrientation ); io_pSetupData->SetPaperBin( 0 ); - io_pSetupData->SetDriverData( static_cast<sal_uInt8*>(rtl_allocateMemory( 4 )) ); + io_pSetupData->SetDriverData( static_cast<sal_uInt8*>(std::malloc( 4 )) ); io_pSetupData->SetDriverDataLen( 4 ); } else diff --git a/vcl/qt5/Qt5Instance_Print.cxx b/vcl/qt5/Qt5Instance_Print.cxx index bc236fc746af..6430c006c1e3 100644 --- a/vcl/qt5/Qt5Instance_Print.cxx +++ b/vcl/qt5/Qt5Instance_Print.cxx @@ -142,7 +142,7 @@ static void copyJobDataToJobSetup(ImplJobSetup* pJobSetup, JobData& rData) // copy the whole context if (pJobSetup->GetDriverData()) - rtl_freeMemory(const_cast<sal_uInt8*>(pJobSetup->GetDriverData())); + std::free(const_cast<sal_uInt8*>(pJobSetup->GetDriverData())); sal_uInt32 nBytes; void* pBuffer = nullptr; diff --git a/vcl/quartz/salbmp.cxx b/vcl/quartz/salbmp.cxx index a78b06550530..3cde1f380955 100644 --- a/vcl/quartz/salbmp.cxx +++ b/vcl/quartz/salbmp.cxx @@ -870,7 +870,7 @@ CGImageRef QuartzSalBitmap::CreateCroppedImage( int nX, int nY, int nNewWidth, i static void CFRTLFree(void* /*info*/, const void* data, size_t /*size*/) { - rtl_freeMemory( const_cast<void*>(data) ); + std::free( const_cast<void*>(data) ); } CGImageRef QuartzSalBitmap::CreateWithMask( const QuartzSalBitmap& rMask, @@ -894,7 +894,7 @@ CGImageRef QuartzSalBitmap::CreateWithMask( const QuartzSalBitmap& rMask, // create the alpha mask image fitting our image // TODO: is caching the full mask or the subimage mask worth it? int nMaskBytesPerRow = ((nWidth + 3) & ~3); - void* pMaskMem = rtl_allocateMemory( nMaskBytesPerRow * nHeight ); + void* pMaskMem = std::malloc( nMaskBytesPerRow * nHeight ); CGContextRef xMaskContext = CGBitmapContextCreate( pMaskMem, nWidth, nHeight, 8, nMaskBytesPerRow, GetSalData()->mxGraySpace, kCGImageAlphaNone ); SAL_INFO("vcl.cg", "CGBitmapContextCreate(" << nWidth << "x" << nHeight << "x8," << nMaskBytesPerRow << ") = " << xMaskContext ); @@ -937,7 +937,7 @@ CGImageRef QuartzSalBitmap::CreateColorMask( int nX, int nY, int nWidth, if (m_pUserBuffer.get() && (nX + nWidth <= mnWidth) && (nY + nHeight <= mnHeight)) { const sal_uInt32 nDestBytesPerRow = nWidth << 2; - sal_uInt32* pMaskBuffer = static_cast<sal_uInt32*>( rtl_allocateMemory( nHeight * nDestBytesPerRow ) ); + sal_uInt32* pMaskBuffer = static_cast<sal_uInt32*>( std::malloc( nHeight * nDestBytesPerRow ) ); sal_uInt32* pDest = pMaskBuffer; ImplPixelFormat* pSourcePixels = ImplPixelFormat::GetFormat( mnBits, maPalette ); diff --git a/vcl/quartz/salvd.cxx b/vcl/quartz/salvd.cxx index 79d5725627a8..84f3ee8b9631 100644 --- a/vcl/quartz/salvd.cxx +++ b/vcl/quartz/salvd.cxx @@ -183,7 +183,7 @@ void AquaSalVirtualDevice::Destroy() if( mxBitmapContext ) { void* pRawData = CGBitmapContextGetData( mxBitmapContext ); - rtl_freeMemory( pRawData ); + std::free( pRawData ); SAL_INFO( "vcl.cg", "CGContextRelease(" << mxBitmapContext << ")" ); CGContextRelease( mxBitmapContext ); mxBitmapContext = nullptr; @@ -236,7 +236,7 @@ bool AquaSalVirtualDevice::SetSize( long nDX, long nDY ) mnBitmapDepth = 8; // TODO: are 1bit vdevs worth it? const int nBytesPerRow = (mnBitmapDepth * nDX + 7) / 8; - void* pRawData = rtl_allocateMemory( nBytesPerRow * nDY ); + void* pRawData = std::malloc( nBytesPerRow * nDY ); #ifdef DBG_UTIL for (ssize_t i = 0; i < nBytesPerRow * nDY; i++) { @@ -279,7 +279,7 @@ bool AquaSalVirtualDevice::SetSize( long nDX, long nDY ) mnBitmapDepth = 32; const int nBytesPerRow = (mnBitmapDepth * nDX) / 8; - void* pRawData = rtl_allocateMemory( nBytesPerRow * nDY ); + void* pRawData = std::malloc( nBytesPerRow * nDY ); #ifdef DBG_UTIL for (ssize_t i = 0; i < nBytesPerRow * nDY; i++) { @@ -296,7 +296,7 @@ bool AquaSalVirtualDevice::SetSize( long nDX, long nDY ) mnBitmapDepth = 32; const int nBytesPerRow = (mnBitmapDepth * nDX) / 8; - void* pRawData = rtl_allocateMemory( nBytesPerRow * nDY ); + void* pRawData = std::malloc( nBytesPerRow * nDY ); #ifdef DBG_UTIL for (ssize_t i = 0; i < nBytesPerRow * nDY; i++) { diff --git a/vcl/quartz/utils.cxx b/vcl/quartz/utils.cxx index 80c773889d2d..bbb29170a8b5 100644 --- a/vcl/quartz/utils.cxx +++ b/vcl/quartz/utils.cxx @@ -46,12 +46,12 @@ OUString GetOUString( CFStringRef rStr ) return OUString( reinterpret_cast<sal_Unicode const *>(pConstStr), nLength ); } - UniChar* pStr = static_cast<UniChar*>( rtl_allocateMemory( sizeof(UniChar)*nLength ) ); + UniChar* pStr = static_cast<UniChar*>( std::malloc( sizeof(UniChar)*nLength ) ); CFRange aRange = { 0, nLength }; CFStringGetCharacters( rStr, aRange, pStr ); OUString aRet( reinterpret_cast<sal_Unicode *>(pStr), nLength ); - rtl_freeMemory( pStr ); + std::free( pStr ); return aRet; } diff --git a/vcl/source/filter/igif/decode.cxx b/vcl/source/filter/igif/decode.cxx index 7e136d1e3f20..8cbb52c9f9d8 100644 --- a/vcl/source/filter/igif/decode.cxx +++ b/vcl/source/filter/igif/decode.cxx @@ -64,7 +64,7 @@ Scanline GIFLZWDecompressor::DecompressBlock( sal_uInt8* pSrc, sal_uInt8 cBufSiz { sal_uLong nTargetSize = 4096; sal_uLong nCount = 0; - sal_uInt8* pTarget = static_cast<sal_uInt8*>(rtl_allocateMemory( nTargetSize )); + sal_uInt8* pTarget = static_cast<sal_uInt8*>(std::malloc( nTargetSize )); sal_uInt8* pTmpTarget = pTarget; nBlockBufSize = cBufSize; @@ -79,10 +79,10 @@ Scanline GIFLZWDecompressor::DecompressBlock( sal_uInt8* pSrc, sal_uInt8 cBufSiz { sal_uLong nNewSize = nTargetSize << 1; sal_uLong nOffset = pTmpTarget - pTarget; - sal_uInt8* pTmp = static_cast<sal_uInt8*>(rtl_allocateMemory( nNewSize )); + sal_uInt8* pTmp = static_cast<sal_uInt8*>(std::malloc( nNewSize )); memcpy( pTmp, pTarget, nTargetSize ); - rtl_freeMemory( pTarget ); + std::free( pTarget ); nTargetSize = nNewSize; pTmpTarget = ( pTarget = pTmp ) + nOffset; diff --git a/vcl/source/filter/igif/gifread.cxx b/vcl/source/filter/igif/gifread.cxx index 8698a2672f3f..3d1b191c798f 100644 --- a/vcl/source/filter/igif/gifread.cxx +++ b/vcl/source/filter/igif/gifread.cxx @@ -530,7 +530,7 @@ sal_uLong GIFReader::ReadNextBlock() if( nRead && !bOverreadBlock ) FillImages( pTarget, nRead ); - rtl_freeMemory( pTarget ); + std::free( pTarget ); } } } diff --git a/vcl/source/fontsubset/list.cxx b/vcl/source/fontsubset/list.cxx index aab4bf40d2f6..986cf5eb2633 100644 --- a/vcl/source/fontsubset/list.cxx +++ b/vcl/source/fontsubset/list.cxx @@ -27,6 +27,7 @@ #include <rtl/alloc.h> #include <assert.h> +#include <cstdlib> #include "list.h" @@ -49,7 +50,7 @@ struct list_ { static lnode *newNode(void *el) { - lnode *ptr = static_cast<lnode *>(rtl_allocateMemory(sizeof(lnode))); + lnode *ptr = static_cast<lnode *>(std::malloc(sizeof(lnode))); assert(ptr != nullptr); ptr->value = el; @@ -84,7 +85,7 @@ static lnode *appendPrim(list pThis, void *el) /*- public methods */ list listNewEmpty() /*- default ctor */ { - list pThis = static_cast<list>(rtl_allocateMemory(sizeof(struct list_))); + list pThis = static_cast<list>(std::malloc(sizeof(struct list_))); assert(pThis != nullptr); pThis->aCount = 0; @@ -98,7 +99,7 @@ void listDispose(list pThis) /*- dtor */ { assert(pThis != nullptr); listClear(pThis); - rtl_freeMemory(pThis); + std::free(pThis); } void listSetElementDtor(list pThis, list_destructor f) @@ -199,7 +200,7 @@ list listRemove(list pThis) if (pThis->eDtor) pThis->eDtor(pThis->cptr->value); /* call the dtor callback */ - rtl_freeMemory(pThis->cptr); + std::free(pThis->cptr); pThis->aCount--; pThis->cptr = ptr; return pThis; @@ -212,7 +213,7 @@ list listClear(list pThis) while (node) { ptr = node->next; if (pThis->eDtor) pThis->eDtor(node->value); /* call the dtor callback */ - rtl_freeMemory(node); + std::free(node); pThis->aCount--; node = ptr; } diff --git a/vcl/source/gdi/impvect.cxx b/vcl/source/gdi/impvect.cxx index 8f80bbb11cf6..482ab0facbd0 100644 --- a/vcl/source/gdi/impvect.cxx +++ b/vcl/source/gdi/impvect.cxx @@ -206,7 +206,7 @@ public: ImplVectMap::ImplVectMap( long nWidth, long nHeight ) : mpBuf ( static_cast<Scanline>(rtl_allocateZeroMemory(nWidth * nHeight)) ), - mpScan ( static_cast<Scanline*>(rtl_allocateMemory(nHeight * sizeof(Scanline))) ), + mpScan ( static_cast<Scanline*>(std::malloc(nHeight * sizeof(Scanline))) ), mnWidth ( nWidth ), mnHeight( nHeight ) { @@ -219,8 +219,8 @@ ImplVectMap::ImplVectMap( long nWidth, long nHeight ) : ImplVectMap::~ImplVectMap() { - rtl_freeMemory( mpBuf ); - rtl_freeMemory( mpScan ); + std::free( mpBuf ); + std::free( mpScan ); } inline void ImplVectMap::Set( long nY, long nX, sal_uInt8 cVal ) diff --git a/vcl/source/gdi/jobset.cxx b/vcl/source/gdi/jobset.cxx index 6326c6703a6b..7fc650c38e07 100644 --- a/vcl/source/gdi/jobset.cxx +++ b/vcl/source/gdi/jobset.cxx @@ -81,7 +81,7 @@ ImplJobSetup::ImplJobSetup( const ImplJobSetup& rJobSetup ) : { if ( rJobSetup.GetDriverData() ) { - mpDriverData = static_cast<sal_uInt8*>(rtl_allocateMemory( mnDriverDataLen )); + mpDriverData = static_cast<sal_uInt8*>(std::malloc( mnDriverDataLen )); memcpy( mpDriverData, rJobSetup.GetDriverData(), mnDriverDataLen ); } else @@ -90,7 +90,7 @@ ImplJobSetup::ImplJobSetup( const ImplJobSetup& rJobSetup ) : ImplJobSetup::~ImplJobSetup() { - rtl_freeMemory( mpDriverData ); + std::free( mpDriverData ); } void ImplJobSetup::SetSystem(sal_uInt16 nSystem) @@ -283,7 +283,7 @@ SvStream& ReadJobSetup( SvStream& rIStream, JobSetup& rJobSetup ) else { sal_uInt8* pNewDriverData = static_cast<sal_uInt8*>( - rtl_allocateMemory( rJobData.GetDriverDataLen() )); + std::malloc( rJobData.GetDriverDataLen() )); memcpy( pNewDriverData, pDriverData, rJobData.GetDriverDataLen() ); rJobData.SetDriverData( pNewDriverData ); } diff --git a/vcl/source/gdi/octree.cxx b/vcl/source/gdi/octree.cxx index c2900cee7d1f..3397a1fb08f3 100644 --- a/vcl/source/gdi/octree.cxx +++ b/vcl/source/gdi/octree.cxx @@ -282,8 +282,8 @@ InverseColorMap::InverseColorMap( const BitmapPalette& rPal ) : InverseColorMap::~InverseColorMap() { - rtl_freeMemory( pBuffer ); - rtl_freeMemory( pMap ); + std::free( pBuffer ); + std::free( pMap ); } void InverseColorMap::ImplCreateBuffers( const sal_uLong nMax ) @@ -291,10 +291,10 @@ void InverseColorMap::ImplCreateBuffers( const sal_uLong nMax ) const sal_uLong nCount = nMax * nMax * nMax; const sal_uLong nSize = nCount * sizeof( sal_uLong ); - pMap = static_cast<sal_uInt8*>(rtl_allocateMemory( nCount )); + pMap = static_cast<sal_uInt8*>(std::malloc( nCount )); memset( pMap, 0x00, nCount ); - pBuffer = static_cast<sal_uInt8*>(rtl_allocateMemory( nSize )); + pBuffer = static_cast<sal_uInt8*>(std::malloc( nSize )); memset( pBuffer, 0xff, nSize ); } diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 38e1ab075363..562927d505b0 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -1822,7 +1822,7 @@ PDFWriterImpl::~PDFWriterImpl() if( m_aCipher ) rtl_cipher_destroyARCFOUR( m_aCipher ); - rtl_freeMemory( m_pEncryptionBuffer ); + std::free( m_pEncryptionBuffer ); } void PDFWriterImpl::setupDocInfo() diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx index 11bffa24682d..0d2baba291de 100644 --- a/vcl/source/gdi/pdfwriter_impl2.cxx +++ b/vcl/source/gdi/pdfwriter_impl2.cxx @@ -1154,9 +1154,8 @@ bool PDFWriterImpl::checkEncryptionBufferSize( sal_Int32 newSize ) { if( m_nEncryptionBufferSize < newSize ) { - /* reallocate the buffer, the used function allocate as rtl_allocateMemory - if the pointer parameter is NULL */ - m_pEncryptionBuffer = static_cast<sal_uInt8*>(rtl_reallocateMemory( m_pEncryptionBuffer, newSize )); + /* reallocate the buffer */ + m_pEncryptionBuffer = static_cast<sal_uInt8*>(std::realloc( m_pEncryptionBuffer, newSize )); if( m_pEncryptionBuffer ) m_nEncryptionBufferSize = newSize; else @@ -2014,7 +2013,7 @@ void PDFWriterImpl::writeG4Stream( BitmapReadAccess const * i_pBitmap ) aBitState.flush(); } - rtl_freeMemory( pFirstRefLine ); + std::free( pFirstRefLine ); } static bool lcl_canUsePDFAxialShading(const Gradient& rGradient) { diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx index 90396200063e..2574e37f6736 100644 --- a/vcl/source/gdi/print.cxx +++ b/vcl/source/gdi/print.cxx @@ -643,7 +643,7 @@ void Printer::ImplInit( SalPrinterQueueInfo* pInfo ) if ( rData.GetPrinterName() != pInfo->maPrinterName || rData.GetDriver() != pInfo->maDriver ) { - rtl_freeMemory( const_cast<sal_uInt8*>(rData.GetDriverData()) ); + std::free( const_cast<sal_uInt8*>(rData.GetDriverData()) ); rData.SetDriverData(nullptr); rData.SetDriverDataLen(0); } diff --git a/vcl/unx/generic/app/sm.cxx b/vcl/unx/generic/app/sm.cxx index 722819a7f515..25b516c000f3 100644 --- a/vcl/unx/generic/app/sm.cxx +++ b/vcl/unx/generic/app/sm.cxx @@ -717,13 +717,13 @@ void ICEConnectionWorker(void * data) osl::MutexGuard g(pThis->m_ICEMutex); nConnectionsBefore = pThis->m_nConnections; int nBytes = sizeof( struct pollfd )*(nConnectionsBefore+1); - pLocalFD = static_cast<struct pollfd*>(rtl_allocateMemory( nBytes )); + pLocalFD = static_cast<struct pollfd*>(std::malloc( nBytes )); memcpy( pLocalFD, pThis->m_pFilehandles, nBytes ); } int nRet = poll( pLocalFD,nConnectionsBefore+1,-1 ); bool bWakeup = (pLocalFD[0].revents & POLLIN); - rtl_freeMemory( pLocalFD ); + std::free( pLocalFD ); if( nRet < 1 ) continue; @@ -774,8 +774,8 @@ void ICEWatchProc( SAL_INFO("vcl.sm.debug", " opening"); int fd = IceConnectionNumber( ice_conn ); pThis->m_nConnections++; - pThis->m_pConnections = static_cast<IceConn*>(rtl_reallocateMemory( pThis->m_pConnections, sizeof( IceConn )*pThis->m_nConnections )); - pThis->m_pFilehandles = static_cast<struct pollfd*>(rtl_reallocateMemory( pThis->m_pFilehandles, sizeof( struct pollfd )*(pThis->m_nConnections+1) )); + pThis->m_pConnections = static_cast<IceConn*>(std::realloc( pThis->m_pConnections, sizeof( IceConn )*pThis->m_nConnections )); + pThis->m_pFilehandles = static_cast<struct pollfd*>(std::realloc( pThis->m_pFilehandles, sizeof( struct pollfd )*(pThis->m_nConnections+1) )); pThis->m_pConnections[ pThis->m_nConnections-1 ] = ice_conn; pThis->m_pFilehandles[ pThis->m_nConnections ].fd = fd; pThis->m_pFilehandles[ pThis->m_nConnections ].events = POLLIN; @@ -827,8 +827,8 @@ void ICEWatchProc( memmove( pThis->m_pFilehandles+i+1, pThis->m_pFilehandles+i+2, sizeof( struct pollfd )*(pThis->m_nConnections-i-1) ); } pThis->m_nConnections--; - pThis->m_pConnections = static_cast<IceConn*>(rtl_reallocateMemory( pThis->m_pConnections, sizeof( IceConn )*pThis->m_nConnections )); - pThis->m_pFilehandles = static_cast<struct pollfd*>(rtl_reallocateMemory( pThis->m_pFilehandles, sizeof( struct pollfd )*(pThis->m_nConnections+1) )); + pThis->m_pConnections = static_cast<IceConn*>(std::realloc( pThis->m_pConnections, sizeof( IceConn )*pThis->m_nConnections )); + pThis->m_pFilehandles = static_cast<struct pollfd*>(std::realloc( pThis->m_pFilehandles, sizeof( struct pollfd )*(pThis->m_nConnections+1) )); break; } } diff --git a/vcl/unx/generic/dtrans/bmp.cxx b/vcl/unx/generic/dtrans/bmp.cxx index b6b5d1888aa1..8b7f342bfbb6 100644 --- a/vcl/unx/generic/dtrans/bmp.cxx +++ b/vcl/unx/generic/dtrans/bmp.cxx @@ -352,7 +352,7 @@ sal_uInt8* x11::X11_getBmpFromPixmap( void x11::X11_freeBmp( sal_uInt8* pBmp ) { - rtl_freeMemory( pBmp ); + std::free( pBmp ); } /* @@ -692,7 +692,7 @@ Pixmap PixmapHolder::setBitmapData( const sal_uInt8* pData ) aImage.obdata = nullptr; XInitImage( &aImage ); - aImage.data = static_cast<char*>(rtl_allocateMemory( nHeight*aImage.bytes_per_line )); + aImage.data = static_cast<char*>(std::malloc( nHeight*aImage.bytes_per_line )); if( readLE32( pData+14 ) == 24 ) { @@ -714,7 +714,7 @@ Pixmap PixmapHolder::setBitmapData( const sal_uInt8* pData ) nWidth, nHeight ); // clean up - rtl_freeMemory( aImage.data ); + std::free( aImage.data ); // prepare bitmap (mask) m_aBitmap = limitXCreatePixmap( m_pDisplay, diff --git a/vcl/unx/generic/print/genprnpsp.cxx b/vcl/unx/generic/print/genprnpsp.cxx index 0285449a124a..45ce18e4a09d 100644 --- a/vcl/unx/generic/print/genprnpsp.cxx +++ b/vcl/unx/generic/print/genprnpsp.cxx @@ -224,7 +224,7 @@ static void copyJobDataToJobSetup( ImplJobSetup* pJobSetup, JobData& rData ) // copy the whole context if( pJobSetup->GetDriverData() ) - rtl_freeMemory( const_cast<sal_uInt8*>(pJobSetup->GetDriverData()) ); + std::free( const_cast<sal_uInt8*>(pJobSetup->GetDriverData()) ); sal_uInt32 nBytes; void* pBuffer = nullptr; @@ -538,7 +538,7 @@ bool PspSalInfoPrinter::Setup( weld::Window* pFrame, ImplJobSetup* pJobSetup ) if (SetupPrinterDriver(pFrame, aInfo)) { aInfo.resolveDefaultBackend(); - rtl_freeMemory( const_cast<sal_uInt8*>(pJobSetup->GetDriverData()) ); + std::free( const_cast<sal_uInt8*>(pJobSetup->GetDriverData()) ); pJobSetup->SetDriverData( nullptr ); sal_uInt32 nBytes; diff --git a/vcl/unx/generic/printer/jobdata.cxx b/vcl/unx/generic/printer/jobdata.cxx index 8d3ae1cf9801..28772c99db13 100644 --- a/vcl/unx/generic/printer/jobdata.cxx +++ b/vcl/unx/generic/printer/jobdata.cxx @@ -180,7 +180,7 @@ bool JobData::getStreamBuffer( void*& pData, sal_uInt32& bytes ) // success bytes = static_cast<sal_uInt32>(aStream.Tell()); - pData = rtl_allocateMemory( bytes ); + pData = std::malloc( bytes ); memcpy( pData, aStream.GetData(), bytes ); return true; } diff --git a/vcl/win/gdi/salprn.cxx b/vcl/win/gdi/salprn.cxx index 2cf633fb3ade..4e2b7788ce05 100644 --- a/vcl/win/gdi/salprn.cxx +++ b/vcl/win/gdi/salprn.cxx @@ -158,7 +158,7 @@ void WinSalInstance::GetPrinterQueueInfo( ImplPrnQueueList* pList ) EnumPrintersW( PRINTER_ENUM_LOCAL | PRINTER_ENUM_CONNECTIONS, nullptr, 4, nullptr, 0, &nBytes, &nInfoPrn4 ); if ( nBytes ) { - PRINTER_INFO_4W* pWinInfo4 = static_cast<PRINTER_INFO_4W*>(rtl_allocateMemory( nBytes )); + PRINTER_INFO_4W* pWinInfo4 = static_cast<PRINTER_INFO_4W*>(std::malloc( nBytes )); if ( EnumPrintersW( PRINTER_ENUM_LOCAL | PRINTER_ENUM_CONNECTIONS, nullptr, 4, reinterpret_cast<LPBYTE>(pWinInfo4), nBytes, &nBytes, &nInfoPrn4 ) ) { for ( i = 0; i < nInfoPrn4; i++ ) @@ -170,7 +170,7 @@ void WinSalInstance::GetPrinterQueueInfo( ImplPrnQueueList* pList ) pList->Add( pInfo ); } } - rtl_freeMemory( pWinInfo4 ); + std::free( pWinInfo4 ); } } @@ -184,7 +184,7 @@ void WinSalInstance::GetPrinterQueueState( SalPrinterQueueInfo* pInfo ) GetPrinterW( hPrinter, 2, nullptr, 0, &nBytes ); if( nBytes ) { - PRINTER_INFO_2W* pWinInfo2 = static_cast<PRINTER_INFO_2W*>(rtl_allocateMemory(nBytes)); + PRINTER_INFO_2W* pWinInfo2 = static_cast<PRINTER_INFO_2W*>(std::malloc(nBytes)); if( GetPrinterW( hPrinter, 2, reinterpret_cast<LPBYTE>(pWinInfo2), nBytes, &nBytes ) ) { if( pWinInfo2->pDriverName ) @@ -205,7 +205,7 @@ void WinSalInstance::GetPrinterQueueState( SalPrinterQueueInfo* pInfo ) if( ! pInfo->mpPortName ) pInfo->mpPortName.reset(new OUString(aPortName)); } - rtl_freeMemory(pWinInfo2); + std::free(pWinInfo2); } ClosePrinter( hPrinter ); } @@ -222,13 +222,13 @@ OUString WinSalInstance::GetDefaultPrinter() GetDefaultPrinterW( nullptr, &nChars ); if( nChars ) { - LPWSTR pStr = static_cast<LPWSTR>(rtl_allocateMemory(nChars*sizeof(WCHAR))); + LPWSTR pStr = static_cast<LPWSTR>(std::malloc(nChars*sizeof(WCHAR))); OUString aDefPrt; if( GetDefaultPrinterW( pStr, &nChars ) ) { aDefPrt = o3tl::toU(pStr); } - rtl_freeMemory( pStr ); + std::free( pStr ); if( !aDefPrt.isEmpty() ) return aDefPrt; } @@ -337,7 +337,7 @@ static bool ImplTestSalJobSetup( WinSalInfoPrinter const * pPrinter, } if ( bDelete ) { - rtl_freeMemory( const_cast<sal_uInt8*>(pSetupData->GetDriverData()) ); + std::free( const_cast<sal_uInt8*>(pSetupData->GetDriverData()) ); pSetupData->SetDriverData( nullptr ); pSetupData->SetDriverDataLen( 0 ); } @@ -411,7 +411,7 @@ static bool ImplUpdateSalJobSetup( WinSalInfoPrinter const * pPrinter, ImplJobSe if( (nRet < 0) || (pVisibleDlgParent && (nRet == IDCANCEL)) ) { - rtl_freeMemory( pOutBuffer ); + std::free( pOutBuffer ); return FALSE; } @@ -431,7 +431,7 @@ static bool ImplUpdateSalJobSetup( WinSalInfoPrinter const * pPrinter, ImplJobSe // update data if ( pSetupData->GetDriverData() ) - rtl_freeMemory( const_cast<sal_uInt8*>(pSetupData->GetDriverData()) ); + std::free( const_cast<sal_uInt8*>(pSetupData->GetDriverData()) ); pSetupData->SetDriverDataLen( nDriverDataLen ); pSetupData->SetDriverData(reinterpret_cast<BYTE*>(pOutBuffer)); pSetupData->SetSystem( JOBSETUP_SYSTEM_WINDOWS ); @@ -478,7 +478,7 @@ static void ImplDevModeToJobSetup( WinSalInfoPrinter const * pPrinter, ImplJobSe } } - rtl_freeMemory( pBins ); + std::free( pBins ); } } @@ -519,9 +519,9 @@ static void ImplDevModeToJobSetup( WinSalInfoPrinter const * pPrinter, ImplJobSe } } if( pPapers ) - rtl_freeMemory( pPapers ); + std::free( pPapers ); if( pPaperSizes ) - rtl_freeMemory( pPaperSizes ); + std::free( pPaperSizes ); } switch( pDevModeW->dmPaperSize ) { @@ -737,7 +737,7 @@ static void ImplJobSetupToDevMode( WinSalInfoPrinter const * pPrinter, const Imp ImplDeviceCaps( pPrinter, DC_BINS, reinterpret_cast<BYTE*>(pBins), pSetupData ); pDevModeW->dmFields |= DM_DEFAULTSOURCE; pDevModeW->dmDefaultSource = pBins[ pSetupData->GetPaperBin() ]; - rtl_freeMemory( pBins ); + std::free( pBins ); } } @@ -961,9 +961,9 @@ static void ImplJobSetupToDevMode( WinSalInfoPrinter const * pPrinter, const Imp } if ( pPapers ) - rtl_freeMemory(pPapers); + std::free(pPapers); if ( pPaperSizes ) - rtl_freeMemory(pPaperSizes); + std::free(pPaperSizes); break; } @@ -1122,15 +1122,15 @@ void WinSalInfoPrinter::InitPaperFormats( const ImplJobSetup* pSetupData ) POINT* pPaperSizes = static_cast<POINT*>(rtl_allocateZeroMemory(nCount*sizeof(POINT))); ImplDeviceCaps( this, DC_PAPERSIZE, reinterpret_cast<BYTE*>(pPaperSizes), pSetupData ); - sal_Unicode* pNamesBuffer = static_cast<sal_Unicode*>(rtl_allocateMemory(nCount*64*sizeof(sal_Unicode))); + sal_Unicode* pNamesBuffer = static_cast<sal_Unicode*>(std::malloc(nCount*64*sizeof(sal_Unicode))); ImplDeviceCaps( this, DC_PAPERNAMES, reinterpret_cast<BYTE*>(pNamesBuffer), pSetupData ); for( DWORD i = 0; i < nCount; ++i ) { PaperInfo aInfo(pPaperSizes[i].x * 10, pPaperSizes[i].y * 10); m_aPaperFormats.push_back( aInfo ); } - rtl_freeMemory( pNamesBuffer ); - rtl_freeMemory( pPaperSizes ); + std::free( pNamesBuffer ); + std::free( pPaperSizes ); } m_bPapersInit = true; @@ -1320,7 +1320,7 @@ static DEVMODEW const * ImplSalSetCopies( DEVMODEW const * pDevMode, sal_uLong n if ( nCopies > 32765 ) nCopies = 32765; sal_uLong nDevSize = pDevMode->dmSize+pDevMode->dmDriverExtra; - LPDEVMODEW pNewDevMode = static_cast<LPDEVMODEW>(rtl_allocateMemory( nDevSize )); + LPDEVMODEW pNewDevMode = static_cast<LPDEVMODEW>(std::malloc( nDevSize )); memcpy( pNewDevMode, pDevMode, nDevSize ); pNewDevMode->dmFields |= DM_COPIES; pNewDevMode->dmCopies = static_cast<short>(static_cast<sal_uInt16>(nCopies)); @@ -1436,7 +1436,7 @@ bool WinSalPrinter::StartJob( const OUString* pFileName, pDevModeW ); if ( pDevModeW != pOrgDevModeW ) - rtl_freeMemory( const_cast<DEVMODEW *>(pDevModeW) ); + std::free( const_cast<DEVMODEW *>(pDevModeW) ); if ( !hDC ) { @@ -1565,7 +1565,7 @@ SalGraphics* WinSalPrinter::StartPage( ImplJobSetup* pSetupData, bool bNewJobDat pDevModeW = ImplSalSetCopies( pOrgDevModeW, mnCopies, mbCollate ); ResetDCW( hDC, pDevModeW ); if ( pDevModeW != pOrgDevModeW ) - rtl_freeMemory( const_cast<DEVMODEW *>(pDevModeW) ); + std::free( const_cast<DEVMODEW *>(pDevModeW) ); } volatile int nRet = 0; CATCH_DRIVER_EX_BEGIN; |