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

Noel Grandin noel.grandin at collabora.co.uk
Mon Jan 16 10:48:55 UTC 2017


 filter/source/graphicfilter/eps/eps.cxx       |   16 +++++++++------
 filter/source/graphicfilter/icgm/bitmap.cxx   |    5 ----
 filter/source/graphicfilter/icgm/bitmap.hxx   |    7 +++---
 filter/source/graphicfilter/idxf/dxfentrd.cxx |    6 +----
 filter/source/graphicfilter/idxf/dxfentrd.hxx |    5 ++--
 filter/source/graphicfilter/ipcx/ipcx.cxx     |   12 +++++------
 filter/source/graphicfilter/itiff/itiff.cxx   |    6 ++---
 filter/source/msfilter/msdffimp.cxx           |   17 ++++++----------
 filter/source/msfilter/svdfppt.cxx            |   27 +++++++++++---------------
 filter/source/msfilter/viscache.hxx           |    8 ++-----
 filter/source/svg/svgwriter.cxx               |   11 ++--------
 filter/source/svg/svgwriter.hxx               |    2 -
 filter/source/t602/t602filter.cxx             |    5 +---
 filter/source/t602/t602filter.hxx             |    2 -
 include/filter/msfilter/msdffimp.hxx          |    7 +++---
 include/filter/msfilter/svdfppt.hxx           |    8 ++++---
 16 files changed, 67 insertions(+), 77 deletions(-)

New commits:
commit 5fb99f271a571301f8246addae89738016926d6d
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Mon Jan 16 09:59:23 2017 +0200

    new loplugin: useuniqueptr: filter
    
    Change-Id: Ie5cee5d7dd067df121397b60a7adc85c62906e54
    Reviewed-on: https://gerrit.libreoffice.org/33155
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    Tested-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/filter/source/graphicfilter/eps/eps.cxx b/filter/source/graphicfilter/eps/eps.cxx
index 46a5ebf..910a9be 100644
--- a/filter/source/graphicfilter/eps/eps.cxx
+++ b/filter/source/graphicfilter/eps/eps.cxx
@@ -106,8 +106,10 @@ private:
 
     SvStream*           mpPS;
     const GDIMetaFile*  pMTF;
-    GDIMetaFile*        pAMTF;              // only created if Graphics is not a Metafile
-    ScopedVclPtrInstance<VirtualDevice> pVDev;
+    std::unique_ptr<GDIMetaFile>
+                        pAMTF;              // only created if Graphics is not a Metafile
+    ScopedVclPtrInstance<VirtualDevice>
+                        pVDev;
 
     double              nBoundingX2;        // this represents the bounding box
     double              nBoundingY2;
@@ -279,7 +281,6 @@ PSWriter::PSWriter()
 
 PSWriter::~PSWriter()
 {
-    delete pAMTF;
 }
 
 bool PSWriter::WritePS( const Graphic& rGraphic, SvStream& rTargetStream, FilterConfigItem* pFilterConfigItem )
@@ -386,17 +387,20 @@ bool PSWriter::WritePS( const Graphic& rGraphic, SvStream& rTargetStream, Filter
     if (rGraphic.GetType() == GraphicType::GdiMetafile)
         pMTF = &rGraphic.GetGDIMetaFile();
     else if (rGraphic.GetGDIMetaFile().GetActionSize())
-        pMTF = pAMTF = new GDIMetaFile( rGraphic.GetGDIMetaFile() );
+    {
+        pAMTF.reset( new GDIMetaFile( rGraphic.GetGDIMetaFile() ) );
+        pMTF = pAMTF.get();
+    }
     else
     {
         Bitmap aBmp( rGraphic.GetBitmap() );
-        pAMTF = new GDIMetaFile();
+        pAMTF.reset( new GDIMetaFile );
         ScopedVclPtrInstance< VirtualDevice > pTmpVDev;
         pAMTF->Record( pTmpVDev );
         pTmpVDev->DrawBitmap( Point(), aBmp );
         pAMTF->Stop();
         pAMTF->SetPrefSize( aBmp.GetSizePixel() );
-        pMTF = pAMTF;
+        pMTF = pAMTF.get();
     }
     pVDev->SetMapMode( pMTF->GetPrefMapMode() );
     nBoundingX2 = pMTF->GetPrefSize().Width();
diff --git a/filter/source/graphicfilter/icgm/bitmap.cxx b/filter/source/graphicfilter/icgm/bitmap.cxx
index 89edee3..44c8169 100644
--- a/filter/source/graphicfilter/icgm/bitmap.cxx
+++ b/filter/source/graphicfilter/icgm/bitmap.cxx
@@ -31,7 +31,6 @@ CGMBitmap::CGMBitmap( CGM& rCGM ) :
 
 CGMBitmap::~CGMBitmap()
 {
-    delete pCGMBitmapDescriptor;
 }
 
 
@@ -364,9 +363,7 @@ CGMBitmap* CGMBitmap::GetNext()
             return nullptr;
         }
 
