dbaccess/source/core/api/CacheSet.cxx              |    6 +--
 dbaccess/source/core/api/RowSet.cxx                |   15 ++++++---
 dbaccess/source/core/api/RowSetBase.cxx            |    8 +++-
 dbaccess/source/ui/dlg/directsql.cxx               |    5 ++-
 dbaccess/source/ui/misc/UITools.cxx                |    4 +-
 dbaccess/source/ui/querydesign/QueryDesignView.cxx |   35 +++++++++++++--------
 dbaccess/source/ui/tabledesign/TEditControl.cxx    |    3 +
 7 files changed, 49 insertions(+), 27 deletions(-)

New commits:
commit 034e9eee277d5123258fedc1861edf49c99159ef
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Fri Apr 17 11:24:14 2020 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Fri Apr 17 12:09:30 2020 +0200

    loplugin:buriedassign in dbaccess
    
    Change-Id: Ia97da8d228a8c4e3ced31718a756fb13757beb8f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92407
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/dbaccess/source/core/api/CacheSet.cxx 
b/dbaccess/source/core/api/CacheSet.cxx
index bb50f281d1c3..92c1484edd75 100644
--- a/dbaccess/source/core/api/CacheSet.cxx
+++ b/dbaccess/source/core/api/CacheSet.cxx
@@ -64,9 +64,9 @@ OCacheSet::OCacheSet(sal_Int32 i_nMaxRows)
 OUString OCacheSet::getIdentifierQuoteString() const
 {
     OUString sQuote;
-    Reference<XDatabaseMetaData> xMeta;
-    if ( m_xConnection.is() && (xMeta = m_xConnection->getMetaData()).is() )
-        sQuote = xMeta->getIdentifierQuoteString();
+    if ( m_xConnection.is() )
+        if (auto xMeta = m_xConnection->getMetaData())
+            sQuote = xMeta->getIdentifierQuoteString();
     return sQuote;
 }
 
diff --git a/dbaccess/source/core/api/RowSet.cxx 
b/dbaccess/source/core/api/RowSet.cxx
index f652dc0e60cd..b197d28787a1 100644
--- a/dbaccess/source/core/api/RowSet.cxx
+++ b/dbaccess/source/core/api/RowSet.cxx
@@ -1284,8 +1284,10 @@ const ORowSetValue& ORowSet::getInsertValue(sal_Int32 
columnIndex)
     checkCache();
 
     if ( m_pCache && isInsertRow() )
-        return  (**m_pCache->m_aInsertRow)[m_nLastColumnIndex = columnIndex];
-
+    {
+        m_nLastColumnIndex = columnIndex;
+        return  (**m_pCache->m_aInsertRow)[m_nLastColumnIndex];
+    }
     return getValue(columnIndex);
 }
 
@@ -1368,7 +1370,8 @@ Reference< css::io::XInputStream > SAL_CALL 
ORowSet::getBinaryStream( sal_Int32
     if ( m_pCache && isInsertRow() )
     {
         checkCache();
-        return new 
::comphelper::SequenceInputStream((**m_pCache->m_aInsertRow)[m_nLastColumnIndex 
= columnIndex].getSequence());
+        m_nLastColumnIndex = columnIndex;
+        return new 
::comphelper::SequenceInputStream((**m_pCache->m_aInsertRow)[m_nLastColumnIndex].getSequence());
     }
 
     return ORowSetBase::getBinaryStream(columnIndex);
@@ -1380,7 +1383,8 @@ Reference< css::io::XInputStream > SAL_CALL 
ORowSet::getCharacterStream( sal_Int
     if(m_pCache && isInsertRow() )
     {
         checkCache();
-        return new 
::comphelper::SequenceInputStream((**m_pCache->m_aInsertRow)[m_nLastColumnIndex 
= columnIndex].getSequence());
+        m_nLastColumnIndex = columnIndex;
+        return new 
::comphelper::SequenceInputStream((**m_pCache->m_aInsertRow)[m_nLastColumnIndex].getSequence());
     }
 
     return ORowSetBase::getCharacterStream(columnIndex);
@@ -1402,7 +1406,8 @@ Reference< XBlob > SAL_CALL ORowSet::getBlob( sal_Int32 
columnIndex )
     if ( m_pCache && isInsertRow() )
     {
         checkCache();
-        return new 
::connectivity::BlobHelper((**m_pCache->m_aInsertRow)[m_nLastColumnIndex = 
columnIndex].getSequence());
+        m_nLastColumnIndex = columnIndex;
+        return new 
::connectivity::BlobHelper((**m_pCache->m_aInsertRow)[m_nLastColumnIndex].getSequence());
     }
     return ORowSetBase::getBlob(columnIndex);
 }
diff --git a/dbaccess/source/core/api/RowSetBase.cxx 
b/dbaccess/source/core/api/RowSetBase.cxx
index 2572be7fc0ec..0bbe5e80ae0a 100644
--- a/dbaccess/source/core/api/RowSetBase.cxx
+++ b/dbaccess/source/core/api/RowSetBase.cxx
@@ -233,7 +233,8 @@ const ORowSetValue& ORowSetBase::impl_getValue(sal_Int32 
columnIndex)
         ORowSetRow rRow = *m_aCurrentRow;
         OSL_ENSURE(rRow.is() && o3tl::make_unsigned(columnIndex) < 
rRow->size(),"Invalid size of vector!");
 #endif
-        return (**m_aCurrentRow)[m_nLastColumnIndex = columnIndex];
+        m_nLastColumnIndex = columnIndex;
+        return (**m_aCurrentRow)[m_nLastColumnIndex];
     }
 
     // we should normally never reach this
@@ -340,7 +341,10 @@ Reference< css::io::XInputStream > SAL_CALL 
ORowSetBase::getBinaryStream( sal_In
     }
 
     if ( bValidCurrentRow )
-        return new 
::comphelper::SequenceInputStream((**m_aCurrentRow)[m_nLastColumnIndex = 
columnIndex].getSequence());
+    {
+        m_nLastColumnIndex = columnIndex;
+        return new 
::comphelper::SequenceInputStream((**m_aCurrentRow)[m_nLastColumnIndex].getSequence());
+    }
 
     // we should normally never reach this
     return Reference< css::io::XInputStream >();
