diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-20 09:54:12 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-21 12:10:07 +0200 |
commit | 9ca80b550216daac3cfb3d373c344c0154fa7df2 (patch) | |
tree | 996bc43dfbb10559ec6430dbf90a6e0a04338237 /xmlscript | |
parent | e159948c4b3143b67fcd5861d9f4f583bc2df3ee (diff) |
loplugin:useuniqueptr in ExtendedAttributes
Change-Id: I86af2614ac9e3282ecd2aba5d23f6a075712968f
Reviewed-on: https://gerrit.libreoffice.org/59351
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmlscript')
-rw-r--r-- | xmlscript/source/xml_helper/xml_impctx.cxx | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/xmlscript/source/xml_helper/xml_impctx.cxx b/xmlscript/source/xml_helper/xml_impctx.cxx index 3ebc809d1cfe..47d8a544b4e6 100644 --- a/xmlscript/source/xml_helper/xml_impctx.cxx +++ b/xmlscript/source/xml_helper/xml_impctx.cxx @@ -310,8 +310,9 @@ class ExtendedAttributes : public: inline ExtendedAttributes( sal_Int32 nAttributes, - sal_Int32 * pUids, - OUString * pLocalNames, OUString * pQNames, + std::unique_ptr<sal_Int32[]> pUids, + std::unique_ptr<OUString[]> pLocalNames, + std::unique_ptr<OUString[]> pQNames, Reference< xml::sax::XAttributeList > const & xAttributeList ); // XAttributes @@ -336,13 +337,13 @@ public: inline ExtendedAttributes::ExtendedAttributes( sal_Int32 nAttributes, - sal_Int32 * pUids, - OUString * pLocalNames, OUString * pQNames, + std::unique_ptr<sal_Int32[]> pUids, + std::unique_ptr<OUString[]> pLocalNames, std::unique_ptr<OUString[]> pQNames, Reference< xml::sax::XAttributeList > const & xAttributeList ) : m_nAttributes( nAttributes ) - , m_pUids( pUids ) - , m_pLocalNames( pLocalNames ) - , m_pQNames( pQNames ) + , m_pUids( std::move(pUids) ) + , m_pLocalNames( std::move(pLocalNames) ) + , m_pQNames( std::move(pQNames) ) , m_pValues( new OUString[ nAttributes ] ) { for ( sal_Int32 nPos = 0; nPos < nAttributes; ++nPos ) @@ -441,10 +442,10 @@ void DocumentHandlerImpl::startElement( sal_Int16 nAttribs = xAttribs->getLength(); // save all namespace ids - sal_Int32 * pUids = new sal_Int32[ nAttribs ]; + std::unique_ptr<sal_Int32[]> pUids(new sal_Int32[ nAttribs ]); OUString * pPrefixes = new OUString[ nAttribs ]; - OUString * pLocalNames = new OUString[ nAttribs ]; - OUString * pQNames = new OUString[ nAttribs ]; + std::unique_ptr<OUString[]> pLocalNames(new OUString[ nAttribs ]); + std::unique_ptr<OUString[]> pQNames(new OUString[ nAttribs ]); // first recognize all xmlns attributes sal_Int16 nPos; @@ -511,7 +512,7 @@ void DocumentHandlerImpl::startElement( // ownership of arrays belongs to attribute list xAttributes = static_cast< xml::input::XAttributes * >( new ExtendedAttributes( - nAttribs, pUids, pLocalNames, pQNames, + nAttribs, std::move(pUids), std::move(pLocalNames), std::move(pQNames), xAttribs ) ); getElementName( rQElementName, &nUid, &aLocalName ); |