include/sfx2/evntconf.hxx | 2 +- sfx2/source/config/evntconf.cxx | 2 +- sfx2/source/inc/eventsupplier.hxx | 2 +- sfx2/source/notify/eventsupplier.cxx | 8 ++++---- sw/source/core/view/vprint.cxx | 6 +++--- sw/source/filter/html/htmlbas.cxx | 3 +-- sw/source/filter/xml/xmlexpit.cxx | 10 ++++------ 7 files changed, 15 insertions(+), 18 deletions(-)
New commits: commit 39a6500f5536469c3af2db31b68e75483ccad03e Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Fri Jan 11 14:57:10 2019 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Sat Jan 12 07:11:13 2019 +0100 use unique_ptr in SvXMLExportItemMapper Change-Id: I71cc6b270375164c466e22f62c568cd757204efe Reviewed-on: https://gerrit.libreoffice.org/66185 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/source/filter/xml/xmlexpit.cxx b/sw/source/filter/xml/xmlexpit.cxx index 862066b8c0c5..127fa9f4d909 100644 --- a/sw/source/filter/xml/xmlexpit.cxx +++ b/sw/source/filter/xml/xmlexpit.cxx @@ -147,7 +147,7 @@ void SvXMLExportItemMapper::exportXML( const SvXMLExport& rExport, } if( dynamic_cast<const SvXMLAttrContainerItem*>( &rItem) != nullptr ) { - SvXMLNamespaceMap *pNewNamespaceMap = nullptr; + std::unique_ptr<SvXMLNamespaceMap> pNewNamespaceMap; const SvXMLNamespaceMap *pNamespaceMap = &rNamespaceMap; const SvXMLAttrContainerItem *pUnknown = @@ -169,9 +169,9 @@ void SvXMLExportItemMapper::exportXML( const SvXMLExport& rExport, { if( !pNewNamespaceMap ) { - pNewNamespaceMap = - new SvXMLNamespaceMap( rNamespaceMap ); - pNamespaceMap = pNewNamespaceMap; + pNewNamespaceMap.reset( + new SvXMLNamespaceMap( rNamespaceMap )); + pNamespaceMap = pNewNamespaceMap.get(); } pNewNamespaceMap->Add( sPrefix, sNamespace ); @@ -188,8 +188,6 @@ void SvXMLExportItemMapper::exportXML( const SvXMLExport& rExport, pUnknown->GetAttrValue(i) ); } } - - delete pNewNamespaceMap; } else { commit c8fe80fa0029798f847c8443aae54639ad193b08 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Fri Jan 11 11:37:20 2019 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Sat Jan 12 07:11:05 2019 +0100 use unique_ptr in SfxEventConfiguration::ConvertToMacro Change-Id: I7f96ce55b22212c38972a51c9273c9f9cd241acf Reviewed-on: https://gerrit.libreoffice.org/66183 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/include/sfx2/evntconf.hxx b/include/sfx2/evntconf.hxx index 2c863eb05222..5db89bc023b6 100644 --- a/include/sfx2/evntconf.hxx +++ b/include/sfx2/evntconf.hxx @@ -98,7 +98,7 @@ class SFX2_DLLPUBLIC SfxEventConfiguration { public: static void ConfigureEvent( const OUString& aName, const SvxMacro&, SfxObjectShell const * pObjSh); - static SvxMacro* ConvertToMacro( const css::uno::Any& rElement, SfxObjectShell* pDoc ); + static std::unique_ptr<SvxMacro> ConvertToMacro( const css::uno::Any& rElement, SfxObjectShell* pDoc ); }; #endif diff --git a/sfx2/source/config/evntconf.cxx b/sfx2/source/config/evntconf.cxx index 211b6fd1a774..a6710302e09a 100644 --- a/sfx2/source/config/evntconf.cxx +++ b/sfx2/source/config/evntconf.cxx @@ -238,7 +238,7 @@ void SfxEventConfiguration::ConfigureEvent( const OUString& aName, const SvxMacr } -SvxMacro* SfxEventConfiguration::ConvertToMacro( const css::uno::Any& rElement, SfxObjectShell* pDoc ) +std::unique_ptr<SvxMacro> SfxEventConfiguration::ConvertToMacro( const css::uno::Any& rElement, SfxObjectShell* pDoc ) { return SfxEvents_Impl::ConvertToMacro( rElement, pDoc ); } diff --git a/sfx2/source/inc/eventsupplier.hxx b/sfx2/source/inc/eventsupplier.hxx index 9c3ff357b7f2..be6421416939 100644 --- a/sfx2/source/inc/eventsupplier.hxx +++ b/sfx2/source/inc/eventsupplier.hxx @@ -79,7 +79,7 @@ public: virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; // convert and normalize - static SvxMacro* ConvertToMacro( const css::uno::Any& rElement, SfxObjectShell* pDoc ); + static std::unique_ptr<SvxMacro> ConvertToMacro( const css::uno::Any& rElement, SfxObjectShell* pDoc ); static void NormalizeMacro( const css::uno::Any& rIn, css::uno::Any& rOut, SfxObjectShell* pDoc ); static void NormalizeMacro( const ::comphelper::NamedValueCollection& i_eventDescriptor, diff --git a/sfx2/source/notify/eventsupplier.cxx b/sfx2/source/notify/eventsupplier.cxx index 261ce2db54aa..ea23654f59b3 100644 --- a/sfx2/source/notify/eventsupplier.cxx +++ b/sfx2/source/notify/eventsupplier.cxx @@ -329,9 +329,9 @@ SfxEvents_Impl::~SfxEvents_Impl() } -SvxMacro* SfxEvents_Impl::ConvertToMacro( const uno::Any& rElement, SfxObjectShell* pObjShell ) +std::unique_ptr<SvxMacro> SfxEvents_Impl::ConvertToMacro( const uno::Any& rElement, SfxObjectShell* pObjShell ) { - SvxMacro* pMacro = nullptr; + std::unique_ptr<SvxMacro> pMacro; uno::Sequence < beans::PropertyValue > aProperties; uno::Any aAny; NormalizeMacro( rElement, aAny, pObjShell ); @@ -383,10 +383,10 @@ SvxMacro* SfxEvents_Impl::ConvertToMacro( const uno::Any& rElement, SfxObjectShe aLibrary = SfxGetpApp()->GetName(); else aLibrary.clear(); - pMacro = new SvxMacro( aMacroName, aLibrary, eType ); + pMacro.reset(new SvxMacro( aMacroName, aLibrary, eType )); } else if ( eType == EXTENDED_STYPE ) - pMacro = new SvxMacro( aScriptURL, aType ); + pMacro.reset(new SvxMacro( aScriptURL, aType )); } return pMacro; diff --git a/sw/source/filter/html/htmlbas.cxx b/sw/source/filter/html/htmlbas.cxx index 47e26cbcb7fd..b5103399c03a 100644 --- a/sw/source/filter/html/htmlbas.cxx +++ b/sw/source/filter/html/htmlbas.cxx @@ -317,11 +317,10 @@ void SwHTMLWriter::OutBasicBodyEvents() uno::Reference < container::XNameReplace > xEvents = xSup->getEvents(); for ( sal_Int32 i=0; i<4; i++ ) { - SvxMacro* pMacro = SfxEventConfiguration::ConvertToMacro( xEvents->getByName( OUString::createFromAscii(aEventNames[i]) ), pDocSh ); + std::unique_ptr<SvxMacro> pMacro = SfxEventConfiguration::ConvertToMacro( xEvents->getByName( OUString::createFromAscii(aEventNames[i]) ), pDocSh ); if ( pMacro ) { aDocTable.Insert( aBodyEventTable[i].nEvent, *pMacro ); - delete pMacro; } } commit 70d509c9865664dffb49c2b6cafe5627d1fd26c7 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Fri Jan 11 11:37:02 2019 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Sat Jan 12 07:11:00 2019 +0100 use unique_ptr in SwViewShell::PrintOrPDFExport Change-Id: I43defece1279c7c170519d3950856c888ebad224 Reviewed-on: https://gerrit.libreoffice.org/66182 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index c70574c85933..5de46ad10f6c 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -465,7 +465,7 @@ bool SwViewShell::PrintOrPDFExport( // will fit on the real page, and replay that scaled // output to the real outputdevice GDIMetaFile *pOrigRecorder(nullptr); - GDIMetaFile *pMetaFile(nullptr); + std::unique_ptr<GDIMetaFile> pMetaFile; SwPostItMode nPostItMode = rPrintData.GetPrintPostIts(); // tdf#91680 Reserve space in margin for comments only if there are comments @@ -481,7 +481,7 @@ bool SwViewShell::PrintOrPDFExport( pOutDev->EnableOutput(false); // just record the rendering commands to the metafile // instead - pMetaFile = new GDIMetaFile; + pMetaFile.reset(new GDIMetaFile); pMetaFile->SetPrefSize(pOutDev->GetOutputSize()); pMetaFile->SetPrefMapMode(pOutDev->GetMapMode()); pMetaFile->Record(pOutDev); @@ -574,7 +574,7 @@ bool SwViewShell::PrintOrPDFExport( //play back the scaled page pMetaFile->Play(pOutDev); - delete pMetaFile; + pMetaFile.reset(); } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits