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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Aug 16 11:46:21 UTC 2018


 dbaccess/source/core/api/RowSetBase.cxx                    |    6 ++++--
 dbaccess/source/core/api/RowSetCache.cxx                   |    6 ++----
 dbaccess/source/core/api/RowSetCache.hxx                   |    4 ++--
 dbaccess/source/ui/inc/RTableConnectionData.hxx            |    4 ++--
 dbaccess/source/ui/inc/TableWindow.hxx                     |    2 +-
 dbaccess/source/ui/querydesign/TableWindow.cxx             |   11 ++++-------
 dbaccess/source/ui/relationdesign/RTableConnectionData.cxx |   10 +++-------
 dbaccess/source/ui/relationdesign/RelationTableView.cxx    |    5 +++--
 8 files changed, 21 insertions(+), 27 deletions(-)

New commits:
commit 78c6a111548eafe636845256a3ec08d5a58b7e67
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Aug 16 12:07:00 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Aug 16 13:45:58 2018 +0200

    loplugin:returnconstant in dbaccess
    
    Change-Id: I37b7dc7f0a7786089034acc279cb6ed7a6ef863f
    Reviewed-on: https://gerrit.libreoffice.org/58426
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/dbaccess/source/core/api/RowSetBase.cxx b/dbaccess/source/core/api/RowSetBase.cxx
index e1afe5d21a54..2ad5e37b5412 100644
--- a/dbaccess/source/core/api/RowSetBase.cxx
+++ b/dbaccess/source/core/api/RowSetBase.cxx
@@ -1233,11 +1233,13 @@ void ORowSetBase::positionCache( CursorMoveDirection _ePrepareForDirection )
     {
         if ( m_bBeforeFirst )
         {
-            bSuccess = m_pCache->beforeFirst();
+            m_pCache->beforeFirst();
+            bSuccess = true;
         }
         else if ( m_bAfterLast )
         {
-            bSuccess = m_pCache->afterLast();
+            m_pCache->afterLast();
+            bSuccess = true;
         }
         else
         {
diff --git a/dbaccess/source/core/api/RowSetCache.cxx b/dbaccess/source/core/api/RowSetCache.cxx
index 12f6e245e514..6180522ff72b 100644
--- a/dbaccess/source/core/api/RowSetCache.cxx
+++ b/dbaccess/source/core/api/RowSetCache.cxx
@@ -687,7 +687,7 @@ bool ORowSetCache::isLast(  )
     return m_nPosition == m_nRowCount;
 }
 
-bool ORowSetCache::beforeFirst(  )
+void ORowSetCache::beforeFirst(  )
 {
     if(!m_bBeforeFirst)
     {
@@ -698,10 +698,9 @@ bool ORowSetCache::beforeFirst(  )
         moveWindow();
         m_aMatrixIter = m_pMatrix->end();
     }
-    return true;
 }
 
-bool ORowSetCache::afterLast(  )
+void ORowSetCache::afterLast(  )
 {
     if(!m_bAfterLast)
     {
@@ -719,7 +718,6 @@ bool ORowSetCache::afterLast(  )
         m_nPosition = 0;
         m_aMatrixIter = m_pMatrix->end();
     }
-    return true;
 }
 
 bool ORowSetCache::fillMatrix(sal_Int32& _nNewStartPos, sal_Int32 &_nNewEndPos)
diff --git a/dbaccess/source/core/api/RowSetCache.hxx b/dbaccess/source/core/api/RowSetCache.hxx
index 08be66c40108..c00f818a7373 100644
--- a/dbaccess/source/core/api/RowSetCache.hxx
+++ b/dbaccess/source/core/api/RowSetCache.hxx
@@ -172,8 +172,8 @@ namespace dbaccess
         bool isAfterLast(  ) const { return m_bAfterLast;}
         bool isFirst(  );
         bool isLast(  );
-        bool beforeFirst(  );
-        bool afterLast(  );
+        void beforeFirst(  );
+        void afterLast(  );
         bool first(  );
         bool last(  );
         sal_Int32 getRow(  );
diff --git a/dbaccess/source/ui/inc/RTableConnectionData.hxx b/dbaccess/source/ui/inc/RTableConnectionData.hxx
index dfada694fdfb..5a2836fa124c 100644
--- a/dbaccess/source/ui/inc/RTableConnectionData.hxx
+++ b/dbaccess/source/ui/inc/RTableConnectionData.hxx
@@ -74,9 +74,9 @@ namespace dbaui
         sal_Int32    GetDeleteRules() const { return m_nDeleteRules; }
         Cardinality  GetCardinality() const { return m_nCardinality; }
 
-        bool        IsConnectionPossible();
+        void        IsConnectionPossible();
         void        ChangeOrientation();
-        bool        DropRelation();
+        void        DropRelation();
     };
 }
 
diff --git a/dbaccess/source/ui/inc/TableWindow.hxx b/dbaccess/source/ui/inc/TableWindow.hxx
index a83a54832015..306f9cbcd5ea 100644
--- a/dbaccess/source/ui/inc/TableWindow.hxx
+++ b/dbaccess/source/ui/inc/TableWindow.hxx
@@ -87,7 +87,7 @@ namespace dbaui
         virtual void    DataChanged( const DataChangedEvent& rDCEvt ) override;
 
             // called at FIRST Init
-        bool FillListBox();
+        void FillListBox();
             // called at EACH Init
 
         virtual void OnEntryDoubleClicked(SvTreeListEntry* /*pEntry*/) { }
diff --git a/dbaccess/source/ui/querydesign/TableWindow.cxx b/dbaccess/source/ui/querydesign/TableWindow.cxx
index d13b2d49f4e5..2567139cd363 100644
--- a/dbaccess/source/ui/querydesign/TableWindow.cxx
+++ b/dbaccess/source/ui/querydesign/TableWindow.cxx
@@ -179,7 +179,7 @@ void OTableWindow::SetPosSizePixel( const Point& rNewPos, const Size& rNewSize )
     SetSizePixel( rNewSize );
 }
 
-bool OTableWindow::FillListBox()
+void OTableWindow::FillListBox()
 {
     m_xListBox->Clear();
     if ( !m_pContainerListener.is() )
@@ -236,8 +236,6 @@ bool OTableWindow::FillListBox()
     {
         OSL_FAIL("Exception occurred!");
     }
-
-    return true;
 }
 
 void* OTableWindow::createUserData(const Reference< XPropertySet>& /*_xColumn*/,bool /*_bPrimaryKey*/)
@@ -303,13 +301,12 @@ bool OTableWindow::Init()
 
     // add the fields to the ListBox
     clearListBox();
-    bool bSuccess = FillListBox();
-    if ( bSuccess )
-        m_xListBox->SelectAll( false );
+    FillListBox();
+    m_xListBox->SelectAll( false );
 
     impl_updateImage();
 
-    return bSuccess;
+    return true;
 }
 
 void OTableWindow::DataChanged(const DataChangedEvent& rDCEvt)
diff --git a/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx b/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx
index 741c36adebf6..6934ed27fe78 100644
--- a/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx
+++ b/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx
@@ -75,7 +75,7 @@ ORelationTableConnectionData::~ORelationTableConnectionData()
 {
 }
 
-bool ORelationTableConnectionData::DropRelation()
+void ORelationTableConnectionData::DropRelation()
 {
     ::osl::MutexGuard aGuard( m_aMutex );
     // delete relation
@@ -102,7 +102,6 @@ bool ORelationTableConnectionData::DropRelation()
             }
         }
     }
-    return true;
 }
 
 void ORelationTableConnectionData::ChangeOrientation()
@@ -173,15 +172,13 @@ bool ORelationTableConnectionData::checkPrimaryKey(const Reference< XPropertySet
     return nPrimKeysCount && nPrimKeysCount == nValidLinesCount;
 }
 
-bool ORelationTableConnectionData::IsConnectionPossible()
+void ORelationTableConnectionData::IsConnectionPossible()
 {
     ::osl::MutexGuard aGuard( m_aMutex );
 
     // if the SourceFields are a PrimKey, it's only the orientation which is wrong
     if ( IsSourcePrimKey() && !IsDestPrimKey() )
         ChangeOrientation();
-
-    return true;
 }
 
 OConnectionLineDataRef ORelationTableConnectionData::CreateLineDataObj()
@@ -244,8 +241,7 @@ bool ORelationTableConnectionData::Update()
     // delete old relation
     {
         DropRelation();
-        if( !IsConnectionPossible() )
-            return false;
+        IsConnectionPossible();
     }
 
     // reassign the keys because the orientation could be changed
diff --git a/dbaccess/source/ui/relationdesign/RelationTableView.cxx b/dbaccess/source/ui/relationdesign/RelationTableView.cxx
index 86b5b44e48be..233120cc6f37 100644
--- a/dbaccess/source/ui/relationdesign/RelationTableView.cxx
+++ b/dbaccess/source/ui/relationdesign/RelationTableView.cxx
@@ -262,8 +262,9 @@ bool ORelationTableView::RemoveConnection(VclPtr<OTableConnection>& rConn, bool
     ORelationTableConnectionData* pTabConnData = static_cast<ORelationTableConnectionData*>(rConn->GetData().get());
     try
     {
-        if ( m_bInRemove || pTabConnData->DropRelation())
-            return OJoinTableView::RemoveConnection(rConn, true);
+        if (!m_bInRemove)
+            pTabConnData->DropRelation();
+        return OJoinTableView::RemoveConnection(rConn, true);
     }
     catch(SQLException& e)
     {


More information about the Libreoffice-commits mailing list