desktop/source/deployment/gui/dp_gui_theextmgr.cxx | 7 ++----- desktop/source/deployment/gui/dp_gui_theextmgr.hxx | 4 ++-- lotuswordpro/source/filter/explode.cxx | 18 ++++-------------- lotuswordpro/source/filter/explode.hxx | 5 +++-- 4 files changed, 11 insertions(+), 23 deletions(-)
New commits: commit 4eca66541bbe77767f29138f6d0265229d61173d Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Thu Mar 1 10:23:22 2018 +0200 loplugin:useuniqueptr in HuffmanTreeNode Change-Id: I30655c5ad44c93968ec39938ced9854105a831dd Reviewed-on: https://gerrit.libreoffice.org/50716 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/lotuswordpro/source/filter/explode.cxx b/lotuswordpro/source/filter/explode.cxx index 7f60a9dfa737..497252d1d67a 100644 --- a/lotuswordpro/source/filter/explode.cxx +++ b/lotuswordpro/source/filter/explode.cxx @@ -459,16 +459,6 @@ HuffmanTreeNode::HuffmanTreeNode(sal_uInt32 nValue ) } HuffmanTreeNode::~HuffmanTreeNode() { - if (left) - { - delete left; - left = nullptr; - } - if (right) - { - delete right; - right = nullptr; - } } HuffmanTreeNode * HuffmanTreeNode::InsertNode(sal_uInt32 nValue, const sal_Char * pInCode) @@ -485,9 +475,9 @@ HuffmanTreeNode * HuffmanTreeNode::InsertNode(sal_uInt32 nValue, const sal_Char pParent = InsertNode(0xffffffff, aCode.c_str()); } if (cLast == '0') - pParent->left = pNew; + pParent->left.reset(pNew); else // (cChar == '1') - pParent->right = pNew; + pParent->right.reset(pNew); return pNew; } @@ -502,11 +492,11 @@ HuffmanTreeNode * HuffmanTreeNode::QueryNode(const sal_Char * pCode) sal_Char cChar= pCode[i]; if (cChar == '0') { - pNode = pNode->left; + pNode = pNode->left.get(); } else // (cChar == '1') { - pNode = pNode->right; + pNode = pNode->right.get(); } } return pNode; diff --git a/lotuswordpro/source/filter/explode.hxx b/lotuswordpro/source/filter/explode.hxx index 013bb6bc881c..1b8cc587811c 100644 --- a/lotuswordpro/source/filter/explode.hxx +++ b/lotuswordpro/source/filter/explode.hxx @@ -57,14 +57,15 @@ #define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_EXPLODE_HXX #include <sal/types.h> +#include <memory> class SvStream; class HuffmanTreeNode { public: - HuffmanTreeNode * left; - HuffmanTreeNode * right; + std::unique_ptr<HuffmanTreeNode> left; + std::unique_ptr<HuffmanTreeNode> right; sal_uInt32 value; explicit HuffmanTreeNode(sal_uInt32 value = 0xffffffff) ; commit 4516546b9efeeaa7cffe608fca8b544230aee3f1 Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Thu Mar 1 09:58:58 2018 +0200 loplugin:useuniqueptr in TheExtensionManager Change-Id: Ic45feadb64410b3f7833edd52af118436cd9763d Reviewed-on: https://gerrit.libreoffice.org/50715 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx index b9dd8cd947f5..ca84148ec7de 100644 --- a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx +++ b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx @@ -104,7 +104,6 @@ TheExtensionManager::~TheExtensionManager() { m_pUpdReqDialog.disposeAndClear(); m_pExtMgrDialog.disposeAndClear(); - delete m_pExecuteCmdQueue; } @@ -117,8 +116,7 @@ void TheExtensionManager::createDialog( const bool bCreateUpdDlg ) if ( !m_pUpdReqDialog ) { m_pUpdReqDialog = VclPtr<UpdateRequiredDialog>::Create( nullptr, this ); - delete m_pExecuteCmdQueue; - m_pExecuteCmdQueue = new ExtensionCmdQueue( m_pUpdReqDialog.get(), this, m_xContext ); + m_pExecuteCmdQueue.reset( new ExtensionCmdQueue( m_pUpdReqDialog.get(), this, m_xContext ) ); createPackageList(); } } @@ -128,8 +126,7 @@ void TheExtensionManager::createDialog( const bool bCreateUpdDlg ) m_pExtMgrDialog = VclPtr<ExtMgrDialog>::Create( VCLUnoHelper::GetWindow(m_xParent), this ); else m_pExtMgrDialog = VclPtr<ExtMgrDialog>::Create( nullptr, this, Dialog::InitFlag::NoParent ); - delete m_pExecuteCmdQueue; - m_pExecuteCmdQueue = new ExtensionCmdQueue( m_pExtMgrDialog.get(), this, m_xContext ); + m_pExecuteCmdQueue.reset( new ExtensionCmdQueue( m_pExtMgrDialog.get(), this, m_xContext ) ); m_pExtMgrDialog->setGetExtensionsURL( m_sGetExtensionsURL ); createPackageList(); } diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.hxx b/desktop/source/deployment/gui/dp_gui_theextmgr.hxx index 3437249efd81..5db21a5a40ca 100644 --- a/desktop/source/deployment/gui/dp_gui_theextmgr.hxx +++ b/desktop/source/deployment/gui/dp_gui_theextmgr.hxx @@ -55,7 +55,7 @@ private: css::uno::Reference< css::awt::XWindow > m_xParent; VclPtr<ExtMgrDialog> m_pExtMgrDialog; VclPtr<UpdateRequiredDialog> m_pUpdReqDialog; - ExtensionCmdQueue *m_pExecuteCmdQueue; + std::unique_ptr<ExtensionCmdQueue> m_pExecuteCmdQueue; OUString m_sGetExtensionsURL; bool m_bModified; @@ -85,7 +85,7 @@ public: return m_pExtMgrDialog.get(); return m_pUpdReqDialog.get(); } - ExtensionCmdQueue* getCmdQueue() const { return m_pExecuteCmdQueue; } + ExtensionCmdQueue* getCmdQueue() const { return m_pExecuteCmdQueue.get(); } void SetText( const OUString &rTitle ); void Show(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits