diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-10-17 12:04:45 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-10-17 12:58:33 +0200 |
commit | 01b9fdb2712e1a10e9a24b11976bb4fb94ac5bd9 (patch) | |
tree | ca63ab42450d81ea3a4b2df04f704ed47db07bb7 /include | |
parent | d728492f4aa195fd4aec3ddb116879de76a95c6d (diff) |
loplugin:useuniqueptr in tools/inetmsg.hxx
Change-Id: Ifdf0da7f59af1777f214cbafeb75b46136775f67
Reviewed-on: https://gerrit.libreoffice.org/43450
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include')
-rw-r--r-- | include/tools/inetmsg.hxx | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/include/tools/inetmsg.hxx b/include/tools/inetmsg.hxx index bb99ee3296be..e1b26dbe43b7 100644 --- a/include/tools/inetmsg.hxx +++ b/include/tools/inetmsg.hxx @@ -28,6 +28,7 @@ #include <vector> #include <map> +#include <memory> class DateTime; @@ -72,14 +73,15 @@ enum class InetMessageMime class SAL_WARN_UNUSED TOOLS_DLLPUBLIC INetMIMEMessage { - ::std::vector< INetMessageHeader* > + ::std::vector< std::unique_ptr<INetMessageHeader> > m_aHeaderList; SvLockBytesRef m_xDocLB; ::std::map<InetMessageMime, sal_uIntPtr> m_nMIMEIndex; INetMIMEMessage* pParent; - ::std::vector< INetMIMEMessage* > aChildren; + ::std::vector< std::unique_ptr<INetMIMEMessage> > + aChildren; OString m_aBoundary; OUString GetHeaderValue_Impl ( @@ -99,12 +101,11 @@ class SAL_WARN_UNUSED TOOLS_DLLPUBLIC INetMIMEMessage if (m_aHeaderList.size() <= rnIndex) { rnIndex = m_aHeaderList.size(); - m_aHeaderList.push_back( p ); + m_aHeaderList.emplace_back( p ); } else { - delete m_aHeaderList[ rnIndex ]; - m_aHeaderList[ rnIndex ] = p; + m_aHeaderList[ rnIndex ].reset(p); } } @@ -170,12 +171,12 @@ public: INetMIMEMessage* GetChild (sal_uIntPtr nIndex) const { - return ( nIndex < aChildren.size() ) ? aChildren[ nIndex ] : nullptr; + return ( nIndex < aChildren.size() ) ? aChildren[ nIndex ].get() : nullptr; } INetMIMEMessage* GetParent() const { return pParent; } void EnableAttachMultipartFormDataChild(); - void AttachChild( INetMIMEMessage& rChildMsg ); + void AttachChild( std::unique_ptr<INetMIMEMessage> pChildMsg ); const OString& GetMultipartBoundary() const { return m_aBoundary; } }; |