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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Dec 18 06:23:16 UTC 2018


 filter/source/msfilter/svdfppt.cxx  |   13 +++---
 include/filter/msfilter/svdfppt.hxx |    2 -
 include/xmloff/txtimppr.hxx         |    9 ++--
 xmloff/source/text/txtimppr.cxx     |   72 ++++++++++++++++++------------------
 4 files changed, 48 insertions(+), 48 deletions(-)

New commits:
commit 49fb2a24c46e5097650c0951eeabe336d242834a
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri Dec 14 09:11:26 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Dec 18 07:23:01 2018 +0100

    use unique_ptr in SdrPowerPointImport
    
    Change-Id: I46608f7dd44f95bc811b20b6f26b63f0c1dc140e
    Reviewed-on: https://gerrit.libreoffice.org/65144
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index 99430c9abc0f..18aacd8e6803 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -1972,9 +1972,9 @@ SdrObject* SdrPowerPointImport::ImportOLE( sal_uInt32 nOLEId,
     return pRet;
 }
 
-SvMemoryStream* SdrPowerPointImport::ImportExOleObjStg( sal_uInt32 nPersistPtr, sal_uInt32& nOleId ) const
+std::unique_ptr<SvMemoryStream> SdrPowerPointImport::ImportExOleObjStg( sal_uInt32 nPersistPtr, sal_uInt32& nOleId ) const
 {
-    SvMemoryStream* pRet = nullptr;
+    std::unique_ptr<SvMemoryStream> pRet;
     if ( nPersistPtr && ( nPersistPtr < nPersistPtrCnt ) )
     {
         sal_uInt32 nOldPos, nOfs = pPersistPtr[ nPersistPtr ];
@@ -1988,14 +1988,13 @@ SvMemoryStream* SdrPowerPointImport::ImportExOleObjStg( sal_uInt32 nPersistPtr,
             if ( static_cast<sal_Int32>(nLen) > 0 )
             {
                 rStCtrl.ReadUInt32( nOleId );
-                pRet = new SvMemoryStream;
+                pRet.reset(new SvMemoryStream);
                 ZCodec aZCodec( 0x8000, 0x8000 );
                 aZCodec.BeginCompression();
                 aZCodec.Decompress( rStCtrl, *pRet );
                 if ( !aZCodec.EndCompression() )
                 {
-                    delete pRet;
-                    pRet = nullptr;
+                    pRet.reset();
                 }
             }
         }
@@ -2028,10 +2027,10 @@ void SdrPowerPointImport::SeekOle( SfxObjectShell* pShell, sal_uInt32 nFilterOpt
                                .ReadUInt32( nIDoNotKnow2 );
 
                         sal_uInt32 nOleId;
-                        SvMemoryStream* pBas = ImportExOleObjStg( nPersistPtr, nOleId );
+                        std::unique_ptr<SvMemoryStream> pBas = ImportExOleObjStg( nPersistPtr, nOleId );
                         if ( pBas )
                         {
-                            tools::SvRef<SotStorage> xSource( new SotStorage( pBas, true ) );
+                            tools::SvRef<SotStorage> xSource( new SotStorage( pBas.release(), true ) );
                             tools::SvRef<SotStorage> xDest( new SotStorage( new SvMemoryStream(), true ) );
                             if ( xSource.is() && xDest.is() )
                             {
diff --git a/include/filter/msfilter/svdfppt.hxx b/include/filter/msfilter/svdfppt.hxx
index 36229fb5044a..59fa807c35ff 100644
--- a/include/filter/msfilter/svdfppt.hxx
+++ b/include/filter/msfilter/svdfppt.hxx
@@ -604,7 +604,7 @@ protected:
                                 const tools::Rectangle& rVisArea,
                                 const int _nCalledByGroup
                             ) const override;
-    SvMemoryStream*         ImportExOleObjStg( sal_uInt32 nPersistPtr, sal_uInt32& nOleId ) const;
+    std::unique_ptr<SvMemoryStream> ImportExOleObjStg( sal_uInt32 nPersistPtr, sal_uInt32& nOleId ) const;
     SdrPage*                MakeBlancPage(bool bMaster) const;
     bool                    ReadFontCollection();
     PptSlidePersistList*    GetPageList(PptPageKind ePageKind) const;
commit ebad2d305cd727dd94caef21031f4f268b7c642c
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Dec 13 11:39:27 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Dec 18 07:22:53 2018 +0100

    use unique_ptr in XMLTextImportPropertyMapper
    
    Change-Id: I8cc60add5fd8e3e17804795915fc4f87523b0599
    Reviewed-on: https://gerrit.libreoffice.org/65143
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/xmloff/txtimppr.hxx b/include/xmloff/txtimppr.hxx
index bd1338fd1884..3786de22f478 100644
--- a/include/xmloff/txtimppr.hxx
+++ b/include/xmloff/txtimppr.hxx
@@ -21,6 +21,7 @@
 
 #include <xmloff/dllapi.h>
 #include <xmloff/xmlimppr.hxx>
+#include <memory>
 
 class XMLFontStylesContext;
 
@@ -42,10 +43,10 @@ class XMLOFF_DLLPUBLIC XMLTextImportPropertyMapper : public SvXMLImportPropertyM
                 XMLPropertyState const * pFontFamily,
                 XMLPropertyState const * pFontPitch,
                 XMLPropertyState const * pFontCharSet,
-                XMLPropertyState** ppNewFontStyleName,
-                XMLPropertyState** ppNewFontFamily,
-                XMLPropertyState** ppNewFontPitch,
-                XMLPropertyState** ppNewFontCharSet ) const;
+                std::unique_ptr<XMLPropertyState>* ppNewFontStyleName,
+                std::unique_ptr<XMLPropertyState>* ppNewFontFamily,
+                std::unique_ptr<XMLPropertyState>* ppNewFontPitch,
+                std::unique_ptr<XMLPropertyState>* ppNewFontCharSet ) const;
 
 protected:
     virtual bool handleSpecialItem(
diff --git a/xmloff/source/text/txtimppr.cxx b/xmloff/source/text/txtimppr.cxx
index a3303594ce7b..ee41e82b40be 100644
--- a/xmloff/source/text/txtimppr.cxx
+++ b/xmloff/source/text/txtimppr.cxx
@@ -187,10 +187,10 @@ void XMLTextImportPropertyMapper::FontDefaultsCheck(
                                         XMLPropertyState const * pFontFamily,
                                         XMLPropertyState const * pFontPitch,
                                         XMLPropertyState const * pFontCharSet,
-                                        XMLPropertyState** ppNewFontStyleName,
-                                        XMLPropertyState** ppNewFontFamily,
-                                        XMLPropertyState** ppNewFontPitch,
-                                        XMLPropertyState** ppNewFontCharSet ) const
+                                        std::unique_ptr<XMLPropertyState>* ppNewFontStyleName,
+                                        std::unique_ptr<XMLPropertyState>* ppNewFontFamily,
+                                        std::unique_ptr<XMLPropertyState>* ppNewFontPitch,
+                                        std::unique_ptr<XMLPropertyState>* ppNewFontCharSet ) const
 {
     if( pFontFamilyName )
     {
@@ -204,8 +204,8 @@ void XMLTextImportPropertyMapper::FontDefaultsCheck(
                                                 pFontFamilyName->mnIndex + 1 );
                 assert(nTmp == CTF_FONTSTYLENAME || nTmp == CTF_FONTSTYLENAME_CJK || nTmp == CTF_FONTSTYLENAME_CTL);
     #endif
-                *ppNewFontStyleName = new XMLPropertyState( pFontFamilyName->mnIndex + 1,
-                                                       aAny );
+                ppNewFontStyleName->reset(new XMLPropertyState( pFontFamilyName->mnIndex + 1,
+                                                       aAny ));
         }
 
         if( !pFontFamily )
@@ -217,8 +217,8 @@ void XMLTextImportPropertyMapper::FontDefaultsCheck(
                                                 pFontFamilyName->mnIndex + 2 );
                 assert(nTmp == CTF_FONTFAMILY || nTmp == CTF_FONTFAMILY_CJK || nTmp == CTF_FONTFAMILY_CTL);
     #endif
-                *ppNewFontFamily = new XMLPropertyState( pFontFamilyName->mnIndex + 2,
-                                                       aAny );
+                ppNewFontFamily->reset(new XMLPropertyState( pFontFamilyName->mnIndex + 2,
+                                                       aAny ));
         }
 
         if( !pFontPitch )
@@ -229,8 +229,8 @@ void XMLTextImportPropertyMapper::FontDefaultsCheck(
                                                 pFontFamilyName->mnIndex + 3 );
                 assert(nTmp == CTF_FONTPITCH || nTmp == CTF_FONTPITCH_CJK || nTmp == CTF_FONTPITCH_CTL);
     #endif
-                *ppNewFontPitch = new XMLPropertyState( pFontFamilyName->mnIndex + 3,
-                                                       aAny );
+                ppNewFontPitch->reset(new XMLPropertyState( pFontFamilyName->mnIndex + 3,
+                                                       aAny ));
         }
 
         if( !pFontCharSet )
@@ -241,8 +241,8 @@ void XMLTextImportPropertyMapper::FontDefaultsCheck(
                                                 pFontFamilyName->mnIndex + 4 );
                 assert(nTmp == CTF_FONTCHARSET || nTmp == CTF_FONTCHARSET_CJK || nTmp == CTF_FONTCHARSET_CTL);
     #endif
-                *ppNewFontCharSet = new XMLPropertyState( pFontFamilyName->mnIndex + 4,
-                                                       aAny );
+                ppNewFontCharSet->reset(new XMLPropertyState( pFontFamilyName->mnIndex + 4,
+                                                       aAny ));
         }
     }
 
