From 37f9fdc11c4e95d6a34cb515a454503256a82c63 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 28 Aug 2018 09:09:33 +0200 Subject: 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 --- vcl/headless/svpprn.cxx | 2 +- vcl/osx/salprn.cxx | 6 +++--- vcl/qt5/Qt5Instance_Print.cxx | 2 +- vcl/quartz/salbmp.cxx | 6 +++--- vcl/quartz/salvd.cxx | 8 +++---- vcl/quartz/utils.cxx | 4 ++-- vcl/source/filter/igif/decode.cxx | 6 +++--- vcl/source/filter/igif/gifread.cxx | 2 +- vcl/source/fontsubset/list.cxx | 11 +++++----- vcl/source/gdi/impvect.cxx | 6 +++--- vcl/source/gdi/jobset.cxx | 6 +++--- vcl/source/gdi/octree.cxx | 8 +++---- vcl/source/gdi/pdfwriter_impl.cxx | 2 +- vcl/source/gdi/pdfwriter_impl2.cxx | 7 +++---- vcl/source/gdi/print.cxx | 2 +- vcl/unx/generic/app/sm.cxx | 12 +++++------ vcl/unx/generic/dtrans/bmp.cxx | 6 +++--- vcl/unx/generic/print/genprnpsp.cxx | 4 ++-- vcl/unx/generic/printer/jobdata.cxx | 2 +- vcl/win/gdi/salprn.cxx | 42 ++++++++++++++++++------------------- 20 files changed, 72 insertions(+), 72 deletions(-) (limited to 'vcl') 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(pJobSetup->GetDriverData()) ); + std::free( const_cast(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(rtl_allocateMemory(nWidth * 4 * nHeight)), - &rtl_freeMemory); + mpContextMemory.reset(static_cast(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(rtl_allocateMemory( 4 )) ); + io_pSetupData->SetDriverData( static_cast(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(pJobSetup->GetDriverData())); + std::free(const_cast(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(data) ); + std::free( const_cast(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( rtl_allocateMemory( nHeight * nDestBytesPerRow ) ); + sal_uInt32* pMaskBuffer = static_cast( 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(pConstStr), nLength ); } - UniChar* pStr = static_cast( rtl_allocateMemory( sizeof(UniChar)*nLength ) ); + UniChar* pStr = static_cast( std::malloc( sizeof(UniChar)*nLength ) ); CFRange aRange = { 0, nLength }; CFStringGetCharacters( rStr, aRange, pStr ); OUString aRet( reinterpret_cast(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(rtl_allocateMemory( nTargetSize )); + sal_uInt8* pTarget = static_cast(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(rtl_allocateMemory( nNewSize )); + sal_uInt8* pTmp = static_cast(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 #include +#include #include "list.h" @@ -49,7 +50,7 @@ struct list_ { static lnode *newNode(void *el) { - lnode *ptr = static_cast(rtl_allocateMemory(sizeof(lnode))); + lnode *ptr = static_cast(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(rtl_allocateMemory(sizeof(struct list_))); + list pThis = static_cast(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(rtl_allocateZeroMemory(nWidth * nHeight)) ), - mpScan ( static_cast(rtl_allocateMemory(nHeight * sizeof(Scanline))) ), + mpScan ( static_cast(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(rtl_allocateMemory( mnDriverDataLen )); + mpDriverData = static_cast(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( - 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(rtl_allocateMemory( nCount )); + pMap = static_cast(std::malloc( nCount )); memset( pMap, 0x00, nCount ); - pBuffer = static_cast(rtl_allocateMemory( nSize )); + pBuffer = static_cast(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(rtl_reallocateMemory( m_pEncryptionBuffer, newSize )); + /* reallocate the buffer */ + m_pEncryptionBuffer = static_cast(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(rData.GetDriverData()) ); + std::free( const_cast(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(rtl_allocateMemory( nBytes )); + pLocalFD = static_cast(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(rtl_reallocateMemory( pThis->m_pConnections, sizeof( IceConn )*pThis->m_nConnections )); - pThis->m_pFilehandles = static_cast(rtl_reallocateMemory( pThis->m_pFilehandles, sizeof( struct pollfd )*(pThis->m_nConnections+1) )); + pThis->m_pConnections = static_cast(std::realloc( pThis->m_pConnections, sizeof( IceConn )*pThis->m_nConnections )); + pThis->m_pFilehandles = static_cast(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(rtl_reallocateMemory( pThis->m_pConnections, sizeof( IceConn )*pThis->m_nConnections )); - pThis->m_pFilehandles = static_cast(rtl_reallocateMemory( pThis->m_pFilehandles, sizeof( struct pollfd )*(pThis->m_nConnections+1) )); + pThis->m_pConnections = static_cast(std::realloc( pThis->m_pConnections, sizeof( IceConn )*pThis->m_nConnections )); + pThis->m_pFilehandles = static_cast(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(rtl_allocateMemory( nHeight*aImage.bytes_per_line )); + aImage.data = static_cast(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(pJobSetup->GetDriverData()) ); + std::free( const_cast(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(pJobSetup->GetDriverData()) ); + std::free( const_cast(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(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(rtl_allocateMemory( nBytes )); + PRINTER_INFO_4W* pWinInfo4 = static_cast(std::malloc( nBytes )); if ( EnumPrintersW( PRINTER_ENUM_LOCAL | PRINTER_ENUM_CONNECTIONS, nullptr, 4, reinterpret_cast(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(rtl_allocateMemory(nBytes)); + PRINTER_INFO_2W* pWinInfo2 = static_cast(std::malloc(nBytes)); if( GetPrinterW( hPrinter, 2, reinterpret_cast(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(rtl_allocateMemory(nChars*sizeof(WCHAR))); + LPWSTR pStr = static_cast(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(pSetupData->GetDriverData()) ); + std::free( const_cast(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(pSetupData->GetDriverData()) ); + std::free( const_cast(pSetupData->GetDriverData()) ); pSetupData->SetDriverDataLen( nDriverDataLen ); pSetupData->SetDriverData(reinterpret_cast(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(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(rtl_allocateZeroMemory(nCount*sizeof(POINT))); ImplDeviceCaps( this, DC_PAPERSIZE, reinterpret_cast(pPaperSizes), pSetupData ); - sal_Unicode* pNamesBuffer = static_cast(rtl_allocateMemory(nCount*64*sizeof(sal_Unicode))); + sal_Unicode* pNamesBuffer = static_cast(std::malloc(nCount*64*sizeof(sal_Unicode))); ImplDeviceCaps( this, DC_PAPERNAMES, reinterpret_cast(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(rtl_allocateMemory( nDevSize )); + LPDEVMODEW pNewDevMode = static_cast(std::malloc( nDevSize )); memcpy( pNewDevMode, pDevMode, nDevSize ); pNewDevMode->dmFields |= DM_COPIES; pNewDevMode->dmCopies = static_cast(static_cast(nCopies)); @@ -1436,7 +1436,7 @@ bool WinSalPrinter::StartJob( const OUString* pFileName, pDevModeW ); if ( pDevModeW != pOrgDevModeW ) - rtl_freeMemory( const_cast(pDevModeW) ); + std::free( const_cast(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(pDevModeW) ); + std::free( const_cast(pDevModeW) ); } volatile int nRet = 0; CATCH_DRIVER_EX_BEGIN; -- cgit v1.2.3