diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-16 14:16:55 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-17 06:41:54 +0000 |
commit | 90df5ee10727719aa1407ed4d1f06d7a790d6871 (patch) | |
tree | cac021b05b025d0e89c6beed20af4578cf34f437 /sax | |
parent | d33d2a65a4ee54780ac005334bee176ddeec68fc (diff) |
new loplugin: useuniqueptr: jvmfwk..sax
Change-Id: I732e2e22c6f953f0982fbc8833453e7c23cf9d49
Reviewed-on: https://gerrit.libreoffice.org/33166
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sax')
-rw-r--r-- | sax/source/expatwrap/sax_expat.cxx | 16 | ||||
-rw-r--r-- | sax/source/expatwrap/saxwriter.cxx | 11 |
2 files changed, 7 insertions, 20 deletions
diff --git a/sax/source/expatwrap/sax_expat.cxx b/sax/source/expatwrap/sax_expat.cxx index ba87c6f9e146..9330749185f4 100644 --- a/sax/source/expatwrap/sax_expat.cxx +++ b/sax/source/expatwrap/sax_expat.cxx @@ -105,7 +105,6 @@ class SaxExpatParser public: SaxExpatParser(); - virtual ~SaxExpatParser() override; // css::lang::XInitialization: virtual void SAL_CALL initialize(css::uno::Sequence<css::uno::Any> const& rArguments) @@ -134,9 +133,7 @@ public: // XServiceInfo sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw (std::exception) override; private: - - SaxExpatParser_Impl *m_pImpl; - + std::unique_ptr<SaxExpatParser_Impl> m_pImpl; }; @@ -365,9 +362,9 @@ private: SaxExpatParser::SaxExpatParser( ) { - m_pImpl = new SaxExpatParser_Impl; + m_pImpl.reset( new SaxExpatParser_Impl ); - LocatorImpl *pLoc = new LocatorImpl( m_pImpl ); + LocatorImpl *pLoc = new LocatorImpl( m_pImpl.get() ); m_pImpl->rDocumentLocator.set( pLoc ); // Performance-improvement; handing out the same object with every call of @@ -378,11 +375,6 @@ SaxExpatParser::SaxExpatParser( ) m_pImpl->bRTExceptionWasThrown = false; } -SaxExpatParser::~SaxExpatParser() -{ - delete m_pImpl; -} - // css::lang::XInitialization: void SAL_CALL SaxExpatParser::initialize(css::uno::Sequence< css::uno::Any > const& rArguments) @@ -440,7 +432,7 @@ void SaxExpatParser::parseStream( const InputSource& structSource) } // set all necessary C-Callbacks - XML_SetUserData( entity.pParser , m_pImpl ); + XML_SetUserData( entity.pParser, m_pImpl.get() ); XML_SetElementHandler( entity.pParser , call_callbackStartElement , call_callbackEndElement ); diff --git a/sax/source/expatwrap/saxwriter.cxx b/sax/source/expatwrap/saxwriter.cxx index 9074688260e5..50deb1f04768 100644 --- a/sax/source/expatwrap/saxwriter.cxx +++ b/sax/source/expatwrap/saxwriter.cxx @@ -884,10 +884,6 @@ public: , m_nLevel(0) { } - virtual ~SAXWriter() override - { - delete m_pSaxWriterHelper; - } public: // XActiveDataSource virtual void SAL_CALL setOutputStream(const Reference< XOutputStream > & aStream) @@ -901,8 +897,7 @@ public: // XActiveDataSource else { m_out = aStream; - delete m_pSaxWriterHelper; - m_pSaxWriterHelper = new SaxWriterHelper(m_out); + m_pSaxWriterHelper.reset( new SaxWriterHelper(m_out) ); m_bDocStarted = false; m_nLevel = 0; m_bIsCDATA = false; @@ -965,8 +960,8 @@ public: // XServiceInfo private: sal_Int32 getIndentPrefixLength( sal_Int32 nFirstLineBreakOccurrence ) throw(); - Reference< XOutputStream > m_out; - SaxWriterHelper* m_pSaxWriterHelper; + Reference< XOutputStream > m_out; + std::unique_ptr<SaxWriterHelper> m_pSaxWriterHelper; // Status information bool m_bDocStarted : 1; |