@@ -366,28 +366,28 @@ void XMLTextImportPropertyMapper::finished(
     XMLPropertyState* pFontFamily = nullptr;
     XMLPropertyState* pFontPitch = nullptr;
     XMLPropertyState* pFontCharSet = nullptr;
-    XMLPropertyState* pNewFontStyleName = nullptr;
-    XMLPropertyState* pNewFontFamily = nullptr;
-    XMLPropertyState* pNewFontPitch = nullptr;
-    XMLPropertyState* pNewFontCharSet = nullptr;
+    std::unique_ptr<XMLPropertyState> pNewFontStyleName;
+    std::unique_ptr<XMLPropertyState> pNewFontFamily;
+    std::unique_ptr<XMLPropertyState> pNewFontPitch;
+    std::unique_ptr<XMLPropertyState> pNewFontCharSet;
     XMLPropertyState* pFontFamilyNameCJK = nullptr;
     XMLPropertyState* pFontStyleNameCJK = nullptr;
     XMLPropertyState* pFontFamilyCJK = nullptr;
     XMLPropertyState* pFontPitchCJK = nullptr;
     XMLPropertyState* pFontCharSetCJK = nullptr;
-    XMLPropertyState* pNewFontStyleNameCJK = nullptr;
-    XMLPropertyState* pNewFontFamilyCJK = nullptr;
-    XMLPropertyState* pNewFontPitchCJK = nullptr;
-    XMLPropertyState* pNewFontCharSetCJK = nullptr;
+    std::unique_ptr<XMLPropertyState> pNewFontStyleNameCJK;
+    std::unique_ptr<XMLPropertyState> pNewFontFamilyCJK;
+    std::unique_ptr<XMLPropertyState> pNewFontPitchCJK;
+    std::unique_ptr<XMLPropertyState> pNewFontCharSetCJK;
     XMLPropertyState* pFontFamilyNameCTL = nullptr;
     XMLPropertyState* pFontStyleNameCTL = nullptr;
     XMLPropertyState* pFontFamilyCTL = nullptr;
     XMLPropertyState* pFontPitchCTL = nullptr;
     XMLPropertyState* pFontCharSetCTL = nullptr;
-    XMLPropertyState* pNewFontStyleNameCTL = nullptr;
-    XMLPropertyState* pNewFontFamilyCTL = nullptr;
-    XMLPropertyState* pNewFontPitchCTL = nullptr;
-    XMLPropertyState* pNewFontCharSetCTL = nullptr;
+    std::unique_ptr<XMLPropertyState> pNewFontStyleNameCTL;
+    std::unique_ptr<XMLPropertyState> pNewFontFamilyCTL;
+    std::unique_ptr<XMLPropertyState> pNewFontPitchCTL;
+    std::unique_ptr<XMLPropertyState> pNewFontCharSetCTL;
     XMLPropertyState* pAllBorderDistance = nullptr;
     XMLPropertyState* pBorderDistances[4] = { nullptr, nullptr, nullptr, nullptr };
     XMLPropertyState* pNewBorderDistances[4] = { nullptr, nullptr, nullptr, nullptr };
@@ -685,73 +685,73 @@ void XMLTextImportPropertyMapper::finished(
     if( pNewFontStyleName )
     {
         rProperties.push_back( *pNewFontStyleName );
-        delete pNewFontStyleName;
+        pNewFontStyleName.reset();
     }
 
     if( pNewFontFamily )
     {
         rProperties.push_back( *pNewFontFamily );
-        delete pNewFontFamily;
+        pNewFontFamily.reset();
     }
 
     if( pNewFontPitch )
     {
         rProperties.push_back( *pNewFontPitch );
-        delete pNewFontPitch;
+        pNewFontPitch.reset();
     }
 
     if( pNewFontCharSet )
     {
         rProperties.push_back( *pNewFontCharSet );
-        delete pNewFontCharSet;
+        pNewFontCharSet.reset();
     }
 
     if( pNewFontStyleNameCJK )
     {
         rProperties.push_back( *pNewFontStyleNameCJK );
-        delete pNewFontStyleNameCJK;
+        pNewFontStyleNameCJK.reset();
     }
 
     if( pNewFontFamilyCJK )
     {
         rProperties.push_back( *pNewFontFamilyCJK );
-        delete pNewFontFamilyCJK;
+        pNewFontFamilyCJK.reset();
     }
 
     if( pNewFontPitchCJK )
     {
         rProperties.push_back( *pNewFontPitchCJK );
-        delete pNewFontPitchCJK;
+        pNewFontPitchCJK.reset();
     }
 
     if( pNewFontCharSetCJK )
     {
         rProperties.push_back( *pNewFontCharSetCJK );
-        delete pNewFontCharSetCJK;
+        pNewFontCharSetCJK.reset();
     }
 
     if( pNewFontStyleNameCTL)
     {
         rProperties.push_back( *pNewFontStyleNameCTL );
-        delete pNewFontStyleNameCTL;
+        pNewFontStyleNameCTL.reset();
     }
 
     if( pNewFontFamilyCTL )
     {
         rProperties.push_back( *pNewFontFamilyCTL );
-        delete pNewFontFamilyCTL;
+        pNewFontFamilyCTL.reset();
     }
 
     if( pNewFontPitchCTL )
     {
         rProperties.push_back( *pNewFontPitchCTL );
-        delete pNewFontPitchCTL;
+        pNewFontPitchCTL.reset();
     }
 
     if( pNewFontCharSetCTL )
     {
         rProperties.push_back( *pNewFontCharSetCTL );
-        delete pNewFontCharSetCTL;
+        pNewFontCharSetCTL.reset();
     }
 
     for (sal_uInt16 i=0; i<4; i++)


More information about the Libreoffice-commits mailing list