xmloff/source/chart/SchXMLExport.cxx | 17 +++++------------ xmloff/source/style/xmlexppr.cxx | 8 +++----- 2 files changed, 8 insertions(+), 17 deletions(-)
New commits: commit 009108aa53896ccd3a2bad4380654d22f7c2206f Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Wed Dec 19 11:01:26 2018 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Thu Dec 20 09:37:03 2018 +0100 use unique_ptr in xmloff Change-Id: I98fc0630308e51fcc5eb0224af77881eebf0ff0f Reviewed-on: https://gerrit.libreoffice.org/65443 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index 8a8e94265dc1..1e59110e84b8 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -2260,7 +2260,7 @@ void SchXMLExportHelper_Impl::exportAxis( bool bExportContent ) { std::vector< XMLPropertyState > aPropertyStates; - SvXMLElementExport* pAxis = nullptr; + std::unique_ptr<SvXMLElementExport> pAxis; // get property states for autostyles if( rAxisProps.is() && mxExpPropMapper.is() ) @@ -2287,7 +2287,7 @@ void SchXMLExportHelper_Impl::exportAxis( bExportDateScale = lcl_exportAxisType( rChart2Axis, mrExport ); // open axis element - pAxis = new SvXMLElementExport( mrExport, XML_NAMESPACE_CHART, XML_AXIS, true, true ); + pAxis.reset(new SvXMLElementExport( mrExport, XML_NAMESPACE_CHART, XML_AXIS, true, true )); } else { @@ -2323,13 +2323,6 @@ void SchXMLExportHelper_Impl::exportAxis( // grid exportGrid( xMajorGridProps, true, bExportContent ); exportGrid( xMinorGridProps, false, bExportContent ); - - if( pAxis ) - { - //close axis element - delete pAxis; - pAxis = nullptr; - } } void SchXMLExportHelper_Impl::exportAxes( @@ -2569,7 +2562,7 @@ void SchXMLExportHelper_Impl::exportSeries( Reference< chart2::data::XDataSource > xSource( aSeriesSeq[nSeriesIdx], uno::UNO_QUERY ); if( xSource.is()) { - SvXMLElementExport* pSeries = nullptr; + std::unique_ptr<SvXMLElementExport> pSeries; Sequence< Reference< chart2::data::XLabeledDataSequence > > aSeqCnt( xSource->getDataSequences()); sal_Int32 nMainSequenceIndex = -1; @@ -2724,7 +2717,7 @@ void SchXMLExportHelper_Impl::exportSeries( XML_NAMESPACE_CHART, GetXMLToken( eCTToken ))); // open series element until end of for loop - pSeries = new SvXMLElementExport( mrExport, XML_NAMESPACE_CHART, XML_SERIES, true, true ); + pSeries.reset(new SvXMLElementExport( mrExport, XML_NAMESPACE_CHART, XML_SERIES, true, true )); } else // autostyles { @@ -2848,7 +2841,7 @@ void SchXMLExportHelper_Impl::exportSeries( } // close series element - delete pSeries; + pSeries.reset(); } } aPropertyStates.clear(); diff --git a/xmloff/source/style/xmlexppr.cxx b/xmloff/source/style/xmlexppr.cxx index 67e41bc60a21..7f85710cc1cf 100644 --- a/xmloff/source/style/xmlexppr.cxx +++ b/xmloff/source/style/xmlexppr.cxx @@ -870,7 +870,7 @@ void SvXMLExportPropertyMapper::_exportXML( uno::Reference< container::XNameContainer > xAttrContainer; if( (rProperty.maValue >>= xAttrContainer) && xAttrContainer.is() ) { - SvXMLNamespaceMap *pNewNamespaceMap = nullptr; + std::unique_ptr<SvXMLNamespaceMap> pNewNamespaceMap; const SvXMLNamespaceMap *pNamespaceMap = &rNamespaceMap; uno::Sequence< OUString > aAttribNames( xAttrContainer->getElementNames() ); @@ -945,8 +945,8 @@ void SvXMLExportPropertyMapper::_exportXML( { if( !pNewNamespaceMap ) { - pNewNamespaceMap = new SvXMLNamespaceMap( rNamespaceMap ); - pNamespaceMap = pNewNamespaceMap; + pNewNamespaceMap.reset(new SvXMLNamespaceMap( rNamespaceMap )); + pNamespaceMap = pNewNamespaceMap.get(); } pNewNamespaceMap->Add( sPrefix, sNamespace ); sNameBuffer.append( GetXMLToken(XML_XMLNS) ).append( ":" ).append( sPrefix ); @@ -961,8 +961,6 @@ void SvXMLExportPropertyMapper::_exportXML( if( sOldValue.isEmpty() ) rAttrList.AddAttribute( sAttribName, aData.Value ); } - - delete pNewNamespaceMap; } else { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits