[Libreoffice-commits] core.git: compilerplugins/clang dbaccess/source

Noel Grandin noel.grandin at collabora.co.uk
Mon May 28 11:55:02 UTC 2018


 compilerplugins/clang/useuniqueptr.cxx |    3 ++
 dbaccess/source/ui/dlg/dbwiz.cxx       |   34 ++++++++++++++++-----------------
 dbaccess/source/ui/inc/dbwiz.hxx       |    2 -
 3 files changed, 21 insertions(+), 18 deletions(-)

New commits:
commit f66510f1da3ab0584cd13e55f59728f7a2f2f488
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Fri May 18 13:44:18 2018 +0200

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

diff --git a/compilerplugins/clang/useuniqueptr.cxx b/compilerplugins/clang/useuniqueptr.cxx
index 4dc5b85dbf3b..2424bcca8c09 100644
--- a/compilerplugins/clang/useuniqueptr.cxx
+++ b/compilerplugins/clang/useuniqueptr.cxx
@@ -59,6 +59,9 @@ public:
         // horrible horrible spawn of evil ownership and deletion here
         if (fn == SRCDIR "/sfx2/source/view/ipclient.cxx")
             return;
+        // sometimes it owns, sometimes it doesn't
+        if (fn == SRCDIR "/editeng/source/misc/svxacorr.cxx")
+            return;
 
         TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
     }
diff --git a/dbaccess/source/ui/dlg/dbwiz.cxx b/dbaccess/source/ui/dlg/dbwiz.cxx
index 4bbbc7c7c052..106f028f029e 100644
--- a/dbaccess/source/ui/dlg/dbwiz.cxx
+++ b/dbaccess/source/ui/dlg/dbwiz.cxx
@@ -74,7 +74,7 @@ ODbTypeWizDialog::ODbTypeWizDialog(vcl::Window* _pParent
     m_pImpl.reset(new ODbDataSourceAdministrationHelper(_rxORB,this,this));
     m_pImpl->setDataSourceOrName(_aDataSourceName);
     Reference< XPropertySet > xDatasource = m_pImpl->getCurrentDataSource();
-    m_pOutSet = new SfxItemSet( *_pItems->GetPool(), _pItems->GetRanges() );
+    m_pOutSet.reset(new SfxItemSet( *_pItems->GetPool(), _pItems->GetRanges() ));
 
     m_pImpl->translateProperties(xDatasource, *m_pOutSet);
     m_eType = dbaui::ODbDataSourceAdministrationHelper::getDatasourceType(*m_pOutSet);
@@ -104,7 +104,7 @@ ODbTypeWizDialog::~ODbTypeWizDialog()
 
 void ODbTypeWizDialog::dispose()
 {
-    delete m_pOutSet;
+    m_pOutSet.reset();
     svt::OWizardMachine::dispose();
 }
 
@@ -197,12 +197,12 @@ WizardTypes::WizardState ODbTypeWizDialog::determineNextState( WizardState _nCur
 
 const SfxItemSet* ODbTypeWizDialog::getOutputSet() const
 {
-    return m_pOutSet;
+    return m_pOutSet.get();
 }
 
 SfxItemSet* ODbTypeWizDialog::getWriteOutputSet()
 {
-    return m_pOutSet;
+    return m_pOutSet.get();
 }
 
 std::pair< Reference<XConnection>,bool> ODbTypeWizDialog::createConnection()
@@ -245,39 +245,39 @@ VclPtr<TabPage> ODbTypeWizDialog::createPage(WizardState _nState)
         }
         break;
         case CONNECTION_PAGE:
-            pPage = OConnectionTabPage::Create(this,m_pOutSet);
+            pPage = OConnectionTabPage::Create(this,m_pOutSet.get());
             pStringId = STR_PAGETITLE_CONNECTION;
             break;
 
         case ADDITIONAL_PAGE_DBASE:
-            pPage = ODriversSettings::CreateDbase(this,m_pOutSet);
+            pPage = ODriversSettings::CreateDbase(this,m_pOutSet.get());
             break;
         case ADDITIONAL_PAGE_FLAT:
-            pPage = ODriversSettings::CreateText(this,m_pOutSet);
+            pPage = ODriversSettings::CreateText(this,m_pOutSet.get());
             break;
         case ADDITIONAL_PAGE_LDAP:
-            pPage = ODriversSettings::CreateLDAP(this,m_pOutSet);
+            pPage = ODriversSettings::CreateLDAP(this,m_pOutSet.get());
             break;
         case ADDITIONAL_PAGE_MYSQL_JDBC:
-            pPage = ODriversSettings::CreateMySQLJDBC(this,m_pOutSet);
+            pPage = ODriversSettings::CreateMySQLJDBC(this,m_pOutSet.get());
             break;
         case ADDITIONAL_PAGE_MYSQL_NATIVE:
-            pPage = ODriversSettings::CreateMySQLNATIVE(this,m_pOutSet);
+            pPage = ODriversSettings::CreateMySQLNATIVE(this,m_pOutSet.get());
             break;
         case ADDITIONAL_PAGE_MYSQL_ODBC:
-            pPage = ODriversSettings::CreateMySQLODBC(this,m_pOutSet);
+            pPage = ODriversSettings::CreateMySQLODBC(this,m_pOutSet.get());
             break;
         case ADDITIONAL_PAGE_ORACLE_JDBC:
-            pPage = ODriversSettings::CreateOracleJDBC(this,m_pOutSet);
+            pPage = ODriversSettings::CreateOracleJDBC(this,m_pOutSet.get());
             break;
         case ADDITIONAL_PAGE_ADO:
-            pPage = ODriversSettings::CreateAdo(this,m_pOutSet);
+            pPage = ODriversSettings::CreateAdo(this,m_pOutSet.get());
             break;
         case ADDITIONAL_PAGE_ODBC:
-            pPage = ODriversSettings::CreateODBC(this,m_pOutSet);
+            pPage = ODriversSettings::CreateODBC(this,m_pOutSet.get());
             break;
         case ADDITIONAL_USERDEFINED:
-            pPage = ODriversSettings::CreateUser(this,m_pOutSet);
+            pPage = ODriversSettings::CreateUser(this,m_pOutSet.get());
             break;
         default:
             OSL_FAIL("Wrong state!");
@@ -301,7 +301,7 @@ bool ODbTypeWizDialog::leaveState(WizardState _nState)
 {
     SfxTabPage* pPage = static_cast<SfxTabPage*>(WizardDialog::GetPage(_nState));
     if ( pPage )
-        pPage->FillItemSet(m_pOutSet);
+        pPage->FillItemSet(m_pOutSet.get());
     return true;
 }
 
@@ -325,7 +325,7 @@ void ODbTypeWizDialog::saveDatasource()
 {
     SfxTabPage* pPage = static_cast<SfxTabPage*>(WizardDialog::GetPage(getCurrentState()));
     if ( pPage )
-        pPage->FillItemSet(m_pOutSet);
+        pPage->FillItemSet(m_pOutSet.get());
 
     OUString sOldURL;
     if ( m_pImpl->getCurrentDataSource().is() )
diff --git a/dbaccess/source/ui/inc/dbwiz.hxx b/dbaccess/source/ui/inc/dbwiz.hxx
index 14a7ef675fd6..3a02170da565 100644
--- a/dbaccess/source/ui/inc/dbwiz.hxx
+++ b/dbaccess/source/ui/inc/dbwiz.hxx
@@ -54,7 +54,7 @@ class ODbTypeWizDialog : public svt::OWizardMachine , public IItemSetHelper, pub
 {
 private:
     std::unique_ptr<ODbDataSourceAdministrationHelper>  m_pImpl;
-    SfxItemSet*             m_pOutSet;
+    std::unique_ptr<SfxItemSet> m_pOutSet;
     ::dbaccess::ODsnTypeCollection*
                             m_pCollection;  /// the DSN type collection instance
     OUString                m_eType;


More information about the Libreoffice-commits mailing list