diff --git a/dbaccess/source/ui/dlg/directsql.cxx 
b/dbaccess/source/ui/dlg/directsql.cxx
index 500fc5e95e21..cc1fb5ae9ee5 100644
--- a/dbaccess/source/ui/dlg/directsql.cxx
+++ b/dbaccess/source/ui/dlg/directsql.cxx
@@ -288,8 +288,11 @@ namespace dbaui
                 }
                 else
                     addOutputText(OUString::number(xMR->getUpdateCount()) + " 
rows updated\n");
-                while ((hasRS=xMR->getMoreResults()) || (xMR->getUpdateCount() 
!= -1))
+                for (;;)
                 {
+                    hasRS = xMR->getMoreResults();
+                    if (!hasRS && xMR->getUpdateCount() == -1)
+                        break;
                     if(hasRS)
                     {
                         css::uno::Reference< css::sdbc::XResultSet > xRS 
(xMR->getResultSet());
diff --git a/dbaccess/source/ui/misc/UITools.cxx 
b/dbaccess/source/ui/misc/UITools.cxx
index ed4676d7a1a9..75375a2ad05b 100644
--- a/dbaccess/source/ui/misc/UITools.cxx
+++ b/dbaccess/source/ui/misc/UITools.cxx
@@ -910,8 +910,8 @@ bool appendToFilter(const Reference<XConnection>& 
_xConnection,
             {
                 if(rItem.indexOf('%') != -1)
                 {
-                    sal_Int32 nLen;
-                    if((nLen = rItem.lastIndexOf('.')) != -1 && 
!rItem.compareTo(_sName,nLen))
+                    sal_Int32 nLen = rItem.lastIndexOf('.');
+                    if(nLen != -1 && !rItem.compareTo(_sName,nLen))
                         bHasToInsert = false;
                     else if(rItem.getLength() == 1)
                         bHasToInsert = false;
diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx 
b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
index ddcc18049ba0..748eabb13f55 100644
--- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
@@ -568,8 +568,11 @@ namespace
 
             OTableFieldDescRef aDragLeft  = new OTableFieldDesc();
             OTableFieldDescRef aDragRight = new OTableFieldDesc();
-            if ( eOk != ( eErrorCode = 
FillDragInfo(_pView,pNode->getChild(0),aDragLeft)) ||
-                eOk != ( eErrorCode = 
FillDragInfo(_pView,pNode->getChild(2),aDragRight)))
+            eErrorCode = FillDragInfo(_pView,pNode->getChild(0),aDragLeft);
+            if ( eOk != eErrorCode )
+                return eErrorCode;
+            eErrorCode = FillDragInfo(_pView,pNode->getChild(2),aDragRight);
+            if ( eOk != eErrorCode )
                 return eErrorCode;
 
             if ( pLeftTable )
@@ -1504,16 +1507,19 @@ namespace
                         }
                     }
                 }
-                else if (pParamNode && eOk != (eErrorCode = 
FillDragInfo(_pView,pParamNode,aDragLeft))
-                        && SQL_ISRULE(pParamNode,num_value_exp))
+                else if (pParamNode)
                 {
-                    OUString sParameterValue;
-                    pParamNode->parseNodeToStr( sParameterValue,
-                                                xConnection,
-                                                
&rController.getParser().getContext());
-                    nFunctionType |= FKT_NUMERIC;
-                    aDragLeft->SetField(sParameterValue);
-                    eErrorCode = eOk;
+                    eErrorCode = FillDragInfo(_pView,pParamNode,aDragLeft);
+                    if ( eOk != eErrorCode && 
SQL_ISRULE(pParamNode,num_value_exp))
+                    {
+                        OUString sParameterValue;
+                        pParamNode->parseNodeToStr( sParameterValue,
+                                                    xConnection,
+                                                    
&rController.getParser().getContext());
+                        nFunctionType |= FKT_NUMERIC;
+                        aDragLeft->SetField(sParameterValue);
+                        eErrorCode = eOk;
+                    }
                 }
                 aDragLeft->SetFunctionType(nFunctionType);
                 if ( bHaving )
@@ -1553,8 +1559,11 @@ namespace
             if ( SQL_ISRULE(pCondition->getChild(0), column_ref ) && 
SQL_ISRULE(pCondition->getChild(pCondition->count()-1), column_ref ) )
             {
                 OTableFieldDescRef aDragRight = new OTableFieldDesc();
-                if (eOk != ( eErrorCode = 
FillDragInfo(_pView,pCondition->getChild(0),aDragLeft)) ||
-                    eOk != ( eErrorCode = 
FillDragInfo(_pView,pCondition->getChild(2),aDragRight)))
+                eErrorCode = 
FillDragInfo(_pView,pCondition->getChild(0),aDragLeft);
+                if (eOk != eErrorCode)
+                    return eErrorCode;
+                eErrorCode = 
FillDragInfo(_pView,pCondition->getChild(2),aDragRight);
+                if (eOk != eErrorCode)
                     return eErrorCode;
 
                 OQueryTableConnection* pConn = 
static_cast<OQueryTableConnection*>(
diff --git a/dbaccess/source/ui/tabledesign/TEditControl.cxx 
b/dbaccess/source/ui/tabledesign/TEditControl.cxx
index ba723189839b..b082dde57723 100644
--- a/dbaccess/source/ui/tabledesign/TEditControl.cxx
+++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx
@@ -924,7 +924,8 @@ void OTableEditorCtrl::SetCellData( long nRow, sal_uInt16 
nColId, const css::uno
             break;
 
         case COLUMN_DESCRIPTION:
-            pFieldDescr->SetDescription( sValue = 
::comphelper::getString(_rNewData) );
+            sValue = ::comphelper::getString(_rNewData);
+            pFieldDescr->SetDescription( sValue );
             break;
 
         case FIELD_PROPERTY_DEFAULT:
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to