-        CGMBitmapDescriptor* pTempBD = pCGMBitmapDescriptor;
-        pCGMBitmapDescriptor = pCGMTempBitmap->pCGMBitmapDescriptor;
-        pCGMTempBitmap->pCGMBitmapDescriptor = pTempBD;
+        pCGMBitmapDescriptor.swap(pCGMTempBitmap->pCGMBitmapDescriptor);
         return pCGMTempBitmap;
     }
     else
diff --git a/filter/source/graphicfilter/icgm/bitmap.hxx b/filter/source/graphicfilter/icgm/bitmap.hxx
index 5fba2d7..3d1169c 100644
--- a/filter/source/graphicfilter/icgm/bitmap.hxx
+++ b/filter/source/graphicfilter/icgm/bitmap.hxx
@@ -72,15 +72,16 @@ class CGMBitmapDescriptor
 class CGMBitmap
 {
     CGM*                    mpCGM;
-    CGMBitmapDescriptor*    pCGMBitmapDescriptor;
-    bool                ImplGetDimensions( CGMBitmapDescriptor& );
+    std::unique_ptr<CGMBitmapDescriptor>
+                            pCGMBitmapDescriptor;
+    bool                    ImplGetDimensions( CGMBitmapDescriptor& );
     void                    ImplSetCurrentPalette( CGMBitmapDescriptor& );
     void                    ImplGetBitmap( CGMBitmapDescriptor& );
     void                    ImplInsert( CGMBitmapDescriptor& rSource, CGMBitmapDescriptor& rDest );
 public:
     explicit CGMBitmap( CGM& rCGM );
     ~CGMBitmap();
-    CGMBitmapDescriptor*    GetBitmap() { return pCGMBitmapDescriptor;}
+    CGMBitmapDescriptor*    GetBitmap() { return pCGMBitmapDescriptor.get();}
     CGMBitmap*              GetNext();
 };
 #endif
diff --git a/filter/source/graphicfilter/idxf/dxfentrd.cxx b/filter/source/graphicfilter/idxf/dxfentrd.cxx
index 85508ac..14445b1 100644
--- a/filter/source/graphicfilter/idxf/dxfentrd.cxx
+++ b/filter/source/graphicfilter/idxf/dxfentrd.cxx
@@ -423,7 +423,7 @@ void DXFLWPolyLineEntity::EvaluateGroup( DXFGroupReader & rDGR )
         {
             nCount = rDGR.GetI();
             if ( nCount )
-                pP = new DXFVector[ nCount ];
+                pP.reset( new DXFVector[ nCount ] );
         }
         break;
         case 70: nFlags = rDGR.GetI(); break;
@@ -448,7 +448,6 @@ void DXFLWPolyLineEntity::EvaluateGroup( DXFGroupReader & rDGR )
 
 DXFLWPolyLineEntity::~DXFLWPolyLineEntity()
 {
-    delete[] pP;
 }
 
 //--------------------------DXFHatchEntity-------------------------------------
@@ -680,7 +679,7 @@ void DXFHatchEntity::EvaluateGroup( DXFGroupReader & rDGR )
             bIsInBoundaryPathContext = true;
             nBoundaryPathCount = rDGR.GetI();
             if ( nBoundaryPathCount )
-                pBoundaryPathData = new DXFBoundaryPathData[ nBoundaryPathCount ];
+                pBoundaryPathData.reset( new DXFBoundaryPathData[ nBoundaryPathCount ] );
         }
         break;
         case 75 :
