From e91aa231ee934b2f18b387f37a6e9017b05f2256 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 29 Jan 2018 09:39:15 +0200 Subject: loplugin:useuniqueptr in SalGtkFilePicker Change-Id: I3cbe4121c1cb323ad00e110bcdb1f61334e656bc Reviewed-on: https://gerrit.libreoffice.org/49131 Tested-by: Jenkins Reviewed-by: Noel Grandin --- vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx | 7 +++---- vcl/unx/gtk/fpicker/SalGtkFilePicker.hxx | 4 +--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx index dfc5274bbb63..95524567d898 100644 --- a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx +++ b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx @@ -82,7 +82,6 @@ void SalGtkFilePicker::InitialMapping() SalGtkFilePicker::SalGtkFilePicker( const uno::Reference< uno::XComponentContext >& xContext ) : SalGtkPicker( xContext ), SalGtkFilePicker_Base( m_rbHelperMtx ), - m_pFilterVector( nullptr ), m_pParentWidget ( nullptr ), m_pVBox ( nullptr ), mnHID_FolderChange( 0 ), @@ -525,7 +524,7 @@ void SalGtkFilePicker::ensureFilterVector( const OUString& _rInitialCurrentFilte { if( !m_pFilterVector ) { - m_pFilterVector = new FilterVector; + m_pFilterVector.reset( new std::vector ); // set the first filter to the current filter if ( m_aCurrentFilter.isEmpty() ) @@ -810,7 +809,7 @@ uno::Sequence SAL_CALL SalGtkFilePicker::getSelectedFiles() if (m_pFilterVector) { - FilterVector::iterator aVectorIter = ::std::find_if( + auto aVectorIter = ::std::find_if( m_pFilterVector->begin(), m_pFilterVector->end(), FilterTitleMatch(sFilterName) ); OUString aFilter; @@ -1969,7 +1968,7 @@ SalGtkFilePicker::~SalGtkFilePicker() gtk_widget_destroy( m_pHBoxs[i] ); } - delete m_pFilterVector; + m_pFilterVector.reset(); gtk_widget_destroy( m_pVBox ); } diff --git a/vcl/unx/gtk/fpicker/SalGtkFilePicker.hxx b/vcl/unx/gtk/fpicker/SalGtkFilePicker.hxx index 8de4131f4778..bac8395a5359 100644 --- a/vcl/unx/gtk/fpicker/SalGtkFilePicker.hxx +++ b/vcl/unx/gtk/fpicker/SalGtkFilePicker.hxx @@ -38,8 +38,6 @@ struct FilterEntry; struct ElementEntry_Impl; -typedef ::std::vector < FilterEntry > FilterVector; - // class declaration typedef cppu::WeakComponentImplHelper< @@ -150,7 +148,7 @@ class SalGtkFilePicker : public SalGtkPicker, public SalGtkFilePicker_Base css::uno::Reference< css::ui::dialogs::XFilePickerListener > m_xListener; OUString msPlayLabel; - FilterVector *m_pFilterVector; + std::unique_ptr> m_pFilterVector; GtkWidget *m_pParentWidget; GtkWidget *m_pVBox; GtkWidget *m_pFilterExpander; -- cgit