diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-28 09:09:33 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-29 09:05:39 +0200 |
commit | 37f9fdc11c4e95d6a34cb515a454503256a82c63 (patch) | |
tree | 35099c65caf4c62451a5b7a7c0bac249473c9733 /sdext/source | |
parent | 4c91b89d8ce9c34179f31854dc88bd0a9fa84cba (diff) |
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: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sdext/source')
-rw-r--r-- | sdext/source/pdfimport/inc/pdfparse.hxx | 2 | ||||
-rw-r--r-- | sdext/source/pdfimport/pdfparse/pdfentries.cxx | 22 | ||||
-rw-r--r-- | sdext/source/pdfimport/pdfparse/pdfparse.cxx | 4 | ||||
-rw-r--r-- | sdext/source/pdfimport/test/pdfunzip.cxx | 6 |
4 files changed, 17 insertions, 17 deletions
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; } |