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

Stephan Bergmann sbergman at redhat.com
Tue Oct 13 08:40:54 PDT 2015


 dbaccess/source/core/api/RowSetCache.cxx |   17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

New commits:
commit 7ea5ad6e46b92bc9020c6332b46b20671fa85c5b
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Oct 13 17:35:11 2015 +0200

    Assumed fix of a clang-analyzer-deadcode.DeadStores
    
    ...where the "bOk = false" from the leading "if" is always overwritten in the
    following check of "bOk = sTableRange == _sUpdateTableName".  The code had been
    effectively like that ever since it got introduced with
    4ae41a466ad659524809c23c9086df70c5456a39 "INTEGRATION: CWS dba30," but it looks
    broken.  I assume the two checks of "sTableRange == _sUpdateTableName" for
    pNode->GetChild(0) and pNode->GetChild(2) shall only be done if the leading "if"
    is not hit.  (And one remaining uncertainty is if really only one of those
    "sTableRange == _sUpdateTableName" checks needs to be true or if both should be
    true for bOk to be true.)
    
    Change-Id: I453690d65326ed67d7a074d4e4783a743a60d454

diff --git a/dbaccess/source/core/api/RowSetCache.cxx b/dbaccess/source/core/api/RowSetCache.cxx
index bbc30b3..0a713d8 100644
--- a/dbaccess/source/core/api/RowSetCache.cxx
+++ b/dbaccess/source/core/api/RowSetCache.cxx
@@ -1551,13 +1551,16 @@ bool ORowSetCache::checkInnerJoin(const ::connectivity::OSQLParseNode *pNode,con
         {
             bOk = false;
         }
-        OUString sColumnName,sTableRange;
-        OSQLParseTreeIterator::getColumnRange( pNode->getChild(0), _xConnection, sColumnName, sTableRange );
-        bOk = sTableRange == _sUpdateTableName;
-        if ( !bOk )
+        else
         {
-            OSQLParseTreeIterator::getColumnRange( pNode->getChild(2), _xConnection, sColumnName, sTableRange );
-            bOk =  sTableRange == _sUpdateTableName;
+            OUString sColumnName,sTableRange;
+            OSQLParseTreeIterator::getColumnRange( pNode->getChild(0), _xConnection, sColumnName, sTableRange );
+            bOk = sTableRange == _sUpdateTableName;
+            if ( !bOk )
+            {
+                OSQLParseTreeIterator::getColumnRange( pNode->getChild(2), _xConnection, sColumnName, sTableRange );
+                bOk =  sTableRange == _sUpdateTableName;
+            }
         }
     }
     return bOk;
commit 2c5f5976b2afe22589244802e1f3b2e47811fdbe
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Oct 13 16:01:28 2015 +0200

    clang-analyzer-deadcode.DeadStores
    
    In 8b9e4e393eff8b89a37a5932548700c0b50bcab8 "initial import" the assignment to
    bCheck was in a for loop that used bCheck in its condition,
    
      sal_Int32 nPos = m_nStartPos+1;
      for(; aIter != m_pMatrix->end() && bCheck;)
      {
          if(!aIter->isValid())
              ...
          m_pCacheSet->fillValueRow(*aIter++,nPos++);
          bCheck = m_pCacheSet->next();
      }
    
    that loop was then replaced with
    
      sal_Int32 nPos = m_nStartPos;
      bCheck = fill(aIter,m_pMatrix->end(),nPos,bCheck);
    
    (without further use of bCheck) in 2facbebb88fe72614d566c3187c8f86c5c61f8bd
    "MWS_SRX644: migrate branch mws_srx644 -> HEAD" (and the braces around
    
      {
          ORowSetMatrix::iterator aIter(aEnd);
          sal_Int32 nPos = m_nStartPos + 1;
          bCheck = fill(aIter, m_pMatrix->end(), nPos, bCheck);
      }
    
    introduced in 1234d599d4ee67bd725f0513431b2d4c56c9e09d "ORowSetCache: overhaul
    internals," presumably to limit the scope of that aIter introduced there).
    
    Change-Id: I1cf4a22fbd1b76d524251a82c3ab4e6ca7a9eca1

diff --git a/dbaccess/source/core/api/RowSetCache.cxx b/dbaccess/source/core/api/RowSetCache.cxx
index fe21eae..bbc30b3 100644
--- a/dbaccess/source/core/api/RowSetCache.cxx
+++ b/dbaccess/source/core/api/RowSetCache.cxx
@@ -926,7 +926,7 @@ bool ORowSetCache::moveWindow()
                 {
                     ORowSetMatrix::iterator aIter(aEnd);
                     sal_Int32 nPos = m_nStartPos + 1;
-                    bCheck = fill(aIter, aNewEnd, nPos, bCheck);
+                    fill(aIter, aNewEnd, nPos, bCheck);
                 }
 
                 ::std::rotate(m_pMatrix->begin(), aEnd, aNewEnd);


More information about the Libreoffice-commits mailing list