[Libreoffice-commits] core.git: filter/source include/filter

Noel Grandin noel.grandin at collabora.co.uk
Mon Jul 10 06:28:05 UTC 2017


 filter/source/graphicfilter/egif/giflzwc.cxx   |    8 -
 filter/source/graphicfilter/icgm/actimpr.cxx   |   13 +--
 filter/source/graphicfilter/icgm/bundles.cxx   |   22 ++---
 filter/source/graphicfilter/icgm/bundles.hxx   |    7 +
 filter/source/graphicfilter/icgm/cgm.cxx       |    6 -
 filter/source/graphicfilter/icgm/cgm.hxx       |    6 -
 filter/source/graphicfilter/icgm/outact.hxx    |    8 +
 filter/source/graphicfilter/idxf/dxfreprd.cxx  |    7 -
 filter/source/graphicfilter/idxf/dxfreprd.hxx  |    7 -
 filter/source/graphicfilter/ipsd/ipsd.cxx      |   23 ++---
 filter/source/graphicfilter/itga/itga.cxx      |   11 +-
 filter/source/graphicfilter/itiff/ccidecom.cxx |   54 +++++-------
 filter/source/graphicfilter/itiff/ccidecom.hxx |   14 +--
 filter/source/graphicfilter/itiff/lzwdecom.cxx |   12 --
 filter/source/graphicfilter/itiff/lzwdecom.hxx |    7 +
 filter/source/msfilter/escherex.cxx            |  104 ++++++++-----------------
 filter/source/msfilter/msdffimp.cxx            |   26 ++----
 filter/source/msfilter/svdfppt.cxx             |   10 --
 include/filter/msfilter/escherex.hxx           |   15 +--
 include/filter/msfilter/msdffimp.hxx           |   10 +-
 include/filter/msfilter/svdfppt.hxx            |    6 -
 21 files changed, 161 insertions(+), 215 deletions(-)

New commits:
commit 19b34f615c04555f27978e2823ba735a9c9f882e
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Fri Jul 7 15:58:40 2017 +0200

    loplugin:useuniqueptr in filter
    
    Change-Id: Ie64ba38d607733b457d66ed1b9af84303c676e13
    Reviewed-on: https://gerrit.libreoffice.org/39695
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/filter/source/graphicfilter/egif/giflzwc.cxx b/filter/source/graphicfilter/egif/giflzwc.cxx
index 3c2a62f46c26..b6d2f8be9b97 100644
--- a/filter/source/graphicfilter/egif/giflzwc.cxx
+++ b/filter/source/graphicfilter/egif/giflzwc.cxx
@@ -20,6 +20,7 @@
 
 #include <tools/stream.hxx>
 #include "giflzwc.hxx"
+#include <array>
 
 
 class GIFImageDataOutputStream
@@ -30,7 +31,8 @@ private:
     inline void FlushBitsBufsFullBytes();
 
     SvStream&   rStream;
-    sal_uInt8*      pBlockBuf;
+    std::array<sal_uInt8, 255>
+                    pBlockBuf;
     sal_uInt8       nBlockBufSize;
     sal_uLong       nBitsBuf;
     sal_uInt16      nBitsBufSize;
@@ -71,7 +73,6 @@ inline void GIFImageDataOutputStream::WriteBits( sal_uInt16 nCode, sal_uInt16 nC
 GIFImageDataOutputStream::GIFImageDataOutputStream( SvStream & rGIF, sal_uInt8 nLZWDataSize ) :
         rStream(rGIF)
 {
-    pBlockBuf = new sal_uInt8[ 255 ];
     nBlockBufSize = 0;
     nBitsBufSize = 0;
     nBitsBuf = 0;
@@ -85,7 +86,6 @@ GIFImageDataOutputStream::~GIFImageDataOutputStream()
     FlushBitsBufsFullBytes();
     FlushBlockBuf();
     rStream.WriteUChar( 0 );
-    delete[] pBlockBuf;
 }
 
 
@@ -94,7 +94,7 @@ void GIFImageDataOutputStream::FlushBlockBuf()
     if( nBlockBufSize )
     {
         rStream.WriteUChar( nBlockBufSize );
-        rStream.WriteBytes(pBlockBuf, nBlockBufSize);
+        rStream.WriteBytes(pBlockBuf.data(), nBlockBufSize);
         nBlockBufSize = 0;
     }
 }
