diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-09-21 12:12:33 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-09-22 11:01:53 +0200 |
commit | 442df6cf8345f8029d5a3b470bc4981a5aa2bf20 (patch) | |
tree | 9efa6f2b29f41d79f968d1e8ad2588c323305776 /xmloff/source/chart/contexts.cxx | |
parent | a411d7729ab2bed05c3c5d22a8cbcf5dde034b91 (diff) |
ofz: don't leak in face of exceptions
Change-Id: Ic15590a13bd3770ee5dd7db76b21c830a4fe73e2
Reviewed-on: https://gerrit.libreoffice.org/42587
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'xmloff/source/chart/contexts.cxx')
-rw-r--r-- | xmloff/source/chart/contexts.cxx | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/xmloff/source/chart/contexts.cxx b/xmloff/source/chart/contexts.cxx index 2708d37bf18e..79a3b6bca37c 100644 --- a/xmloff/source/chart/contexts.cxx +++ b/xmloff/source/chart/contexts.cxx @@ -41,7 +41,7 @@ public: SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName ); - virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, + virtual SvXMLImportContextRef CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference< xml::sax::XAttributeList > & xAttrList ) override; }; @@ -54,7 +54,7 @@ SchXMLBodyContext_Impl::SchXMLBodyContext_Impl( { } -SvXMLImportContext *SchXMLBodyContext_Impl::CreateChildContext( +SvXMLImportContextRef SchXMLBodyContext_Impl::CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference< xml::sax::XAttributeList > & ) @@ -81,12 +81,12 @@ SchXMLDocContext::~SchXMLDocContext() {} -SvXMLImportContext* SchXMLDocContext::CreateChildContext( +SvXMLImportContextRef SchXMLDocContext::CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference< xml::sax::XAttributeList >& xAttrList ) { - SvXMLImportContext* pContext = nullptr; + SvXMLImportContextRef xContext; const SvXMLTokenMap& rTokenMap = mrImportHelper.GetDocElemTokenMap(); SvXMLImportFlags nFlags = GetImport().getImportFlags(); @@ -96,30 +96,30 @@ SvXMLImportContext* SchXMLDocContext::CreateChildContext( if( nFlags & SvXMLImportFlags::AUTOSTYLES ) // not nice, but this is safe, as the SchXMLDocContext class can only by // instantiated by the chart import class SchXMLImport (header is not exported) - pContext = + xContext = static_cast< SchXMLImport& >( GetImport() ).CreateStylesContext( rLocalName, xAttrList ); break; case XML_TOK_DOC_STYLES: // for draw styles containing gradients/hatches/markers and dashes if( nFlags & SvXMLImportFlags::STYLES ) - pContext = new SvXMLStylesContext( GetImport(), nPrefix, rLocalName, xAttrList ); + xContext = new SvXMLStylesContext( GetImport(), nPrefix, rLocalName, xAttrList ); break; case XML_TOK_DOC_META: // we come here in the flat ODF file format, // if XDocumentPropertiesSupplier is not supported at the model - pContext = SvXMLImportContext::CreateChildContext( nPrefix, rLocalName, xAttrList ); + xContext = SvXMLImportContext::CreateChildContext( nPrefix, rLocalName, xAttrList ); break; case XML_TOK_DOC_BODY: if( nFlags & SvXMLImportFlags::CONTENT ) - pContext = new SchXMLBodyContext_Impl( mrImportHelper, GetImport(), nPrefix, rLocalName ); + xContext = new SchXMLBodyContext_Impl( mrImportHelper, GetImport(), nPrefix, rLocalName ); break; } // call parent when no own context was created - if( ! pContext ) - pContext = SvXMLImportContext::CreateChildContext( nPrefix, rLocalName, xAttrList ); + if (!xContext) + xContext = SvXMLImportContext::CreateChildContext( nPrefix, rLocalName, xAttrList ); - return pContext; + return xContext; } SchXMLFlatDocContext_Impl::SchXMLFlatDocContext_Impl( @@ -134,7 +134,7 @@ SchXMLFlatDocContext_Impl::SchXMLFlatDocContext_Impl( { } -SvXMLImportContext *SchXMLFlatDocContext_Impl::CreateChildContext( +SvXMLImportContextRef SchXMLFlatDocContext_Impl::CreateChildContext( sal_uInt16 i_nPrefix, const OUString& i_rLocalName, const uno::Reference<xml::sax::XAttributeList>& i_xAttrList) { @@ -168,18 +168,18 @@ void SchXMLBodyContext::EndElement() { } -SvXMLImportContext* SchXMLBodyContext::CreateChildContext( +SvXMLImportContextRef SchXMLBodyContext::CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference< xml::sax::XAttributeList >& xAttrList ) { - SvXMLImportContext* pContext = nullptr; + SvXMLImportContextRef xContext; // <chart:chart> element if( nPrefix == XML_NAMESPACE_CHART && IsXMLToken( rLocalName, XML_CHART ) ) { - pContext = mrImportHelper.CreateChartContext( GetImport(), + xContext = mrImportHelper.CreateChartContext( GetImport(), nPrefix, rLocalName, GetImport().GetModel(), xAttrList ); @@ -188,14 +188,14 @@ SvXMLImportContext* SchXMLBodyContext::CreateChildContext( IsXMLToken( rLocalName, XML_CALCULATION_SETTINGS )) { // i99104 handle null date correctly - pContext = new SchXMLCalculationSettingsContext ( GetImport(), nPrefix, rLocalName, xAttrList); + xContext = new SchXMLCalculationSettingsContext ( GetImport(), nPrefix, rLocalName, xAttrList); } else { - pContext = SvXMLImportContext::CreateChildContext( nPrefix, rLocalName, xAttrList ); + xContext = SvXMLImportContext::CreateChildContext( nPrefix, rLocalName, xAttrList ); } - return pContext; + return xContext; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |