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

Stephan Bergmann sbergman at redhat.com
Sun Feb 26 21:00:57 UTC 2017


 connectivity/source/drivers/dbase/DTable.cxx |   11 ++++++-----
 connectivity/source/parse/sqlnode.cxx        |    2 +-
 2 files changed, 7 insertions(+), 6 deletions(-)

New commits:
commit a407e4da6564d0ab316d7e0e4f4e876a798181d0
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sun Feb 26 22:00:26 2017 +0100

    loplugin:loopvartoosmall
    
    Change-Id: Ib90fb2c3f4d976dce764d4c91af797351317397b

diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx
index fba7c5f..5dffd41 100644
--- a/connectivity/source/drivers/dbase/DTable.cxx
+++ b/connectivity/source/drivers/dbase/DTable.cxx
@@ -54,6 +54,7 @@
 #include <rtl/strbuf.hxx>
 
 #include <algorithm>
+#include <cassert>
 
 using namespace ::comphelper;
 using namespace connectivity;
@@ -1679,7 +1680,6 @@ bool ODbaseTable::UpdateBuffer(OValueRefVector& rRow, const OValueRefRow& pOrgRo
     // Update fields:
     Reference<XPropertySet> xCol;
     Reference<XPropertySet> xIndex;
-    sal_uInt16 i;
     OUString aColName;
     const sal_Int32 nColumnCount = m_pColumns->getCount();
     std::vector< Reference<XPropertySet> > aIndexedCols(nColumnCount);
@@ -1688,7 +1688,7 @@ bool ODbaseTable::UpdateBuffer(OValueRefVector& rRow, const OValueRefRow& pOrgRo
 
     Reference<XIndexAccess> xColumns = m_pColumns;
     // first search a key that exist already in the table
-    for (i = 0; i < nColumnCount; ++i)
+    for (sal_Int32 i = 0; i < nColumnCount; ++i)
     {
         sal_Int32 nPos = i;
         if(_xCols != xColumns)
@@ -1746,14 +1746,15 @@ bool ODbaseTable::UpdateBuffer(OValueRefVector& rRow, const OValueRefRow& pOrgRo
 
     // when we are here there is no double key in the table
 
-    for (i = 0; i < nColumnCount && nByteOffset <= m_nBufferSize ; ++i)
+    for (sal_Int32 i = 0; i < nColumnCount && nByteOffset <= m_nBufferSize ; ++i)
     {
         // Lengths for each data type:
-        OSL_ENSURE(i < m_aPrecisions.size(),"Illegal index!");
+        assert(i >= 0);
+        OSL_ENSURE(sal_uInt32(i) < m_aPrecisions.size(),"Illegal index!");
         sal_Int32 nLen = 0;
         sal_Int32 nType = 0;
         sal_Int32 nScale = 0;
-        if ( i < m_aPrecisions.size() )
+        if ( sal_uInt32(i) < m_aPrecisions.size() )
         {
             nLen    = m_aPrecisions[i];
             nType   = m_aTypes[i];
diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx
index d2e88a9..b2f1d43 100644
--- a/connectivity/source/parse/sqlnode.cxx
+++ b/connectivity/source/parse/sqlnode.cxx
@@ -1664,7 +1664,7 @@ bool OSQLParseNode::operator==(OSQLParseNode& rParseNode) const
     bResult = bResult && !SQL_ISRULE(this, parameter);
 
     // compare children
-    for (sal_uInt32 i=0; bResult && i < count(); i++)
+    for (size_t i=0; bResult && i < count(); i++)
         bResult = *getChild(i) == *rParseNode.getChild(i);
 
     return bResult;


More information about the Libreoffice-commits mailing list