diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-11 13:04:35 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-16 06:10:36 +0000 |
commit | 0b272cdf0025ce4bca31ee01c8b3aaca042dcb62 (patch) | |
tree | e5d3ec93289598ebfe0121e7a3d0c880c3054844 /svx/source/dialog/srchdlg.cxx | |
parent | 570d8dab6d6754ab8020cbe6624020dff7b8b624 (diff) |
new loplugin: useuniqueptr: svx
Change-Id: I0eb3d43d7bcfc491df16a72997a0720a6aec2c5c
Reviewed-on: https://gerrit.libreoffice.org/32959
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx/source/dialog/srchdlg.cxx')
-rw-r--r-- | svx/source/dialog/srchdlg.cxx | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx index 5d6e3567308c..a7f025d1c11d 100644 --- a/svx/source/dialog/srchdlg.cxx +++ b/svx/source/dialog/srchdlg.cxx @@ -118,7 +118,7 @@ struct SearchDlg_Impl { bool bSaveToModule : 1, bFocusOnSearch : 1; - sal_uInt16* pRanges; + std::unique_ptr<sal_uInt16[]> pRanges; Timer aSelectionTimer; uno::Reference< frame::XDispatch > xCommand1Dispatch; @@ -129,7 +129,6 @@ struct SearchDlg_Impl SearchDlg_Impl() : bSaveToModule(true) , bFocusOnSearch(true) - , pRanges(nullptr) { aCommand1URL.Complete = aCommand1URL.Main = "vnd.sun.search:SearchViaComponent1"; aCommand1URL.Protocol = "vnd.sun.search:"; @@ -138,7 +137,7 @@ struct SearchDlg_Impl aCommand2URL.Protocol = "vnd.sun.search:"; aCommand2URL.Path = "SearchViaComponent2"; } - ~SearchDlg_Impl() { delete[] pRanges; } + ~SearchDlg_Impl() {} }; void ListToStrArr_Impl( sal_uInt16 nId, std::vector<OUString>& rStrLst, ComboBox& rCBox ) @@ -1080,8 +1079,8 @@ void SvxSearchDialog::InitAttrList_Impl( const SfxItemSet* pSSet, pPtr += 2; } nCnt = pPtr - pTmp + 1; - pImpl->pRanges = new sal_uInt16[nCnt]; - memcpy( pImpl->pRanges, pTmp, sizeof(sal_uInt16) * nCnt ); + pImpl->pRanges.reset( new sal_uInt16[nCnt] ); + memcpy( pImpl->pRanges.get(), pTmp, sizeof(sal_uInt16) * nCnt ); } // See to it that are the texts of the attributes are correct @@ -1979,7 +1978,7 @@ IMPL_LINK_NOARG(SvxSearchDialog, FormatHdl_Impl, Button*, void) return; sal_sSize nCnt = 0; - const sal_uInt16* pPtr = pImpl->pRanges; + const sal_uInt16* pPtr = pImpl->pRanges.get(); const sal_uInt16* pTmp = pPtr; while( *pTmp ) @@ -2110,7 +2109,7 @@ IMPL_LINK_NOARG(SvxSearchDialog, AttributeHdl_Impl, Button*, void) SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); if(pFact) { - ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateSvxSearchAttributeDialog( this, *pSearchList, pImpl->pRanges )); + ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateSvxSearchAttributeDialog( this, *pSearchList, pImpl->pRanges.get() )); DBG_ASSERT(pDlg, "Dialog creation failed!"); pDlg->Execute(); } |