diff --git a/filter/source/graphicfilter/icgm/actimpr.cxx b/filter/source/graphicfilter/icgm/actimpr.cxx
index 88702b5acfb9..7e2e4be00981 100644
--- a/filter/source/graphicfilter/icgm/actimpr.cxx
+++ b/filter/source/graphicfilter/icgm/actimpr.cxx
@@ -59,7 +59,6 @@ CGMImpressOutAct::CGMImpressOutAct( CGM& rCGM, const uno::Reference< frame::XMod
     mpCGM = &rCGM;
     mnCurrentPage = 0;
     mnGroupActCount = mnGroupLevel = 0;
-    mpGroupLevel = new sal_uInt32[CGM_OUTACT_MAX_GROUP_LEVEL] ();
 
     mpGradient = nullptr;
 
@@ -88,8 +87,6 @@ CGMImpressOutAct::CGMImpressOutAct( CGM& rCGM, const uno::Reference< frame::XMod
 
 CGMImpressOutAct::~CGMImpressOutAct()
 {
-    delete[] mpGroupLevel;
-    delete mpGradient;
 }
 
 bool CGMImpressOutAct::ImplInitPage()
@@ -356,7 +353,7 @@ void CGMImpressOutAct::ImplSetTextBundle( const uno::Reference< beans::XProperty
     if ( pFontEntry )
     {
         nFontType = pFontEntry->nFontType;
-        aFontDescriptor.Name = OUString::createFromAscii( reinterpret_cast<char*>(pFontEntry->pFontName) );
+        aFontDescriptor.Name = OUString::createFromAscii( reinterpret_cast<char*>(pFontEntry->pFontName.get()) );
     }
     aFontDescriptor.Height = sal_Int16( mpCGM->pElement->nCharacterHeight * 1.50 );
     if ( nFontType & 1 )
@@ -956,7 +953,7 @@ void CGMImpressOutAct::RegPolyLine( tools::Polygon& rPolygon, bool bReverse )
 void CGMImpressOutAct::SetGradientOffset( long nHorzOfs, long nVertOfs )
 {
     if ( !mpGradient )
-        mpGradient = new awt::Gradient;
+        mpGradient.reset( new awt::Gradient );
     mpGradient->XOffset = ( (sal_uInt16)nHorzOfs & 0x7f );
     mpGradient->YOffset = ( (sal_uInt16)nVertOfs & 0x7f );
 }
@@ -964,14 +961,14 @@ void CGMImpressOutAct::SetGradientOffset( long nHorzOfs, long nVertOfs )
 void CGMImpressOutAct::SetGradientAngle( long nAngle )
 {
     if ( !mpGradient )
-        mpGradient = new awt::Gradient;
+        mpGradient.reset( new awt::Gradient );
     mpGradient->Angle = sal::static_int_cast< sal_Int16 >(nAngle);
 }
 
 void CGMImpressOutAct::SetGradientDescriptor( sal_uInt32 nColorFrom, sal_uInt32 nColorTo )
 {
     if ( !mpGradient )
-        mpGradient = new awt::Gradient;
+        mpGradient.reset( new awt::Gradient );
     mpGradient->StartColor = nColorFrom;
     mpGradient->EndColor = nColorTo;
 }
@@ -979,7 +976,7 @@ void CGMImpressOutAct::SetGradientDescriptor( sal_uInt32 nColorFrom, sal_uInt32
 void CGMImpressOutAct::SetGradientStyle( sal_uInt32 nStyle )
 {
     if ( !mpGradient )
-        mpGradient = new awt::Gradient;
+        mpGradient.reset( new awt::Gradient );
     switch ( nStyle )
     {
         case 0xff :
diff --git a/filter/source/graphicfilter/icgm/bundles.cxx b/filter/source/graphicfilter/icgm/bundles.cxx
index 8381afde0db3..cf4d357ca813 100644
--- a/filter/source/graphicfilter/icgm/bundles.cxx
+++ b/filter/source/graphicfilter/icgm/bundles.cxx
@@ -90,8 +90,6 @@ FontEntry::FontEntry() :
 
 FontEntry::~FontEntry()
 {
-    delete [] pFontName;
-    delete[] pCharSetValue;
 }
 
 CGMFList::CGMFList() :
@@ -119,15 +117,15 @@ CGMFList& CGMFList::operator=( const CGMFList& rSource )
         FontEntry* pCFontEntry = new FontEntry;
         if ( pPtr->pFontName )
         {
-            sal_uInt32 nSize = strlen( reinterpret_cast<char*>(pPtr->pFontName) ) + 1;
-            pCFontEntry->pFontName = new sal_Int8[ nSize ];
-            memcpy( pCFontEntry->pFontName, pPtr->pFontName, nSize );
+            sal_uInt32 nSize = strlen( reinterpret_cast<char*>(pPtr->pFontName.get()) ) + 1;
+            pCFontEntry->pFontName.reset( new sal_Int8[ nSize ] );
+            memcpy( pCFontEntry->pFontName.get(), pPtr->pFontName.get(), nSize );
         }
         if ( pPtr->pCharSetValue )
         {
-            sal_uInt32 nSize = strlen( reinterpret_cast<char*>(pPtr->pCharSetValue) ) + 1;
-            pCFontEntry->pCharSetValue = new sal_Int8[ nSize ];
-            memcpy( pCFontEntry->pCharSetValue, pPtr->pCharSetValue, nSize );
+            sal_uInt32 nSize = strlen( reinterpret_cast<char*>(pPtr->pCharSetValue.get()) ) + 1;
+            pCFontEntry->pCharSetValue.reset( new sal_Int8[ nSize ] );
+            memcpy( pCFontEntry->pCharSetValue.get(), pPtr->pCharSetValue.get(), nSize );
         }
         pCFontEntry->eCharSetType = pPtr->eCharSetType;
         pCFontEntry->nFontType = pPtr->nFontType;
@@ -218,9 +216,9 @@ void CGMFList::InsertName( sal_uInt8* pSource, sal_uInt32 nSize )
         }
         nSize -= nToCopyOfs;
     }
-    pFontEntry->pFontName = new sal_Int8[ nSize + 1 ];
+    pFontEntry->pFontName.reset( new sal_Int8[ nSize + 1 ] );
     pFontEntry->pFontName[ nSize ] = 0;
-    memcpy( pFontEntry->pFontName, pBuf.get(), nSize );
+    memcpy( pFontEntry->pFontName.get(), pBuf.get(), nSize );
 }
 
 
@@ -239,9 +237,9 @@ void CGMFList::InsertCharSet( CharSetType eCharSetType, sal_uInt8* pSource, sal_
     }
     nCharSetCount++;
     pFontEntry->eCharSetType = eCharSetType;
-    pFontEntry->pCharSetValue = new sal_Int8[ nSize + 1 ];
+    pFontEntry->pCharSetValue.reset( new sal_Int8[ nSize + 1 ] );
     pFontEntry->pCharSetValue[ nSize ] = 0;
-    memcpy( pFontEntry->pCharSetValue, pSource , nSize );
+    memcpy( pFontEntry->pCharSetValue.get(), pSource, nSize );
 }
 
 
diff --git a/filter/source/graphicfilter/icgm/bundles.hxx b/filter/source/graphicfilter/icgm/bundles.hxx
index 01e8de584298..99e42d73ceb8 100644
--- a/filter/source/graphicfilter/icgm/bundles.hxx
+++ b/filter/source/graphicfilter/icgm/bundles.hxx
@@ -24,6 +24,7 @@
 #include "cgmtypes.hxx"
 #include <vcl/salbtype.hxx>
 #include <vector>
+#include <memory>
 
 
 class Bundle
@@ -142,9 +143,11 @@ public:
 class FontEntry
 {
 public:
-    sal_Int8*           pFontName;
+    std::unique_ptr<sal_Int8[]>
+                        pFontName;
     CharSetType         eCharSetType;
-    sal_Int8*           pCharSetValue;
+    std::unique_ptr<sal_Int8[]>
+                        pCharSetValue;
     sal_uInt32          nFontType;          // bit 0 = 1 -> Italic,
                                             // bit 1 = 1 -> Bold
 
diff --git a/filter/source/graphicfilter/icgm/cgm.cxx b/filter/source/graphicfilter/icgm/cgm.cxx
index 15ab89778e34..8a7226625beb 100644
--- a/filter/source/graphicfilter/icgm/cgm.cxx
+++ b/filter/source/graphicfilter/icgm/cgm.cxx
@@ -60,7 +60,6 @@ CGM::CGM(uno::Reference< frame::XModel > const & rModel)
     , mpEndValidSource(nullptr)
     , mnParaSize(0)
     , mnActCount(0)
-    , mpBuf(nullptr)
     , mnEscape(0)
     , mnElementClass(0)
     , mnElementID(0)
@@ -89,7 +88,6 @@ CGM::~CGM()
     delete mpOutAct;
     delete pCopyOfE;
     delete pElement;
-    delete [] mpBuf;
 };
 
 sal_uInt32 CGM::GetBackGroundColor()
@@ -680,10 +678,10 @@ void CGM::ImplDefaultReplacement()
 bool CGM::Write( SvStream& rIStm )
 {
     if ( !mpBuf )
-        mpBuf = new sal_uInt8[ 0xffff ];
+        mpBuf.reset( new sal_uInt8[ 0xffff ] );
 
     mnParaSize = 0;
-    mpSource = mpBuf;
+    mpSource = mpBuf.get();
     if (rIStm.ReadBytes(mpSource, 2) != 2)
         return false;
     mpEndValidSource = mpSource + 2;
diff --git a/filter/source/graphicfilter/icgm/cgm.hxx b/filter/source/graphicfilter/icgm/cgm.hxx
index f99c8c798ed8..fb335e09bc0e 100644
--- a/filter/source/graphicfilter/icgm/cgm.hxx
+++ b/filter/source/graphicfilter/icgm/cgm.hxx
@@ -24,6 +24,7 @@
 
 #include <rtl/ustring.hxx>
 #include <vector>
+#include <memory>
 #include <vcl/vclptr.hxx>
 #include "cgmtypes.hxx"
 
@@ -81,8 +82,9 @@ class CGM
         sal_uInt8*              mpEndValidSource; // end position in source buffer of last valid data
         sal_uInt32              mnParaSize;     // actual parameter size which has been done so far
         sal_uInt32              mnActCount;     // increased by each action
-        sal_uInt8*              mpBuf;          // source stream operation -> then this is allocated for
-                                            //                            the temp input buffer
+        std::unique_ptr<sal_uInt8[]>
+                                mpBuf;          // source stream operation -> then this is allocated for
+                                                //                            the temp input buffer
 
         sal_uInt32              mnEscape;
         sal_uInt32              mnElementClass;
diff --git a/filter/source/graphicfilter/icgm/outact.hxx b/filter/source/graphicfilter/icgm/outact.hxx
index badf8362b115..4f03503968a7 100644
--- a/filter/source/graphicfilter/icgm/outact.hxx
+++ b/filter/source/graphicfilter/icgm/outact.hxx
@@ -33,6 +33,8 @@
 #include "cgm.hxx"
 #include <chart.hxx>
 #include <tools/poly.hxx>
+#include <array>
+#include <memory>
 
 class CGM;
 class CGMBitmapDescriptor;
@@ -43,12 +45,14 @@ class CGMImpressOutAct
 
     sal_uInt32                  mnGroupActCount;        // grouping
     sal_uInt32                  mnGroupLevel;
-    sal_uInt32*                 mpGroupLevel;
+    std::array<sal_uInt32, CGM_OUTACT_MAX_GROUP_LEVEL>
+                                mpGroupLevel;
 
     std::vector<PolyFlags>      maFlags;
     std::vector<Point>          maPoints;
     tools::PolyPolygon          maPolyPolygon;
-    css::awt::Gradient*         mpGradient;
+    std::unique_ptr<css::awt::Gradient>
+                                mpGradient;
 
     CGM*                        mpCGM;
 
diff --git a/filter/source/graphicfilter/idxf/dxfreprd.cxx b/filter/source/graphicfilter/idxf/dxfreprd.cxx
index 2bf89b1ddb23..3b59f7f27f0d 100644
--- a/filter/source/graphicfilter/idxf/dxfreprd.cxx
+++ b/filter/source/graphicfilter/idxf/dxfreprd.cxx
@@ -59,10 +59,6 @@ DXFPalette::DXFPalette()
     short i,j,nHue,nNSat,nVal,nC[3],nmax,nmed,nmin;
     sal_uInt8 nV;
 
-    pRed  =new sal_uInt8[256];
-    pGreen=new sal_uInt8[256];
-    pBlue =new sal_uInt8[256];
-
     // colors 0 - 9 (normal colors)
     SetColor(0, 0x00, 0x00, 0x00); // actually never being used
     SetColor(1, 0xff, 0x00, 0x00);
@@ -114,9 +110,6 @@ DXFPalette::DXFPalette()
 
 DXFPalette::~DXFPalette()
 {
-    delete[] pBlue;
-    delete[] pGreen;
-    delete[] pRed;
 }
 
 
diff --git a/filter/source/graphicfilter/idxf/dxfreprd.hxx b/filter/source/graphicfilter/idxf/dxfreprd.hxx
index a24026b45370..2026f04ea7ed 100644
--- a/filter/source/graphicfilter/idxf/dxfreprd.hxx
+++ b/filter/source/graphicfilter/idxf/dxfreprd.hxx
@@ -22,6 +22,7 @@
 
 #include <dxfblkrd.hxx>
 #include <dxftblrd.hxx>
+#include <array>
 
 
 //--------------------Other stuff---------------------------------------------
@@ -58,9 +59,9 @@ public:
     sal_uInt8 GetBlue(sal_uInt8 nIndex) const;
 
 private:
-    sal_uInt8 * pRed;
-    sal_uInt8 * pGreen;
-    sal_uInt8 * pBlue;
+    std::array<sal_uInt8, 256> pRed;
+    std::array<sal_uInt8, 256> pGreen;
+    std::array<sal_uInt8, 256> pBlue;
     void SetColor(sal_uInt8 nIndex, sal_uInt8 nRed, sal_uInt8 nGreen, sal_uInt8 nBlue);
 };
 
diff --git a/filter/source/graphicfilter/ipsd/ipsd.cxx b/filter/source/graphicfilter/ipsd/ipsd.cxx
index c2961acd93a0..41eac7db2a37 100644
--- a/filter/source/graphicfilter/ipsd/ipsd.cxx
+++ b/filter/source/graphicfilter/ipsd/ipsd.cxx
@@ -56,7 +56,8 @@ class PSDReader {
 private:
 
     SvStream& m_rPSD;           // the PSD file to be read in
-    PSDFileHeader*      mpFileHeader;
+    std::unique_ptr<PSDFileHeader>
+                        mpFileHeader;
 
     sal_uInt32          mnXResFixed;
     sal_uInt32          mnYResFixed;
@@ -69,16 +70,16 @@ private:
     BitmapReadAccess*   mpReadAcc;
     BitmapWriteAccess*  mpWriteAcc;
     BitmapWriteAccess*  mpMaskWriteAcc;
-    sal_uInt16              mnDestBitDepth;
+    sal_uInt16          mnDestBitDepth;
     bool                mbCompression;  // RLE decoding
-    sal_uInt8*              mpPalette;
+    std::unique_ptr<sal_uInt8[]>
+                        mpPalette;
 
     bool                ImplReadBody();
     bool                ImplReadHeader();
 
 public:
     explicit PSDReader(SvStream &rStream);
-    ~PSDReader();
     bool ReadPSD(Graphic & rGraphic);
 };
 
@@ -100,12 +101,6 @@ PSDReader::PSDReader(SvStream &rStream)
 {
 }
 
-PSDReader::~PSDReader()
-{
-    delete[] mpPalette;
-    delete mpFileHeader;
-}
-
 bool PSDReader::ReadPSD(Graphic & rGraphic )
 {
     if (m_rPSD.GetError())
@@ -171,7 +166,7 @@ bool PSDReader::ReadPSD(Graphic & rGraphic )
 
 bool PSDReader::ImplReadHeader()
 {
-    mpFileHeader = new PSDFileHeader;
+    mpFileHeader.reset( new PSDFileHeader );
 
     m_rPSD.ReadUInt32( mpFileHeader->nSignature ).ReadUInt16( mpFileHeader->nVersion ).ReadUInt32( mpFileHeader->nPad1 ).        ReadUInt16( mpFileHeader->nPad2 ).ReadUInt16( mpFileHeader->nChannels ).ReadUInt32( mpFileHeader->nRows ).            ReadUInt32( mpFileHeader->nColumns ).ReadUInt16( mpFileHeader->nDepth ).ReadUInt16( mpFileHeader->nMode );
 
@@ -236,8 +231,8 @@ bool PSDReader::ImplReadHeader()
         {
             if ( nColorLength != 768 )      // we need the color map
                 return false;
-            mpPalette = new sal_uInt8[ 768 ];
-            m_rPSD.ReadBytes(mpPalette, 768);
+            mpPalette.reset( new sal_uInt8[ 768 ] );
+            m_rPSD.ReadBytes(mpPalette.get(), 768);
         }
         break;
 
@@ -249,7 +244,7 @@ bool PSDReader::ImplReadHeader()
         {
             if ( nColorLength )
                 return false;
-            mpPalette = new sal_uInt8[ 768 ];
+            mpPalette.reset( new sal_uInt8[ 768 ] );
             for ( sal_uInt16 i = 0; i < 256; i++ )
             {
                 mpPalette[ i ] = mpPalette[ i + 256 ] = mpPalette[ i + 512 ] = (sal_uInt8)i;
diff --git a/filter/source/graphicfilter/itga/itga.cxx b/filter/source/graphicfilter/itga/itga.cxx
index 2663ce5a829f..bb16e1000626 100644
--- a/filter/source/graphicfilter/itga/itga.cxx
+++ b/filter/source/graphicfilter/itga/itga.cxx
@@ -20,6 +20,7 @@
 
 #include <vcl/graph.hxx>
 #include <vcl/bitmapaccess.hxx>
+#include <memory>
 
 class FilterConfigItem;
 
@@ -85,12 +86,13 @@ private:
     TGAFileHeader*      mpFileHeader;
     TGAFileFooter*      mpFileFooter;
     TGAExtension*       mpExtension;
-    sal_uInt32*             mpColorMap;
+    std::unique_ptr<sal_uInt32[]>
+                        mpColorMap;
 
     bool                mbStatus;
 
-    sal_uLong               mnTGAVersion;       // Enhanced TGA is defined as Version 2.0
-    sal_uInt16              mnDestBitDepth;
+    sal_uLong           mnTGAVersion;       // Enhanced TGA is defined as Version 2.0
+    sal_uInt16          mnDestBitDepth;
     bool                mbIndexing;         // sal_True if source contains indexing color values
     bool                mbEncoding;         // sal_True if source is compressed
 
@@ -123,7 +125,6 @@ TGAReader::TGAReader(SvStream &rTGA)
 
 TGAReader::~TGAReader()
 {
-    delete[] mpColorMap;
     delete mpFileHeader;
     delete mpExtension;
     delete mpFileFooter;
@@ -720,7 +721,7 @@ bool TGAReader::ImplReadPalette()
             mpFileHeader->nColorMapLength = 256;
             mpFileHeader->nColorMapEntrySize = 0x3f;    // patch for the following switch routine
         }
-        mpColorMap = new sal_uInt32[ nColors ];     // we will always index dwords
+        mpColorMap.reset( new sal_uInt32[ nColors ] );     // we will always index dwords
 
         switch( mpFileHeader->nColorMapEntrySize )
         {
diff --git a/filter/source/graphicfilter/itiff/ccidecom.cxx b/filter/source/graphicfilter/itiff/ccidecom.cxx
index c567774b8dc7..c119d640e7d4 100644
--- a/filter/source/graphicfilter/itiff/ccidecom.cxx
+++ b/filter/source/graphicfilter/itiff/ccidecom.cxx
@@ -580,7 +580,7 @@ CCIDecompressor::CCIDecompressor( sal_uLong nOpts, sal_uInt32 nImageWidth ) :
 {
     if ( nOpts & CCI_OPTION_INVERSEBITORDER )
     {
-        pByteSwap = new sal_uInt8[ 256 ];
+        pByteSwap.reset( new sal_uInt8[ 256 ] );
         for ( int i = 0; i < 256; i++ )
         {
             pByteSwap[ i ] = sal::static_int_cast< sal_uInt8 >(
@@ -589,26 +589,15 @@ CCIDecompressor::CCIDecompressor( sal_uLong nOpts, sal_uInt32 nImageWidth ) :
         }
     }
 
-    pWhiteLookUp =new CCILookUpTableEntry[1<<13];
-    pBlackLookUp =new CCILookUpTableEntry[1<<13];
-    p2DModeLookUp=new CCILookUpTableEntry[1<<10];
-    pUncompLookUp=new CCILookUpTableEntry[1<<11];
-
-    MakeLookUp(CCIWhiteTable,CCIWhiteTableSave,pWhiteLookUp,CCIWhiteTableSize,13);
-    MakeLookUp(CCIBlackTable,CCIBlackTableSave,pBlackLookUp,CCIBlackTableSize,13);
-    MakeLookUp(CCI2DModeTable,CCI2DModeTableSave,p2DModeLookUp,CCI2DModeTableSize,10);
-    MakeLookUp(CCIUncompTable,CCIUncompTableSave,pUncompLookUp,CCIUncompTableSize,11);
+    MakeLookUp(CCIWhiteTable,CCIWhiteTableSave,pWhiteLookUp.data(),CCIWhiteTableSize,13);
+    MakeLookUp(CCIBlackTable,CCIBlackTableSave,pBlackLookUp.data(),CCIBlackTableSize,13);
+    MakeLookUp(CCI2DModeTable,CCI2DModeTableSave,p2DModeLookUp.data(),CCI2DModeTableSize,10);
+    MakeLookUp(CCIUncompTable,CCIUncompTableSave,pUncompLookUp.data(),CCIUncompTableSize,11);
 }
 
 
 CCIDecompressor::~CCIDecompressor()
 {
-    delete[] pByteSwap;
-    delete[] pLastLine;
-    delete[] pWhiteLookUp;
-    delete[] pBlackLookUp;
-    delete[] p2DModeLookUp;
-    delete[] pUncompLookUp;
 }
 
 
@@ -672,10 +661,9 @@ DecompressStatus CCIDecompressor::DecompressScanline( sal_uInt8 * pTarget, sal_u
     {
         if ( pLastLine == nullptr || nLastLineSize != ( ( nTargetBits + 7 ) >> 3 ) )
         {
-            delete[] pLastLine;
             nLastLineSize = ( nTargetBits + 7 ) >> 3;
-            pLastLine = new sal_uInt8[ nLastLineSize ];
-            memset(pLastLine, 0, nLastLineSize);
+            pLastLine.reset( new sal_uInt8[ nLastLineSize ] );
+            memset(pLastLine.get(), 0, nLastLineSize);
         }
     }
     // conditionally align start of line to next byte:
@@ -704,7 +692,7 @@ DecompressStatus CCIDecompressor::DecompressScanline( sal_uInt8 * pTarget, sal_u
     // if we're in 2D mode we have to remember the line:
     if ( nOptions & CCI_OPTION_2D && bStatus )
     {
-        memcpy(pLastLine, pTarget, nLastLineSize);
+        memcpy(pLastLine.get(), pTarget, nLastLineSize);
     }
 
     // #i122984#
@@ -1030,13 +1018,13 @@ bool CCIDecompressor::Read2DScanlineData(sal_uInt8 * pTarget, sal_uInt16 nTarget
 
     while (nBitPos<nTargetBits && bStatus) {
 
-        n2DMode=ReadCodeAndDecode(p2DModeLookUp,10);
+        n2DMode=ReadCodeAndDecode(p2DModeLookUp.data(),10);
         if (!bStatus)
             return nBitPos == 0;
 
         if (n2DMode==CCI2DMODE_UNCOMP) {
             for (;;) {
-                nUncomp=ReadCodeAndDecode(pUncompLookUp,11);
+                nUncomp=ReadCodeAndDecode(pUncompLookUp.data(),11);
                 if (!bStatus)
                     break;
                 if ( nUncomp <= CCIUNCOMP_4White_1Black ) {
@@ -1061,12 +1049,12 @@ bool CCIDecompressor::Read2DScanlineData(sal_uInt8 * pTarget, sal_uInt16 nTarget
         }
 
         else if (n2DMode==CCI2DMODE_PASS) {
-            if (nBitPos==0 && nBlackOrWhite==0x00 && CountBits(pLastLine,nTargetBits,0,0xff)!=0) nRun=0;
+            if (nBitPos==0 && nBlackOrWhite==0x00 && CountBits(pLastLine.get(), nTargetBits, 0, 0xff)!=0) nRun=0;
             else {
-                nRun=CountBits(pLastLine,nTargetBits,nBitPos,~nBlackOrWhite);
-                nRun = nRun + CountBits(pLastLine,nTargetBits,nBitPos+nRun,nBlackOrWhite);
+                nRun = CountBits(pLastLine.get(), nTargetBits, nBitPos, ~nBlackOrWhite);
+                nRun = nRun + CountBits(pLastLine.get(), nTargetBits, nBitPos + nRun, nBlackOrWhite);
             }
-            nRun = nRun + CountBits(pLastLine,nTargetBits,nBitPos+nRun,~nBlackOrWhite);
+            nRun = nRun + CountBits(pLastLine.get(), nTargetBits, nBitPos + nRun, ~nBlackOrWhite);
             FillBits(pTarget,nTargetBits,nBitPos,nRun,nBlackOrWhite);
             nBitPos = nBitPos + nRun;
         }
@@ -1075,24 +1063,24 @@ bool CCIDecompressor::Read2DScanlineData(sal_uInt8 * pTarget, sal_uInt16 nTarget
             if (nBlackOrWhite==0x00) {
                 nRun=0;
                 do {
-                    nt=ReadCodeAndDecode(pWhiteLookUp,13);
+                    nt=ReadCodeAndDecode(pWhiteLookUp.data(),13);
                     nRun = nRun + nt;
                 } while (nt>=64);
                 nRun2=0;
                 do {
-                    nt=ReadCodeAndDecode(pBlackLookUp,13);
+                    nt=ReadCodeAndDecode(pBlackLookUp.data(),13);
                     nRun2 = nRun2 + nt;
                 } while (nt>=64);
             }
             else {
                 nRun=0;
                 do {
-                    nt=ReadCodeAndDecode(pBlackLookUp,13);
+                    nt=ReadCodeAndDecode(pBlackLookUp.data(),13);
                     nRun = nRun + nt;
                 } while (nt>=64);
                 nRun2=0;
                 do {
-                    nt=ReadCodeAndDecode(pWhiteLookUp,13);
+                    nt=ReadCodeAndDecode(pWhiteLookUp.data(),13);
                     nRun2 = nRun2 + nt;
                 } while (nt>=64);
             }
@@ -1103,10 +1091,10 @@ bool CCIDecompressor::Read2DScanlineData(sal_uInt8 * pTarget, sal_uInt16 nTarget
         }
 
         else { // it's one of the modes CCI2DMODE_VERT_...
-            if (nBitPos==0 && nBlackOrWhite==0x00 && CountBits(pLastLine,nTargetBits,0,0xff)!=0) nRun=0;
+            if (nBitPos==0 && nBlackOrWhite==0x00 && CountBits(pLastLine.get(), nTargetBits, 0, 0xff)!=0) nRun=0;
             else {
-                nRun=CountBits(pLastLine,nTargetBits,nBitPos,~nBlackOrWhite);
-                nRun = nRun + CountBits(pLastLine,nTargetBits,nBitPos+nRun,nBlackOrWhite);
+                nRun = CountBits(pLastLine.get(), nTargetBits, nBitPos, ~nBlackOrWhite);
+                nRun = nRun + CountBits(pLastLine.get(), nTargetBits, nBitPos + nRun, nBlackOrWhite);
             }
             nRun+=n2DMode-CCI2DMODE_VERT_0;
             FillBits(pTarget,nTargetBits,nBitPos,nRun,nBlackOrWhite);
diff --git a/filter/source/graphicfilter/itiff/ccidecom.hxx b/filter/source/graphicfilter/itiff/ccidecom.hxx
index 73a16b7b904b..baed40115c1b 100644
--- a/filter/source/graphicfilter/itiff/ccidecom.hxx
+++ b/filter/source/graphicfilter/itiff/ccidecom.hxx
@@ -22,6 +22,8 @@
 
 #include <sal/types.h>
 #include <tools/solar.h>
+#include <array>
+#include <memory>
 
 #define CCI_OPTION_2D               1       // 2D compression (instead of 1D)
 #define CCI_OPTION_EOL              2       // There are EOL-Codes at the end of each line.
@@ -98,7 +100,7 @@ private:
 
     bool bStatus;
 
-    sal_uInt8* pByteSwap;
+    std::unique_ptr<sal_uInt8[]> pByteSwap;
 
     SvStream * pIStream;
 
@@ -110,15 +112,15 @@ private:
 
     bool bFirstEOL;
 
-    CCILookUpTableEntry * pWhiteLookUp;
-    CCILookUpTableEntry * pBlackLookUp;
-    CCILookUpTableEntry * p2DModeLookUp;
-    CCILookUpTableEntry * pUncompLookUp;
+    std::array<CCILookUpTableEntry, 1<<13> pWhiteLookUp;
+    std::array<CCILookUpTableEntry, 1<<13> pBlackLookUp;
+    std::array<CCILookUpTableEntry, 1<<10> p2DModeLookUp;
+    std::array<CCILookUpTableEntry, 1<<11> pUncompLookUp;
 
     sal_uLong nInputBitsBuf;
     sal_uInt16 nInputBitsBufSize;
 
-    sal_uInt8 * pLastLine;
+    std::unique_ptr<sal_uInt8[]> pLastLine;
     sal_uLong nLastLineSize;
 };
 
diff --git a/filter/source/graphicfilter/itiff/lzwdecom.cxx b/filter/source/graphicfilter/itiff/lzwdecom.cxx
index 3cddf0b40976..7ae157d0ead0 100644
--- a/filter/source/graphicfilter/itiff/lzwdecom.cxx
+++ b/filter/source/graphicfilter/itiff/lzwdecom.cxx
@@ -23,8 +23,6 @@
 #include <algorithm>
 #include <set>
 
-#define MAX_TABLE_SIZE 4096
-
 LZWDecompressor::LZWDecompressor()
     : pIStream(nullptr)
     , nTableSize(0)
@@ -37,11 +35,7 @@ LZWDecompressor::LZWDecompressor()
     , nInputBitsBuf(0)
     , nInputBitsBufSize(0)
 {
-    sal_uInt16 i;
-
-    pTable=new LZWTableEntry[MAX_TABLE_SIZE];
-    pOutBuf=new sal_uInt8[MAX_TABLE_SIZE];
-    for (i=0; i<MAX_TABLE_SIZE; i++)
+    for (sal_uInt16 i=0; i<MAX_TABLE_SIZE; i++)
     {
         pTable[i].nPrevCode=0;
         pTable[i].nDataCount=1;
@@ -52,8 +46,6 @@ LZWDecompressor::LZWDecompressor()
 
 LZWDecompressor::~LZWDecompressor()
 {
-    delete[] pOutBuf;
-    delete[] pTable;
 }
 
 
@@ -214,7 +206,7 @@ void LZWDecompressor::DecompressSome()
     nOldCode=nCode;
 
     nOutBufDataLen=pTable[nCode].nDataCount;
-    pOutBufData=pOutBuf+nOutBufDataLen;
+    pOutBufData=pOutBuf.data()+nOutBufDataLen;
     for (i=0; i<nOutBufDataLen; i++)
     {
         *(--pOutBufData)=pTable[nCode].nData;
diff --git a/filter/source/graphicfilter/itiff/lzwdecom.hxx b/filter/source/graphicfilter/itiff/lzwdecom.hxx
index 85d6f06f677f..c120c2f865e4 100644
--- a/filter/source/graphicfilter/itiff/lzwdecom.hxx
+++ b/filter/source/graphicfilter/itiff/lzwdecom.hxx
@@ -22,6 +22,9 @@
 
 #include <sal/types.h>
 #include <tools/solar.h>
+#include <array>
+
+#define MAX_TABLE_SIZE 4096
 
 struct LZWTableEntry {
     sal_uInt16 nPrevCode;
@@ -52,14 +55,14 @@ private:
 
     SvStream * pIStream;
 
-    LZWTableEntry * pTable;
+    std::array<LZWTableEntry, MAX_TABLE_SIZE> pTable;
     sal_uInt16 nTableSize;
 
     bool bEOIFound, bInvert, bFirst;
 
     sal_uInt16 nOldCode;
 
-    sal_uInt8 * pOutBuf;
+    std::array<sal_uInt8, MAX_TABLE_SIZE> pOutBuf;
     sal_uInt8 * pOutBufData;
     sal_uInt16 nOutBufDataLen;
 
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx
index 674da67383c7..423b5d0ede45 100644
--- a/filter/source/msfilter/escherex.cxx
+++ b/filter/source/msfilter/escherex.cxx
@@ -147,13 +147,12 @@ EscherPropertyContainer::EscherPropertyContainer(
     pGraphicProvider(pGraphProv),
     pPicOutStrm(pPiOutStrm),
     pShapeBoundRect(pBoundRect),
-    nSortCount(0),
-    nSortBufSize(64),
     nCountCount(0),
     nCountSize(0),
-    pSortStruct(new EscherPropSortStruct[nSortBufSize]),
     bHasComplexData(false)
-{}
+{
+    pSortStruct.reserve(64);
+}
 
 EscherPropertyContainer::EscherPropertyContainer()
     : EscherPropertyContainer(nullptr, nullptr, nullptr)
@@ -170,10 +169,10 @@ EscherPropertyContainer::~EscherPropertyContainer()
 {
     if ( bHasComplexData )
     {
+        size_t nSortCount = pSortStruct.size();
         while ( nSortCount-- )
             delete[] pSortStruct[ nSortCount ].pBuf;
     }
-    delete[] pSortStruct;
 };
 
 void EscherPropertyContainer::AddOpt( sal_uInt16 nPropID, sal_uInt32 nPropValue, bool bBlib )
@@ -203,8 +202,7 @@ void EscherPropertyContainer::AddOpt( sal_uInt16 nPropID, bool bBlib, sal_uInt32
     if ( pProp )
         nPropID |= 0x8000;      // fComplex = sal_True;
 
-    sal_uInt32 i;
-    for( i = 0; i < nSortCount; i++ )
+    for( size_t i = 0; i < pSortStruct.size(); i++ )
     {
         if ( ( pSortStruct[ i ].nPropId &~0xc000 ) == ( nPropID &~0xc000 ) )    // check, whether the Property only gets replaced
         {
@@ -224,21 +222,11 @@ void EscherPropertyContainer::AddOpt( sal_uInt16 nPropID, bool bBlib, sal_uInt32
     }
     nCountCount++;
     nCountSize += 6;
-    if ( nSortCount == nSortBufSize )                                           // increase buffer
-    {
-        nSortBufSize <<= 1;
-        EscherPropSortStruct* pTemp = new EscherPropSortStruct[ nSortBufSize ];
-        for( i = 0; i < nSortCount; i++ )
-        {
-            pTemp[ i ] = pSortStruct[ i ];
-        }
-        delete[] pSortStruct;
-        pSortStruct = pTemp;
-    }
-    pSortStruct[ nSortCount ].nPropId = nPropID;                                // insert property
-    pSortStruct[ nSortCount ].pBuf = pProp;
-    pSortStruct[ nSortCount ].nPropSize = nPropSize;
-    pSortStruct[ nSortCount++ ].nPropValue = nPropValue;
+    pSortStruct.emplace_back();
+    pSortStruct.back().nPropId = nPropID;                                // insert property
+    pSortStruct.back().pBuf = pProp;
+    pSortStruct.back().nPropSize = nPropSize;
+    pSortStruct.back().nPropValue = nPropValue;
 
     if ( pProp )
     {
@@ -261,7 +249,7 @@ bool EscherPropertyContainer::GetOpt( sal_uInt16 nPropId, sal_uInt32& rPropValue
 
 bool EscherPropertyContainer::GetOpt( sal_uInt16 nPropId, EscherPropSortStruct& rPropValue ) const
 {
-    for( sal_uInt32 i = 0; i < nSortCount; i++ )
+    for( size_t i = 0; i < pSortStruct.size(); i++ )
     {
         if ( ( pSortStruct[ i ].nPropId &~0xc000 ) == ( nPropId &~0xc000 ) )
         {
@@ -276,7 +264,7 @@ EscherProperties EscherPropertyContainer::GetOpts() const
 {
     EscherProperties aVector;
 
-    for ( sal_uInt32 i = 0; i < nSortCount; ++i )
+    for ( size_t i = 0; i < pSortStruct.size(); ++i )
         aVector.push_back( pSortStruct[ i ] );
 
     return aVector;
@@ -298,12 +286,11 @@ extern "C" int SAL_CALL EscherPropSortFunc( const void* p1, const void* p2 )
 void EscherPropertyContainer::Commit( SvStream& rSt, sal_uInt16 nVersion, sal_uInt16 nRecType )
 {
     rSt.WriteUInt16( ( nCountCount << 4 ) | ( nVersion & 0xf ) ).WriteUInt16( nRecType ).WriteUInt32( nCountSize );
-    if ( nSortCount )
+    if ( !pSortStruct.empty() )
     {
-        qsort( pSortStruct, nSortCount, sizeof( EscherPropSortStruct ), EscherPropSortFunc );
-        sal_uInt32 i;
+        qsort( pSortStruct.data(), pSortStruct.size(), sizeof( EscherPropSortStruct ), EscherPropSortFunc );
 
-        for ( i = 0; i < nSortCount; i++ )
+        for ( size_t i = 0; i < pSortStruct.size(); i++ )
         {
             sal_uInt32 nPropValue = pSortStruct[ i ].nPropValue;
             sal_uInt16 nPropId = pSortStruct[ i ].nPropId;
@@ -313,7 +300,7 @@ void EscherPropertyContainer::Commit( SvStream& rSt, sal_uInt16 nVersion, sal_uI
         }
         if ( bHasComplexData )
         {
-            for ( i = 0; i < nSortCount; i++ )
+            for ( size_t i = 0; i < pSortStruct.size(); i++ )
             {
                 if ( pSortStruct[ i ].pBuf )
                     rSt.WriteBytes(pSortStruct[i].pBuf, pSortStruct[i].nPropSize);
@@ -4056,52 +4043,35 @@ bool EscherBlibEntry::operator==( const EscherBlibEntry& rEscherBlibEntry ) cons
 }
 
 EscherGraphicProvider::EscherGraphicProvider( EscherGraphicProviderFlags nFlags ) :
-    mnFlags         ( nFlags ),
-    mpBlibEntrys    ( nullptr ),
-    mnBlibBufSize   ( 0 ),
-    mnBlibEntrys    ( 0 )
+    mnFlags         ( nFlags )
 {
 }
 
 EscherGraphicProvider::~EscherGraphicProvider()
 {
-    for ( sal_uInt32 i = 0; i < mnBlibEntrys; delete mpBlibEntrys[ i++ ] ) ;
-    delete[] mpBlibEntrys;
 }
 
 void EscherGraphicProvider::SetNewBlipStreamOffset( sal_Int32 nOffset )
 {
-    for( sal_uInt32 i = 0; i < mnBlibEntrys; i++ )
+    for( size_t i = 0; i < mvBlibEntrys.size(); i++ )
     {
-        EscherBlibEntry* pBlibEntry = mpBlibEntrys[ i ];
-        pBlibEntry->mnPictureOffset += nOffset;
+        mvBlibEntrys[ i ]->mnPictureOffset += nOffset;
     }
 }
 
 sal_uInt32 EscherGraphicProvider::ImplInsertBlib( EscherBlibEntry* p_EscherBlibEntry )
 {
-    if ( mnBlibBufSize == mnBlibEntrys )
-    {
-        mnBlibBufSize += 64;
-        EscherBlibEntry** pTemp = new EscherBlibEntry*[ mnBlibBufSize ];
-        for ( sal_uInt32 i = 0; i < mnBlibEntrys; i++ )
-        {
-            pTemp[ i ] = mpBlibEntrys[ i ];
-        }
-        delete[] mpBlibEntrys;
-        mpBlibEntrys = pTemp;
-    }
-    mpBlibEntrys[ mnBlibEntrys++ ] = p_EscherBlibEntry;
-    return mnBlibEntrys;
+    mvBlibEntrys.push_back( std::unique_ptr<EscherBlibEntry>(p_EscherBlibEntry) );
+    return mvBlibEntrys.size();
 }
 
 sal_uInt32 EscherGraphicProvider::GetBlibStoreContainerSize( SvStream* pMergePicStreamBSE ) const
 {
-    sal_uInt32 nSize = 44 * mnBlibEntrys + 8;
+    sal_uInt32 nSize = 44 * mvBlibEntrys.size() + 8;
     if ( pMergePicStreamBSE )
     {
-        for ( sal_uInt32 i = 0; i < mnBlibEntrys; i++ )
-            nSize += mpBlibEntrys[ i ]->mnSize + mpBlibEntrys[ i ]->mnSizeExtra;
+        for ( size_t i = 0; i < mvBlibEntrys.size(); i++ )
+            nSize += mvBlibEntrys[ i ]->mnSize + mvBlibEntrys[ i ]->mnSizeExtra;
     }
     return nSize;
 }
@@ -4109,9 +4079,9 @@ sal_uInt32 EscherGraphicProvider::GetBlibStoreContainerSize( SvStream* pMergePic
 void EscherGraphicProvider::WriteBlibStoreEntry(SvStream& rSt,
     sal_uInt32 nBlipId, sal_uInt32 nResize)
 {
-    if (nBlipId > mnBlibEntrys || nBlipId == 0)
+    if (nBlipId > mvBlibEntrys.size() || nBlipId == 0)
         return;
-    mpBlibEntrys[nBlipId-1]->WriteBlibEntry(rSt, true/*bWritePictureOffSet*/, nResize);
+    mvBlibEntrys[nBlipId-1]->WriteBlibEntry(rSt, true/*bWritePictureOffSet*/, nResize);
 }
 
 void EscherGraphicProvider::WriteBlibStoreContainer( SvStream& rSt, SvStream* pMergePicStreamBSE )
@@ -4124,13 +4094,13 @@ void EscherGraphicProvider::WriteBlibStoreContainer( SvStream& rSt, SvStream* pM
 
         if ( pMergePicStreamBSE )
         {
-            sal_uInt32 i, nBlipSize, nOldPos = pMergePicStreamBSE->Tell();
+            sal_uInt32 nBlipSize, nOldPos = pMergePicStreamBSE->Tell();
             const sal_uInt32 nBuf = 0x40000;    // 256KB buffer
             std::unique_ptr<sal_uInt8[]> pBuf(new sal_uInt8[ nBuf ]);
 
-            for ( i = 0; i < mnBlibEntrys; i++ )
+            for ( size_t i = 0; i < mvBlibEntrys.size(); i++ )
             {
-                EscherBlibEntry* pBlibEntry = mpBlibEntrys[ i ];
+                EscherBlibEntry* pBlibEntry = mvBlibEntrys[ i ].get();
 
                 ESCHER_BlibType nBlibType = pBlibEntry->meBlibType;
                 nBlipSize = pBlibEntry->mnSize + pBlibEntry->mnSizeExtra;
@@ -4165,18 +4135,18 @@ void EscherGraphicProvider::WriteBlibStoreContainer( SvStream& rSt, SvStream* pM
         }
         else
         {
-            for ( sal_uInt32 i = 0; i < mnBlibEntrys; i++ )
-                mpBlibEntrys[ i ]->WriteBlibEntry( rSt, true );
+            for ( size_t i = 0; i < mvBlibEntrys.size(); i++ )
+                mvBlibEntrys[ i ]->WriteBlibEntry( rSt, true );
         }
     }
 }
 
 bool EscherGraphicProvider::GetPrefSize( const sal_uInt32 nBlibId, Size& rPrefSize, MapMode& rPrefMapMode )
 {
-    bool bInRange = nBlibId && ( ( nBlibId - 1 ) < mnBlibEntrys );
+    bool bInRange = nBlibId && ( ( nBlibId - 1 ) < mvBlibEntrys.size() );
     if ( bInRange )
     {
-        EscherBlibEntry* pEntry = mpBlibEntrys[ nBlibId - 1 ];
+        EscherBlibEntry* pEntry = mvBlibEntrys[ nBlibId - 1 ].get();
         rPrefSize = pEntry->maPrefSize;
         rPrefMapMode = pEntry->maPrefMapMode;
     }
@@ -4193,11 +4163,11 @@ sal_uInt32 EscherGraphicProvider::GetBlibID( SvStream& rPicOutStrm, const OStrin
     std::unique_ptr<EscherBlibEntry> p_EscherBlibEntry( new EscherBlibEntry( rPicOutStrm.Tell(), *xGraphicObject, rId, pGraphicAttr ) );
     if ( !p_EscherBlibEntry->IsEmpty() )
     {
-        for ( sal_uInt32 i = 0; i < mnBlibEntrys; i++ )
+        for ( size_t i = 0; i < mvBlibEntrys.size(); i++ )
         {
-            if ( *( mpBlibEntrys[ i ] ) == *p_EscherBlibEntry )
+            if ( *( mvBlibEntrys[ i ] ) == *p_EscherBlibEntry )
             {
-                mpBlibEntrys[ i ]->mnRefCount++;
+                mvBlibEntrys[ i ]->mnRefCount++;
                 return i + 1;
             }
         }
@@ -4317,7 +4287,7 @@ sal_uInt32 EscherGraphicProvider::GetBlibID( SvStream& rPicOutStrm, const OStrin
 
             if ( mnFlags & EscherGraphicProviderFlags::UseInstances )
             {
-                rPicOutStrm.WriteUInt32( 0x7f90000 | (sal_uInt16)( mnBlibEntrys << 4 ) )
+                rPicOutStrm.WriteUInt32( 0x7f90000 | (sal_uInt16)( mvBlibEntrys.size() << 4 ) )
                            .WriteUInt32( 0 );
                 nAtomSize = rPicOutStrm.Tell();
                  if ( eBlibType == PNG )
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 7ab792511e83..a450efb226b9 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -6528,25 +6528,25 @@ bool SvxMSDffManager::ReadCommonRecordHeader(SvStream& rSt,
 }
 
 bool SvxMSDffManager::ProcessClientAnchor(SvStream& rStData, sal_uInt32 nDatLen,
-                                          char*& rpBuff, sal_uInt32& rBuffLen )
+                                          std::unique_ptr<char[]>& rpBuff, sal_uInt32& rBuffLen )
 {
     if( nDatLen )
     {
         rBuffLen = std::min(rStData.remainingSize(), static_cast<sal_uInt64>(nDatLen));
-        rpBuff = new char[rBuffLen];
-        rBuffLen = rStData.ReadBytes(rpBuff, rBuffLen);
+        rpBuff.reset( new char[rBuffLen] );
+        rBuffLen = rStData.ReadBytes(rpBuff.get(), rBuffLen);
     }
     return true;
 }
 
 bool SvxMSDffManager::ProcessClientData(SvStream& rStData, sal_uInt32 nDatLen,
-                                        char*& rpBuff, sal_uInt32& rBuffLen )
+                                        std::unique_ptr<char[]>& rpBuff, sal_uInt32& rBuffLen )
 {
     if( nDatLen )
     {
         rBuffLen = std::min(rStData.remainingSize(), static_cast<sal_uInt64>(nDatLen));
-        rpBuff = new char[rBuffLen];
-        rBuffLen = rStData.ReadBytes(rpBuff, rBuffLen);
+        rpBuff.reset( new char[rBuffLen] );
+        rBuffLen = rStData.ReadBytes(rpBuff.get(), rBuffLen);
     }
     return true;
 }
@@ -7371,9 +7371,9 @@ SvxMSDffImportRec::SvxMSDffImportRec(const SvxMSDffImportRec& rCopy)
     nClientAnchorLen = rCopy.nClientAnchorLen;
     if( rCopy.nClientAnchorLen )
     {
-        pClientAnchorBuffer = new char[ nClientAnchorLen ];
-        memcpy( pClientAnchorBuffer,
-                rCopy.pClientAnchorBuffer,
+        pClientAnchorBuffer.reset( new char[ nClientAnchorLen ] );
+        memcpy( pClientAnchorBuffer.get(),
+                rCopy.pClientAnchorBuffer.get(),
                 nClientAnchorLen );
     }
     else
@@ -7382,9 +7382,9 @@ SvxMSDffImportRec::SvxMSDffImportRec(const SvxMSDffImportRec& rCopy)
     nClientDataLen = rCopy.nClientDataLen;
     if( rCopy.nClientDataLen )
     {
-        pClientDataBuffer = new char[ nClientDataLen ];
-        memcpy( pClientDataBuffer,
-                rCopy.pClientDataBuffer,
+        pClientDataBuffer.reset( new char[ nClientDataLen ] );
+        memcpy( pClientDataBuffer.get(),
+                rCopy.pClientDataBuffer.get(),
                 nClientDataLen );
     }
     else
@@ -7398,8 +7398,6 @@ SvxMSDffImportRec::SvxMSDffImportRec(const SvxMSDffImportRec& rCopy)
 
 SvxMSDffImportRec::~SvxMSDffImportRec()
 {
-    delete[] pClientAnchorBuffer;
-    delete[] pClientDataBuffer;
     delete pWrapPolygon;
     delete pXRelTo;
     delete pYRelTo;
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index b2a7b7b27bfb..b30a00c2bdce 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -520,7 +520,6 @@ PptSlidePersistEntry::~PptSlidePersistEntry()
     delete pStyleSheet;
     delete pHeaderFooterEntry;
     delete pSolverContainer;
-    delete[] pPresentationObjects;
 };
 
 SdrEscherImport::SdrEscherImport( PowerPointImportParam& rParam, const OUString& rBaseURL ) :
@@ -997,8 +996,8 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi
                 {
                     if ( !rPersistEntry.pPresentationObjects )
                     {
-                        rPersistEntry.pPresentationObjects = new sal_uInt32[ PPT_STYLESHEETENTRYS ];
-                        memset( rPersistEntry.pPresentationObjects, 0, PPT_STYLESHEETENTRYS * 4 );
+                        rPersistEntry.pPresentationObjects.reset( new sal_uInt32[ PPT_STYLESHEETENTRYS ] );
+                        memset( rPersistEntry.pPresentationObjects.get(), 0, PPT_STYLESHEETENTRYS * 4 );
                     }
                     if ( !rPersistEntry.pPresentationObjects[ (int)nDestinationInstance ] )
                         rPersistEntry.pPresentationObjects[ (int)nDestinationInstance ] = rObjData.rSpHd.GetRecBegFilePos();
@@ -1355,12 +1354,12 @@ SdrPowerPointImport::SdrPowerPointImport( PowerPointImportParam& rParam, const O
                                                         // we are reading this block later, so we do not have access yet)
 
         if ( bOk && ( nPersistPtrAnz < ( SAL_MAX_UINT32 / sizeof( sal_uInt32 ) ) -1 ) )
-            pPersistPtr = new (std::nothrow) sal_uInt32[ nPersistPtrAnz + 1 ];
+            pPersistPtr.reset( new (std::nothrow) sal_uInt32[ nPersistPtrAnz + 1 ] );
         if ( !pPersistPtr )
             bOk = false;
         if ( bOk )
         {
-            memset( pPersistPtr, 0x00, (nPersistPtrAnz+1) * sizeof(sal_uInt32) );
+            memset( pPersistPtr.get(), 0x00, (nPersistPtrAnz+1) * sizeof(sal_uInt32) );
 
             // SJ: new search mechanism from bottom to top (Issue 21122)
             PptUserEditAtom aCurrentEditAtom( aUserEditAtom );
@@ -1654,7 +1653,6 @@ SdrPowerPointImport::~SdrPowerPointImport()
     delete m_pMasterPages;
     delete m_pSlidePages;
     delete m_pNotePages;
-    delete[] pPersistPtr;
 }
 
 bool PPTConvertOCXControls::ReadOCXStream( tools::SvRef<SotStorage>& rSrc,
diff --git a/include/filter/msfilter/escherex.hxx b/include/filter/msfilter/escherex.hxx
index 47845d2391e5..53ca59a7661d 100644
--- a/include/filter/msfilter/escherex.hxx
+++ b/include/filter/msfilter/escherex.hxx
@@ -559,10 +559,8 @@ class MSFILTER_DLLPUBLIC EscherGraphicProvider
 {
     EscherGraphicProviderFlags
                             mnFlags;
-    EscherBlibEntry**       mpBlibEntrys;
-    sal_uInt32              mnBlibBufSize;
-    sal_uInt32              mnBlibEntrys;
-
+    std::vector<std::unique_ptr<EscherBlibEntry>>
+                            mvBlibEntrys;
     OUString                maBaseURI;
 
 protected:
@@ -581,7 +579,7 @@ public:
                     const GraphicAttr* pGrafikAttr = nullptr,
                     const bool ooxmlExport = false
                 );
-    bool        HasGraphics() const { return mnBlibEntrys != 0; };
+    bool        HasGraphics() const { return !mvBlibEntrys.empty(); };
 
     void        SetNewBlipStreamOffset( sal_Int32 nOffset );
 
@@ -592,6 +590,8 @@ public:
 
     EscherGraphicProvider( EscherGraphicProviderFlags nFlags  = EscherGraphicProviderFlags::NONE );
     virtual ~EscherGraphicProvider();
+    EscherGraphicProvider& operator=( EscherGraphicProvider const & ) = delete; // MSVC2015 workaround
+    EscherGraphicProvider( EscherGraphicProvider const & ) = delete; // MSVC2015 workaround
 };
 
 struct EscherShapeListEntry;
@@ -649,12 +649,11 @@ class MSFILTER_DLLPUBLIC EscherPropertyContainer
     SvStream*               pPicOutStrm;
     tools::Rectangle*              pShapeBoundRect;
 
-    sal_uInt32              nSortCount;
-    sal_uInt32              nSortBufSize;
     sal_uInt32              nCountCount;
     sal_uInt32              nCountSize;
 
-    EscherPropSortStruct*   pSortStruct;
+    std::vector<EscherPropSortStruct>
+                            pSortStruct;
 
     bool                    bHasComplexData;
 
diff --git a/include/filter/msfilter/msdffimp.hxx b/include/filter/msfilter/msdffimp.hxx
index d87dec093fe8..3dff33e6269c 100644
--- a/include/filter/msfilter/msdffimp.hxx
+++ b/include/filter/msfilter/msdffimp.hxx
@@ -211,9 +211,11 @@ struct MSFILTER_DLLPUBLIC SvxMSDffImportRec
 
     SdrObject*      pObj;
     tools::Polygon* pWrapPolygon;
-    char*           pClientAnchorBuffer;
+    std::unique_ptr<char[]>
+                    pClientAnchorBuffer;
     sal_uInt32      nClientAnchorLen;
-    char*           pClientDataBuffer;
+    std::unique_ptr<char[]>
+                    pClientDataBuffer;
     sal_uInt32      nClientDataLen;
     sal_uInt32      nXAlign;
     sal_uInt32      *pXRelTo;
@@ -483,14 +485,14 @@ protected:
 // the following methods need to be overridden for Excel imports
     static bool ProcessClientAnchor( SvStream& rStData,
                                           sal_uInt32 nDatLen,
-                                          char*& rpBuff,
+                                          std::unique_ptr<char[]>& rpBuff,
                                           sal_uInt32& rBuffLen );
     virtual void ProcessClientAnchor2( SvStream& rStData,
                                        DffRecordHeader& rHd,
                                        void* pData, DffObjData& );
     static bool ProcessClientData( SvStream& rStData,
                                         sal_uInt32 nDatLen,
-                                        char*& rpBuff,
+                                        std::unique_ptr<char[]>& rpBuff,
                                         sal_uInt32& rBuffLen );
     virtual SdrObject* ProcessObj( SvStream& rSt,
                                    DffObjData& rData,
diff --git a/include/filter/msfilter/svdfppt.hxx b/include/filter/msfilter/svdfppt.hxx
index b319f3fa9e90..8643be9d6481 100644
--- a/include/filter/msfilter/svdfppt.hxx
+++ b/include/filter/msfilter/svdfppt.hxx
@@ -342,7 +342,8 @@ struct PptSlidePersistEntry
     sal_uInt32          nSlidePersistEndOffset;
     sal_uInt32          nBackgroundOffset;      // fileoffset
     sal_uInt32          nDrawingDgId;           // valid, if not -1
-    sal_uInt32*         pPresentationObjects;   // if valid, this is a pointer to an array that includes the offsets to the presentation objects
+    std::unique_ptr<sal_uInt32[]>
+                        pPresentationObjects;   // if valid, this is a pointer to an array that includes the offsets to the presentation objects
                                                 // on this masterpage for each instance (0 - 8);
     SdrObject*          pBObj;
     bool                bBObjIsTemporary;
@@ -538,7 +539,8 @@ protected:
     PptUserEditAtom         aUserEditAtom;
     PptColorSchemeAtom      aPageColors;
     ::std::vector< SdHyperlinkEntry* > aHyperList;
-    sal_uInt32*             pPersistPtr;
+    std::unique_ptr<sal_uInt32[]>
+                            pPersistPtr;
     sal_uInt32              nPersistPtrAnz;
 
     const PPTStyleSheet*    pPPTStyleSheet; // this is the current stylesheet;


More information about the Libreoffice-commits mailing list