From 442df6cf8345f8029d5a3b470bc4981a5aa2bf20 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 21 Sep 2017 12:12:33 +0100 Subject: ofz: don't leak in face of exceptions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ic15590a13bd3770ee5dd7db76b21c830a4fe73e2 Reviewed-on: https://gerrit.libreoffice.org/42587 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- xmloff/source/script/XMLEventsImportContext.cxx | 2 +- xmloff/source/script/xmlbasici.cxx | 4 ++-- xmloff/source/script/xmlbasici.hxx | 4 ++-- xmloff/source/script/xmlscripti.cxx | 28 ++++++++++++------------- 4 files changed, 19 insertions(+), 19 deletions(-) (limited to 'xmloff/source/script') diff --git a/xmloff/source/script/XMLEventsImportContext.cxx b/xmloff/source/script/XMLEventsImportContext.cxx index 07ffa2f048b0..3a6e988634b0 100644 --- a/xmloff/source/script/XMLEventsImportContext.cxx +++ b/xmloff/source/script/XMLEventsImportContext.cxx @@ -86,7 +86,7 @@ void XMLEventsImportContext::EndElement() // nothing to be done } -SvXMLImportContext* XMLEventsImportContext::CreateChildContext( +SvXMLImportContextRef XMLEventsImportContext::CreateChildContext( sal_uInt16 p_nPrefix, const OUString& rLocalName, const Reference & xAttrList ) diff --git a/xmloff/source/script/xmlbasici.cxx b/xmloff/source/script/xmlbasici.cxx index 8e884c9c211b..a9ab4dae7a64 100644 --- a/xmloff/source/script/xmlbasici.cxx +++ b/xmloff/source/script/xmlbasici.cxx @@ -45,7 +45,7 @@ XMLBasicImportContext::~XMLBasicImportContext() { } -SvXMLImportContext* XMLBasicImportContext::CreateChildContext( +SvXMLImportContextRef XMLBasicImportContext::CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const Reference< xml::sax::XAttributeList >& ) { @@ -116,7 +116,7 @@ XMLBasicImportChildContext::~XMLBasicImportChildContext() { } -SvXMLImportContext* XMLBasicImportChildContext::CreateChildContext( +SvXMLImportContextRef XMLBasicImportChildContext::CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const Reference< xml::sax::XAttributeList >& ) { diff --git a/xmloff/source/script/xmlbasici.hxx b/xmloff/source/script/xmlbasici.hxx index e74e8d737b59..ac85c18fc372 100644 --- a/xmloff/source/script/xmlbasici.hxx +++ b/xmloff/source/script/xmlbasici.hxx @@ -38,7 +38,7 @@ public: virtual ~XMLBasicImportContext() override; - virtual SvXMLImportContext* CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, + virtual SvXMLImportContextRef CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList >& rxAttrList ) override; virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& rxAttrList ) override; @@ -61,7 +61,7 @@ public: virtual ~XMLBasicImportChildContext() override; - virtual SvXMLImportContext* CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, + virtual SvXMLImportContextRef CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; diff --git a/xmloff/source/script/xmlscripti.cxx b/xmloff/source/script/xmlscripti.cxx index 31bb0398c45a..4844fcb04da4 100644 --- a/xmloff/source/script/xmlscripti.cxx +++ b/xmloff/source/script/xmlscripti.cxx @@ -50,7 +50,7 @@ public: const css::uno::Reference< css::frame::XModel>& rxModel, const OUString& rLanguage ); - virtual SvXMLImportContext* CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, + virtual SvXMLImportContextRef CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; virtual void EndElement() override; @@ -65,11 +65,11 @@ XMLScriptChildContext::XMLScriptChildContext( SvXMLImport& rImport, sal_uInt16 n { } -SvXMLImportContext* XMLScriptChildContext::CreateChildContext( +SvXMLImportContextRef XMLScriptChildContext::CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const Reference< xml::sax::XAttributeList >& xAttrList ) { - SvXMLImportContext* pContext = nullptr; + SvXMLImportContextRef xContext; if ( m_xDocumentScripts.is() ) { // document supports embedding scripts/macros @@ -77,13 +77,13 @@ SvXMLImportContext* XMLScriptChildContext::CreateChildContext( aBasic += ":Basic"; if ( m_aLanguage == aBasic && nPrefix == XML_NAMESPACE_OOO && IsXMLToken( rLocalName, XML_LIBRARIES ) ) - pContext = new XMLBasicImportContext( GetImport(), nPrefix, rLocalName, m_xModel ); + xContext = new XMLBasicImportContext( GetImport(), nPrefix, rLocalName, m_xModel ); } - if ( !pContext ) - pContext = SvXMLImportContext::CreateChildContext( nPrefix, rLocalName, xAttrList ); + if (!xContext) + xContext = SvXMLImportContext::CreateChildContext( nPrefix, rLocalName, xAttrList ); - return pContext; + return xContext; } void XMLScriptChildContext::EndElement() @@ -103,18 +103,18 @@ XMLScriptContext::~XMLScriptContext() { } -SvXMLImportContext* XMLScriptContext::CreateChildContext( +SvXMLImportContextRef XMLScriptContext::CreateChildContext( sal_uInt16 nPrefix, const OUString& rLName, const Reference& xAttrList ) { - SvXMLImportContext* pContext = nullptr; + SvXMLImportContextRef xContext; if ( nPrefix == XML_NAMESPACE_OFFICE ) { if ( IsXMLToken( rLName, XML_EVENT_LISTENERS ) ) { Reference< XEventsSupplier> xSupplier( GetImport().GetModel(), UNO_QUERY ); - pContext = new XMLEventsImportContext( GetImport(), nPrefix, rLName, xSupplier ); + xContext = new XMLEventsImportContext( GetImport(), nPrefix, rLName, xSupplier ); } else if ( IsXMLToken( rLName, XML_SCRIPT ) ) { @@ -133,16 +133,16 @@ SvXMLImportContext* XMLScriptContext::CreateChildContext( aMedDescr[nNewLen-1].Value <<= true; m_xModel->attachResource( m_xModel->getURL(), aMedDescr ); - pContext = new XMLScriptChildContext( GetImport(), nPrefix, rLName, m_xModel, aLanguage ); + xContext = new XMLScriptChildContext( GetImport(), nPrefix, rLName, m_xModel, aLanguage ); } } } } - if ( !pContext ) - pContext = SvXMLImportContext::CreateChildContext( nPrefix, rLName, xAttrList); + if (!xContext) + xContext = SvXMLImportContext::CreateChildContext( nPrefix, rLName, xAttrList); - return pContext; + return xContext; } void XMLScriptContext::EndElement() -- cgit