[Libreoffice-commits] core.git: include/sfx2 sfx2/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Sep 25 09:10:03 UTC 2018


 include/sfx2/dinfdlg.hxx       |    2 +-
 sfx2/source/dialog/dinfdlg.cxx |   16 ++++------------
 2 files changed, 5 insertions(+), 13 deletions(-)

New commits:
commit e68520937281cc97542b7eb27e8736148d16fae4
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Sep 19 12:22:19 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Sep 25 11:09:41 2018 +0200

    loplugin:useuniqueptr in CmisPropertiesWindow
    
    Change-Id: I113160675aa7af0a3a425fe0cab4f68ee24adf27
    Reviewed-on: https://gerrit.libreoffice.org/60956
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/sfx2/dinfdlg.hxx b/include/sfx2/dinfdlg.hxx
index 39a738b3edba..a4b7e680c6e3 100644
--- a/include/sfx2/dinfdlg.hxx
+++ b/include/sfx2/dinfdlg.hxx
@@ -570,7 +570,7 @@ private:
     VclPtr<VclBox>                      m_pBox;
     sal_Int32                           m_nItemHeight;
     SvNumberFormatter                   m_aNumberFormatter;
-    std::vector< CmisPropertyLine* >    m_aCmisPropertiesLines;
+    std::vector< std::unique_ptr<CmisPropertyLine> > m_aCmisPropertiesLines;
 public:
     CmisPropertiesWindow(SfxTabPage* pParent);
     ~CmisPropertiesWindow();
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index a42a83f4be62..c68ba3876925 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -2278,13 +2278,6 @@ CmisPropertiesWindow::~CmisPropertiesWindow()
 
 void CmisPropertiesWindow::ClearAllLines()
 {
-    std::vector< CmisPropertyLine* >::iterator pIter;
-    for ( pIter = m_aCmisPropertiesLines.begin();
-          pIter != m_aCmisPropertiesLines.end(); ++pIter )
-    {
-        CmisPropertyLine* pLine = *pIter;
-        delete pLine;
-    }
     m_aCmisPropertiesLines.clear();
 }
 
@@ -2293,7 +2286,7 @@ void CmisPropertiesWindow::AddLine( const OUString& sId, const OUString& sName,
                                     const bool bRequired, const bool bMultiValued,
                                     const bool bOpenChoice, Any& /*aChoices*/, Any const & rAny )
 {
-    CmisPropertyLine* pNewLine = new CmisPropertyLine( m_pBox );
+    std::unique_ptr<CmisPropertyLine> pNewLine(new CmisPropertyLine( m_pBox ));
 
     pNewLine->m_sId = sId;
     pNewLine->m_sType = sType;
@@ -2376,7 +2369,7 @@ void CmisPropertiesWindow::AddLine( const OUString& sId, const OUString& sName,
     pNewLine->m_aType->SetText( sType );
     pNewLine->m_aType->Show();
 
-    m_aCmisPropertiesLines.push_back( pNewLine );
+    m_aCmisPropertiesLines.push_back( std::move(pNewLine) );
 }
 
 void CmisPropertiesWindow::DoScroll( sal_Int32 nNewPos )
@@ -2388,11 +2381,10 @@ Sequence< document::CmisProperty > CmisPropertiesWindow::GetCmisProperties() con
 {
     Sequence< document::CmisProperty > aPropertiesSeq( m_aCmisPropertiesLines.size() );
     sal_Int32 i = 0;
-    std::vector< CmisPropertyLine* >::const_iterator pIter;
-    for ( pIter = m_aCmisPropertiesLines.begin();
+    for ( auto pIter = m_aCmisPropertiesLines.begin();
             pIter != m_aCmisPropertiesLines.end(); ++pIter, ++i )
     {
-        CmisPropertyLine* pLine = *pIter;
+        CmisPropertyLine* pLine = pIter->get();
 
         aPropertiesSeq[i].Id = pLine->m_sId;
         aPropertiesSeq[i].Type = pLine->m_sType;


More information about the Libreoffice-commits mailing list