Avoid possible resource leaks by boost::scoped_array
Change-Id: I0da7f9621d2770f49a554fb97591d9cac0bde9be
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
#include <vcl/svapp.hxx>
|
||||
#include <vcl/alpha.hxx>
|
||||
#include <osl/endian.h>
|
||||
#include <boost/scoped_array.hpp>
|
||||
|
||||
#define PNG_DEF_COMPRESSION 6
|
||||
|
||||
@@ -308,8 +309,8 @@ bool PNGWriterImpl::ImplWriteHeader()
|
||||
void PNGWriterImpl::ImplWritePalette()
|
||||
{
|
||||
const sal_uLong nCount = mpAccess->GetPaletteEntryCount();
|
||||
sal_uInt8* pTempBuf = new sal_uInt8[ nCount*3 ];
|
||||
sal_uInt8* pTmp = pTempBuf;
|
||||
boost::scoped_array<sal_uInt8> pTempBuf(new sal_uInt8[ nCount*3 ]);
|
||||
sal_uInt8* pTmp = pTempBuf.get();
|
||||
|
||||
ImplOpenChunk( PNGCHUNK_PLTE );
|
||||
|
||||
@@ -320,9 +321,8 @@ void PNGWriterImpl::ImplWritePalette()
|
||||
*pTmp++ = rColor.GetGreen();
|
||||
*pTmp++ = rColor.GetBlue();
|
||||
}
|
||||
ImplWriteChunk( pTempBuf, nCount*3 );
|
||||
ImplWriteChunk( pTempBuf.get(), nCount*3 );
|
||||
ImplCloseChunk();
|
||||
delete[] pTempBuf;
|
||||
}
|
||||
|
||||
void PNGWriterImpl::ImplWriteTransparent ()
|
||||
|
@@ -40,7 +40,7 @@
|
||||
#include <salprn.hxx>
|
||||
#include <svdata.hxx>
|
||||
#include <outdata.hxx>
|
||||
|
||||
#include <boost/scoped_array.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
|
||||
#include "basegfx/polygon/b2dpolygon.hxx"
|
||||
@@ -414,10 +414,9 @@ void SalGraphics::DrawPolyLine( sal_uInt32 nPoints, const SalPoint* pPtAry, cons
|
||||
{
|
||||
if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) )
|
||||
{
|
||||
SalPoint* pPtAry2 = new SalPoint[nPoints];
|
||||
bool bCopied = mirror( nPoints, pPtAry, pPtAry2, pOutDev );
|
||||
drawPolyLine( nPoints, bCopied ? pPtAry2 : pPtAry );
|
||||
delete [] pPtAry2;
|
||||
boost::scoped_array<SalPoint> pPtAry2(new SalPoint[nPoints]);
|
||||
bool bCopied = mirror( nPoints, pPtAry, pPtAry2.get(), pOutDev );
|
||||
drawPolyLine( nPoints, bCopied ? pPtAry2.get() : pPtAry );
|
||||
}
|
||||
else
|
||||
drawPolyLine( nPoints, pPtAry );
|
||||
@@ -427,10 +426,9 @@ void SalGraphics::DrawPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry, const
|
||||
{
|
||||
if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) )
|
||||
{
|
||||
SalPoint* pPtAry2 = new SalPoint[nPoints];
|
||||
bool bCopied = mirror( nPoints, pPtAry, pPtAry2, pOutDev );
|
||||
drawPolygon( nPoints, bCopied ? pPtAry2 : pPtAry );
|
||||
delete [] pPtAry2;
|
||||
boost::scoped_array<SalPoint> pPtAry2(new SalPoint[nPoints]);
|
||||
bool bCopied = mirror( nPoints, pPtAry, pPtAry2.get(), pOutDev );
|
||||
drawPolygon( nPoints, bCopied ? pPtAry2.get() : pPtAry );
|
||||
}
|
||||
else
|
||||
drawPolygon( nPoints, pPtAry );
|
||||
@@ -478,10 +476,9 @@ bool SalGraphics::DrawPolyLineBezier( sal_uInt32 nPoints, const SalPoint* pPtAry
|
||||
bool bResult = false;
|
||||
if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) )
|
||||
{
|
||||
SalPoint* pPtAry2 = new SalPoint[nPoints];
|
||||
bool bCopied = mirror( nPoints, pPtAry, pPtAry2, pOutDev );
|
||||
bResult = drawPolyLineBezier( nPoints, bCopied ? pPtAry2 : pPtAry, pFlgAry );
|
||||
delete [] pPtAry2;
|
||||
boost::scoped_array<SalPoint> pPtAry2(new SalPoint[nPoints]);
|
||||
bool bCopied = mirror( nPoints, pPtAry, pPtAry2.get(), pOutDev );
|
||||
bResult = drawPolyLineBezier( nPoints, bCopied ? pPtAry2.get() : pPtAry, pFlgAry );
|
||||
}
|
||||
else
|
||||
bResult = drawPolyLineBezier( nPoints, pPtAry, pFlgAry );
|
||||
@@ -493,10 +490,9 @@ bool SalGraphics::DrawPolygonBezier( sal_uInt32 nPoints, const SalPoint* pPtAry,
|
||||
bool bResult = false;
|
||||
if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) )
|
||||
{
|
||||
SalPoint* pPtAry2 = new SalPoint[nPoints];
|
||||
bool bCopied = mirror( nPoints, pPtAry, pPtAry2, pOutDev );
|
||||
bResult = drawPolygonBezier( nPoints, bCopied ? pPtAry2 : pPtAry, pFlgAry );
|
||||
delete [] pPtAry2;
|
||||
boost::scoped_array<SalPoint> pPtAry2(new SalPoint[nPoints]);
|
||||
bool bCopied = mirror( nPoints, pPtAry, pPtAry2.get(), pOutDev );
|
||||
bResult = drawPolygonBezier( nPoints, bCopied ? pPtAry2.get() : pPtAry, pFlgAry );
|
||||
}
|
||||
else
|
||||
bResult = drawPolygonBezier( nPoints, pPtAry, pFlgAry );
|
||||
@@ -644,10 +640,9 @@ void SalGraphics::Invert( sal_uInt32 nPoints, const SalPoint* pPtAry, SalInvert
|
||||
{
|
||||
if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) )
|
||||
{
|
||||
SalPoint* pPtAry2 = new SalPoint[nPoints];
|
||||
bool bCopied = mirror( nPoints, pPtAry, pPtAry2, pOutDev );
|
||||
invert( nPoints, bCopied ? pPtAry2 : pPtAry, nFlags );
|
||||
delete [] pPtAry2;
|
||||
boost::scoped_array<SalPoint> pPtAry2(new SalPoint[nPoints]);
|
||||
bool bCopied = mirror( nPoints, pPtAry, pPtAry2.get(), pOutDev );
|
||||
invert( nPoints, bCopied ? pPtAry2.get() : pPtAry, nFlags );
|
||||
}
|
||||
else
|
||||
invert( nPoints, pPtAry, nFlags );
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#include <vcl/bmpacc.hxx>
|
||||
#include <vcl/salbtype.hxx>
|
||||
#include <bmpfast.hxx>
|
||||
#include <boost/scoped_array.hpp>
|
||||
|
||||
#define IMPL_CASE_GET_FORMAT( Format ) \
|
||||
case( BMP_FORMAT##Format ): \
|
||||
@@ -217,7 +218,7 @@ static void ImplTCToPAL( const BitmapBuffer& rSrcBuffer, BitmapBuffer& rDstBuffe
|
||||
const ColorMask& rSrcMask = rSrcBuffer.maColorMask;
|
||||
const ColorMask& rDstMask = rDstBuffer.maColorMask;
|
||||
BitmapPalette aColMap( rSrcBuffer.maPalette.GetEntryCount() );
|
||||
sal_uInt8* pColToPalMap = new sal_uInt8[ TC_TO_PAL_COLORS ];
|
||||
boost::scoped_array<sal_uInt8> pColToPalMap(new sal_uInt8[ TC_TO_PAL_COLORS ]);
|
||||
BitmapColor aIndex( 0 );
|
||||
|
||||
for( long nR = 0; nR < 16; nR++ )
|
||||
@@ -246,8 +247,6 @@ static void ImplTCToPAL( const BitmapBuffer& rSrcBuffer, BitmapBuffer& rDstBuffe
|
||||
|
||||
DOUBLE_SCANLINES();
|
||||
}
|
||||
|
||||
delete[] pColToPalMap;
|
||||
}
|
||||
|
||||
BitmapBuffer* StretchAndConvert(
|
||||
|
@@ -32,6 +32,8 @@
|
||||
#include <rtl/strbuf.hxx>
|
||||
#endif
|
||||
|
||||
#include <boost/scoped_array.hpp>
|
||||
|
||||
namespace vcl
|
||||
{
|
||||
|
||||
@@ -222,10 +224,10 @@ namespace vcl
|
||||
return;
|
||||
}
|
||||
|
||||
sal_Int32* pCharWidths = new sal_Int32[ _nLength ];
|
||||
long nTextWidth = GetTextArray( _rText, pCharWidths, _nStartIndex, _nLength );
|
||||
m_rTargetDevice.DrawTextArray( _rStartPoint, _rText, pCharWidths, _nStartIndex, _nLength );
|
||||
delete[] pCharWidths;
|
||||
boost::scoped_array<sal_Int32> pCharWidths(new sal_Int32[ _nLength ]);
|
||||
long nTextWidth = GetTextArray( _rText, pCharWidths.get(), _nStartIndex, _nLength );
|
||||
m_rTargetDevice.DrawTextArray( _rStartPoint, _rText, pCharWidths.get(), _nStartIndex, _nLength );
|
||||
pCharWidths.reset();
|
||||
|
||||
m_aCompleteTextRect.Union( Rectangle( _rStartPoint, Size( nTextWidth, m_rTargetDevice.GetTextHeight() ) ) );
|
||||
}
|
||||
|
Reference in New Issue
Block a user