@@ -718,7 +717,6 @@ void DXFHatchEntity::EvaluateGroup( DXFGroupReader & rDGR )
 
 DXFHatchEntity::~DXFHatchEntity()
 {
-    delete[] pBoundaryPathData;
 }
 
 //--------------------------DXFVertexEntity-------------------------------------
diff --git a/filter/source/graphicfilter/idxf/dxfentrd.hxx b/filter/source/graphicfilter/idxf/dxfentrd.hxx
index bfeffc4..8f801ba 100644
--- a/filter/source/graphicfilter/idxf/dxfentrd.hxx
+++ b/filter/source/graphicfilter/idxf/dxfentrd.hxx
@@ -24,6 +24,7 @@
 #include <dxfvec.hxx>
 
 #include <deque>
+#include <memory>
 
 enum DXFEntityType {
     DXF_LINE,
@@ -331,7 +332,7 @@ class DXFLWPolyLineEntity : public DXFBasicEntity
         double      fStartWidth;    // 40
         double      fEndWidth;      // 41
 
-        DXFVector*  pP;
+        std::unique_ptr<DXFVector[]>  pP;
 
         DXFLWPolyLineEntity();
         virtual ~DXFLWPolyLineEntity() override;
@@ -440,7 +441,7 @@ class DXFHatchEntity : public DXFBasicEntity
         double      fPixelSize;                     // 47
         sal_Int32   nNumberOfSeedPoints;            // 98
 
-        DXFBoundaryPathData* pBoundaryPathData;
+        std::unique_ptr<DXFBoundaryPathData[]> pBoundaryPathData;
 
         DXFHatchEntity();
         virtual ~DXFHatchEntity() override;
diff --git a/filter/source/graphicfilter/ipcx/ipcx.cxx b/filter/source/graphicfilter/ipcx/ipcx.cxx
index 9e10aad..ecd51de 100644
--- a/filter/source/graphicfilter/ipcx/ipcx.cxx
+++ b/filter/source/graphicfilter/ipcx/ipcx.cxx
@@ -42,7 +42,8 @@ private:
     sal_uLong           nWidth, nHeight;    // dimension in pixel
     sal_uInt16          nResX, nResY;       // resolution in pixel per inch oder 0,0
     sal_uInt16          nDestBitsPerPixel;  // bits per pixel in destination bitmap 1,4,8 or 24
-    sal_uInt8*          pPalette;
+    std::unique_ptr<sal_uInt8[]>
+                        pPalette;
     bool                bStatus;            // from now on do not read status from stream ( SJ )
 
 
@@ -72,14 +73,13 @@ PCXReader::PCXReader(SvStream &rStream)
     , nResX(0)
     , nResY(0)
     , nDestBitsPerPixel(0)
+    , pPalette(new sal_uInt8[ 768 ])
     , bStatus(false)
 {
-    pPalette = new sal_uInt8[ 768 ];
 }
 
 PCXReader::~PCXReader()
 {
-    delete[] pPalette;
 }
 
 bool PCXReader::ReadPCX(Graphic & rGraphic)
@@ -106,7 +106,7 @@ bool PCXReader::ReadPCX(Graphic & rGraphic)
         if ( nDestBitsPerPixel <= 8 )
         {
             sal_uInt16 nColors = 1 << nDestBitsPerPixel;
-            sal_uInt8* pPal = pPalette;
+            sal_uInt8* pPal = pPalette.get();
             pAcc->SetPaletteEntryCount( nColors );
             for ( sal_uInt16 i = 0; i < nColors; i++, pPal += 3 )
             {
@@ -120,7 +120,7 @@ bool PCXReader::ReadPCX(Graphic & rGraphic)
         // and write again in palette:
         if ( nDestBitsPerPixel == 8 && bStatus )
         {
-            sal_uInt8* pPal = pPalette;
+            sal_uInt8* pPal = pPalette.get();
             m_rPCX.SeekRel(1);
             ImplReadPalette(256);
             pAcc->SetPaletteEntryCount( 256 );
@@ -389,7 +389,7 @@ void PCXReader::ImplReadBody(BitmapWriteAccess * pAcc)
 void PCXReader::ImplReadPalette( sal_uLong nCol )
 {
     sal_uInt8   r, g, b;
-    sal_uInt8*  pPtr = pPalette;
+    sal_uInt8*  pPtr = pPalette.get();
     for ( sal_uLong i = 0; i < nCol; i++ )
     {
         m_rPCX.ReadUChar( r ).ReadUChar( g ).ReadUChar( b );
diff --git a/filter/source/graphicfilter/itiff/itiff.cxx b/filter/source/graphicfilter/itiff/itiff.cxx
index f795631..ccd7566 100644
--- a/filter/source/graphicfilter/itiff/itiff.cxx
+++ b/filter/source/graphicfilter/itiff/itiff.cxx
@@ -52,7 +52,8 @@ private:
     Bitmap                  aBitmap;
     BitmapWriteAccess*      pAcc;
     sal_uInt16              nDstBitsPerPixel;
-    AlphaMask*              pAlphaMask;
+    std::unique_ptr<AlphaMask>
+                            pAlphaMask;
     BitmapWriteAccess*      pMaskAcc;
 
     sal_uLong               nOrigPos;                   // start position in pTIFF
@@ -171,7 +172,6 @@ public:
 
     ~TIFFReader()
     {
-        delete pAlphaMask;
     }
 
     sal_uLong GetRowsPerStrip() const
@@ -1383,7 +1383,7 @@ bool TIFFReader::ReadTIFF(SvStream & rTIFF, Graphic & rGraphic )
 
                     if (bStatus && HasAlphaChannel())
                     {
-                        pAlphaMask = new AlphaMask( aTargetSize );
+                        pAlphaMask.reset( new AlphaMask( aTargetSize ) );
                         pMaskAcc = pAlphaMask->AcquireWriteAccess();
                     }
 
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index dd11def..d2aeeeb 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -223,7 +223,7 @@ DffPropertyReader::DffPropertyReader( const SvxMSDffManager& rMan )
 
 void DffPropertyReader::SetDefaultPropSet( SvStream& rStCtrl, sal_uInt32 nOffsDgg ) const
 {
-    delete pDefaultPropSet;
+    const_cast<DffPropertyReader*>(this)->pDefaultPropSet.reset();
     sal_uInt32 nMerk = rStCtrl.Tell();
     rStCtrl.Seek( nOffsDgg );
     DffRecordHeader aRecHd;
@@ -232,7 +232,7 @@ void DffPropertyReader::SetDefaultPropSet( SvStream& rStCtrl, sal_uInt32 nOffsDg
     {
         if ( SvxMSDffManager::SeekToRec( rStCtrl, DFF_msofbtOPT, aRecHd.GetRecEndFilePos() ) )
         {
-            const_cast<DffPropertyReader*>(this)->pDefaultPropSet = new DffPropSet;
+            const_cast<DffPropertyReader*>(this)->pDefaultPropSet.reset( new DffPropSet );
             ReadDffPropSet( rStCtrl, *pDefaultPropSet );
         }
     }
@@ -375,7 +375,6 @@ sal_Int32 DffPropertyReader::Fix16ToAngle( sal_Int32 nContent )
 
 DffPropertyReader::~DffPropertyReader()
 {
-    delete pDefaultPropSet;
 }
 
 
@@ -2910,12 +2909,11 @@ DffRecordList::DffRecordList( DffRecordList* pList ) :
     pNext                   ( nullptr )
 {
     if ( pList )
-        pList->pNext = this;
+        pList->pNext.reset( this );
 }
 
 DffRecordList::~DffRecordList()
 {
-    delete pNext;
 }
 
 DffRecordManager::DffRecordManager() :
@@ -2946,7 +2944,7 @@ void DffRecordManager::Consume( SvStream& rIn, sal_uInt32 nStOfs )
     {
         pCList = static_cast<DffRecordList*>(this);
         while ( pCList->pNext )
-            pCList = pCList->pNext;
+            pCList = pCList->pNext.get();
         while (rIn.good() && ( ( rIn.Tell() + 8 ) <=  nStOfs ))
         {
             if ( pCList->nCount == DFF_RECORD_MANAGER_BUF_SIZE )
@@ -2964,8 +2962,7 @@ void DffRecordManager::Consume( SvStream& rIn, sal_uInt32 nStOfs )
 void DffRecordManager::Clear()
 {
     pCList = static_cast<DffRecordList*>(this);
-    delete pNext;
-    pNext = nullptr;
+    pNext.reset();
     nCurrent = 0;
     nCount = 0;
 }
@@ -3001,7 +2998,7 @@ DffRecordHeader* DffRecordManager::Next()
     }
     else if ( pCList->pNext )
     {
-        pCList = pCList->pNext;
+        pCList = pCList->pNext.get();
         pCList->nCurrent = 0;
         pRet = &pCList->mHd[ 0 ];
     }
@@ -3029,7 +3026,7 @@ DffRecordHeader* DffRecordManager::Last()
 {
     DffRecordHeader* pRet = nullptr;
     while ( pCList->pNext )
-        pCList = pCList->pNext;
+        pCList = pCList->pNext.get();
     sal_uInt32 nCnt = pCList->nCount;
     if ( nCnt-- )
     {
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index 2fab16a..aa5f8d4 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -3373,7 +3373,6 @@ PPTNumberFormatCreator::PPTNumberFormatCreator( PPTExtParaProv* pParaProv )
 
 PPTNumberFormatCreator::~PPTNumberFormatCreator()
 {
-    delete pExtParaProv;
 }
 
 bool PPTNumberFormatCreator::ImplGetExtNumberFormat( SdrPowerPointImport& rManager,
@@ -3387,10 +3386,10 @@ bool PPTNumberFormatCreator::ImplGetExtNumberFormat( SdrPowerPointImport& rManag
     sal_uInt32  nAnmScheme = 0xFFFF0003;
     sal_uInt16  nBuBlip = 0xffff;
 
-    const PPTExtParaProv* pParaProv = pExtParaProv;
+    const PPTExtParaProv* pParaProv = pExtParaProv.get();
     if ( !pExtParaProv )
-        pParaProv = ( pPara ) ? pPara->mrStyleSheet.pExtParaProv
-                              : rManager.pPPTStyleSheet->pExtParaProv;
+        pParaProv = pPara ? pPara->mrStyleSheet.pExtParaProv.get()
+                          : rManager.pPPTStyleSheet->pExtParaProv.get();
     if ( pPara )
     {
         nBuFlags = pPara->pParaSet->mnExtParagraphMask;
@@ -4450,7 +4449,7 @@ PPTCharPropSet::PPTCharPropSet( const PPTCharPropSet& rCharPropSet )
     mnParagraph = rCharPropSet.mnParagraph;
     mnOriginalTextPos = rCharPropSet.mnOriginalTextPos;
     maString = rCharPropSet.maString;
-    mpFieldItem = ( rCharPropSet.mpFieldItem ) ? new SvxFieldItem( *rCharPropSet.mpFieldItem ) : nullptr;
+    mpFieldItem.reset( rCharPropSet.mpFieldItem ? new SvxFieldItem( *rCharPropSet.mpFieldItem ) : nullptr );
     mnLanguage[ 0 ] = rCharPropSet.mnLanguage[ 0 ];
     mnLanguage[ 1 ] = rCharPropSet.mnLanguage[ 1 ];
     mnLanguage[ 2 ] = rCharPropSet.mnLanguage[ 2 ];
@@ -4466,13 +4465,12 @@ PPTCharPropSet::PPTCharPropSet( const PPTCharPropSet& rCharPropSet, sal_uInt32 n
     mnParagraph = nParagraph;
     mnOriginalTextPos = rCharPropSet.mnOriginalTextPos;
     maString = rCharPropSet.maString;
-    mpFieldItem = ( rCharPropSet.mpFieldItem ) ? new SvxFieldItem( *rCharPropSet.mpFieldItem ) : nullptr;
+    mpFieldItem.reset( rCharPropSet.mpFieldItem ? new SvxFieldItem( *rCharPropSet.mpFieldItem ) : nullptr );
     mnLanguage[ 0 ] = mnLanguage[ 1 ] = mnLanguage[ 2 ] = 0;
 }
 
 PPTCharPropSet::~PPTCharPropSet()
 {
-    delete mpFieldItem;
 }
 
 PPTCharPropSet& PPTCharPropSet::operator=( const PPTCharPropSet& rCharPropSet )
@@ -4483,7 +4481,7 @@ PPTCharPropSet& PPTCharPropSet::operator=( const PPTCharPropSet& rCharPropSet )
         mnOriginalTextPos = rCharPropSet.mnOriginalTextPos;
         mnParagraph = rCharPropSet.mnParagraph;
         maString = rCharPropSet.maString;
-        mpFieldItem = ( rCharPropSet.mpFieldItem ) ? new SvxFieldItem( *rCharPropSet.mpFieldItem ) : nullptr;
+        mpFieldItem.reset( rCharPropSet.mpFieldItem ? new SvxFieldItem( *rCharPropSet.mpFieldItem ) : nullptr );
     }
     return *this;
 }
@@ -4522,7 +4520,6 @@ PPTRuler::PPTRuler()
 
 PPTRuler::~PPTRuler()
 {
-    delete[] pTab;
 };
 
 
@@ -4580,7 +4577,7 @@ PPTTextRulerInterpreter::PPTTextRulerInterpreter( sal_uInt32 nFileOfs, DffRecord
                 if (nTCount && bRecordOk)
                 {
                     mpImplRuler->nTabCount = nTabCount;
-                    mpImplRuler->pTab = new PPTTabEntry[ mpImplRuler->nTabCount ];
+                    mpImplRuler->pTab.reset( new PPTTabEntry[ mpImplRuler->nTabCount ] );
                     for ( i = 0; i < nTCount; i++ )
                     {
                         rIn.ReadUInt16( mpImplRuler->pTab[ i ].nOffset )
@@ -6488,7 +6485,7 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport
 
     if ( ( pObjData == nullptr ) || ( pObjData->bShapeType ) )
     {
-        PPTExtParaProv* pExtParaProv = rSdrPowerPointImport.pPPTStyleSheet->pExtParaProv;
+        PPTExtParaProv* pExtParaProv = rSdrPowerPointImport.pPPTStyleSheet->pExtParaProv.get();
         if ( pObjData )
         {
             mpImplTextObj->mnShapeId = pObjData->nShapeId;
@@ -6966,7 +6963,7 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport
                                                 if ( (*FE)->pField2 )
                                                 {
                                                     PPTCharPropSet* pNewCPS = new PPTCharPropSet( *pSet );
-                                                    pNewCPS->mpFieldItem = (*FE)->pField2;
+                                                    pNewCPS->mpFieldItem.reset( (*FE)->pField2 );
                                                     (*FE)->pField2 = nullptr;
                                                     aCharPropList.insert( aCharPropList.begin() + n + 1, pNewCPS );
 
@@ -6982,7 +6979,7 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport
                                                 }
                                                 if ( (*FE)->pField1 )
                                                 {
-                                                    pSet->mpFieldItem = (*FE)->pField1;
+                                                    pSet->mpFieldItem.reset( (*FE)->pField1 );
                                                     (*FE)->pField1 = nullptr;
                                                 }
                                                 else if ( (*FE)->pString )
@@ -7033,7 +7030,7 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport
                                                             {
                                                                 if ( nNextStringLen <= nHyperLenLeft )
                                                                 {
-                                                                    pCurrent->mpFieldItem = new SvxFieldItem( SvxURLField( pField->GetURL(), pCurrent->maString, SVXURLFORMAT_REPR ), EE_FEATURE_FIELD );
+                                                                    pCurrent->mpFieldItem.reset( new SvxFieldItem( SvxURLField( pField->GetURL(), pCurrent->maString, SVXURLFORMAT_REPR ), EE_FEATURE_FIELD ) );
                                                                     nHyperLenLeft -= nNextStringLen;
 
                                                                     if ( nHyperLenLeft )
@@ -7054,7 +7051,7 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport
                                                                     pNewCPS->maString = pCurrent->maString.copy( nHyperLenLeft,( nNextStringLen - nHyperLenLeft ) );
                                                                     aCharPropList.insert( aCharPropList.begin() + nIdx + 1, pNewCPS );
                                                                     OUString aRepresentation = pCurrent->maString.copy( 0, nHyperLenLeft );
-                                                                    pCurrent->mpFieldItem = new SvxFieldItem( SvxURLField( pField->GetURL(), aRepresentation, SVXURLFORMAT_REPR ), EE_FEATURE_FIELD );
+                                                                    pCurrent->mpFieldItem.reset( new SvxFieldItem( SvxURLField( pField->GetURL(), aRepresentation, SVXURLFORMAT_REPR ), EE_FEATURE_FIELD ) );
                                                                     nHyperLenLeft = 0;
                                                                 }
                                                                 (pCurrent->maString).clear();
diff --git a/filter/source/msfilter/viscache.hxx b/filter/source/msfilter/viscache.hxx
index 608ca8f..9ffb16a 100644
--- a/filter/source/msfilter/viscache.hxx
+++ b/filter/source/msfilter/viscache.hxx
@@ -29,7 +29,8 @@ class Impl_OlePres
 {
     SotClipboardFormatId nFormat;
     sal_uInt16      nAspect;
-    GDIMetaFile *   pMtf;
+    std::unique_ptr<GDIMetaFile>
+                    pMtf;
 
     sal_uInt32      nAdvFlags;
     Size            aSize;      // Groesse in 100TH_MM
@@ -42,13 +43,10 @@ public:
     {}
     ~Impl_OlePres()
     {
-        delete pMtf;
     }
     void    SetMtf( const GDIMetaFile & rMtf )
             {
-                if( pMtf )
-                    delete pMtf;
-                pMtf = new GDIMetaFile( rMtf );
+                pMtf.reset( new GDIMetaFile( rMtf ) );
             }
     void                 SetAspect( sal_uInt16 nAsp ) { nAspect = nAsp; }
     void                 SetAdviseFlags( sal_uLong nAdv ) { nAdvFlags = nAdv; }
diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx
index 0fdfaa0..f5896e9 100644
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@ -135,7 +135,6 @@ SVGAttributeWriter::SVGAttributeWriter( SVGExport& rExport, SVGFontExport& rFont
 
 SVGAttributeWriter::~SVGAttributeWriter()
 {
-    delete mpElemFont;
 }
 
 
@@ -396,22 +395,18 @@ void SVGAttributeWriter::startFontSettings()
     endFontSettings();
     if( mrExport.IsUsePositionedCharacters() )
     {
-        mpElemFont = new SvXMLElementExport( mrExport, XML_NAMESPACE_NONE, aXMLElemG, true, true );
+        mpElemFont.reset( new SvXMLElementExport( mrExport, XML_NAMESPACE_NONE, aXMLElemG, true, true ) );
     }
     else
     {
-        mpElemFont = new SvXMLElementExport( mrExport, XML_NAMESPACE_NONE, aXMLElemTspan, true, true );
+        mpElemFont.reset( new SvXMLElementExport( mrExport, XML_NAMESPACE_NONE, aXMLElemTspan, true, true ) );
     }
 }
 
 
 void SVGAttributeWriter::endFontSettings()
 {
-    if( mpElemFont )
-    {
-        delete mpElemFont;
-        mpElemFont = nullptr;
-    }
+    mpElemFont.reset();
 }
 
 
diff --git a/filter/source/svg/svgwriter.hxx b/filter/source/svg/svgwriter.hxx
index b06998b..4158f3f 100644
--- a/filter/source/svg/svgwriter.hxx
+++ b/filter/source/svg/svgwriter.hxx
@@ -153,7 +153,7 @@ private:
     SVGExport&                              mrExport;
     SVGFontExport&                          mrFontExport;
     SVGState&                               mrCurrentState;
-    SvXMLElementExport*                     mpElemFont;
+    std::unique_ptr<SvXMLElementExport>     mpElemFont;
 
 
     static double           ImplRound( double fVal );
diff --git a/filter/source/t602/t602filter.cxx b/filter/source/t602/t602filter.cxx
index a7fe34b..924d475 100644
--- a/filter/source/t602/t602filter.cxx
+++ b/filter/source/t602/t602filter.cxx
@@ -917,7 +917,6 @@ T602ImportFilterDialog::T602ImportFilterDialog() :
 
 T602ImportFilterDialog::~T602ImportFilterDialog()
 {
-    delete mpResMgr;
 }
 
 // XLocalizable
@@ -1118,14 +1117,14 @@ bool T602ImportFilterDialog::OptionsDlg()
 
 void T602ImportFilterDialog::initLocale()
 {
-    mpResMgr = ResMgr::CreateResMgr( "t602filter", LanguageTag( meLocale) );
+    mpResMgr.reset( ResMgr::CreateResMgr( "t602filter", LanguageTag( meLocale) ) );
 }
 
 ResMgr* T602ImportFilterDialog::getResMgr()
 {
     if( !mpResMgr )
         initLocale();
-    return mpResMgr;
+    return mpResMgr.get();
 }
 
 void SAL_CALL T602ImportFilterDialog::setTitle( const OUString& )
diff --git a/filter/source/t602/t602filter.hxx b/filter/source/t602/t602filter.hxx
index d8dbbdd..59d07a2 100644
--- a/filter/source/t602/t602filter.hxx
+++ b/filter/source/t602/t602filter.hxx
@@ -95,7 +95,7 @@ class T602ImportFilterDialog : public cppu::WeakImplHelper <
 >
 {
     css::lang::Locale meLocale;
-    ResMgr *mpResMgr;
+    std::unique_ptr<ResMgr> mpResMgr;
     bool OptionsDlg();
     ResMgr* getResMgr();
     OUString getResStr( sal_Int16 resid );
diff --git a/include/filter/msfilter/msdffimp.hxx b/include/filter/msfilter/msdffimp.hxx
index ae17359..7d56e6d 100644
--- a/include/filter/msfilter/msdffimp.hxx
+++ b/include/filter/msfilter/msdffimp.hxx
@@ -72,8 +72,8 @@ namespace com { namespace sun { namespace star {
 
 class MSFILTER_DLLPUBLIC DffPropertyReader : public DffPropSet
 {
-    const SvxMSDffManager&  rManager;
-    DffPropSet*             pDefaultPropSet;
+    const SvxMSDffManager&       rManager;
+    std::unique_ptr<DffPropSet>  pDefaultPropSet;
 
     void ApplyCustomShapeTextAttributes( SfxItemSet& rSet ) const;
     void CheckAndCorrectExcelTextRotation( SvStream& rIn, SfxItemSet& rSet, DffObjData& rObjData ) const;
@@ -345,7 +345,8 @@ struct DffRecordList
     sal_uInt32          nCount;
     sal_uInt32          nCurrent;
     DffRecordList*      pPrev;
-    DffRecordList*      pNext;
+    std::unique_ptr<DffRecordList>
+                        pNext;
 
     DffRecordHeader     mHd[ DFF_RECORD_MANAGER_BUF_SIZE ];
 
diff --git a/include/filter/msfilter/svdfppt.hxx b/include/filter/msfilter/svdfppt.hxx
index d0ccd36..c853a16 100644
--- a/include/filter/msfilter/svdfppt.hxx
+++ b/include/filter/msfilter/svdfppt.hxx
@@ -809,7 +809,7 @@ protected:
 
 public:
 
-    PPTExtParaProv*  pExtParaProv;
+    std::unique_ptr<PPTExtParaProv>  pExtParaProv;
 
     void        GetNumberFormat(
                     SdrPowerPointImport& rMan,
@@ -930,7 +930,8 @@ struct PPTCharPropSet
     sal_uInt32          mnOriginalTextPos;
     sal_uInt32          mnParagraph;
     OUString            maString;
-    SvxFieldItem*       mpFieldItem;
+    std::unique_ptr<SvxFieldItem>
+                        mpFieldItem;
     sal_uInt16          mnLanguage[ 3 ];
 
     void                SetFont( sal_uInt16 nFont );
@@ -966,7 +967,8 @@ struct PPTRuler
         sal_uInt16          nDefaultTab;
         sal_uInt16          nTextOfs[nMaxPPTLevels];
         sal_uInt16          nBulletOfs[nMaxPPTLevels];
-        PPTTabEntry*        pTab;
+        std::unique_ptr<PPTTabEntry[]>
+                            pTab;
         sal_uInt16          nTabCount;
 
         PPTRuler();


More information about the Libreoffice-commits mailing list