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

Noel Grandin noel.grandin at collabora.co.uk
Tue Jun 20 09:54:42 UTC 2017


 codemaker/source/codemaker/global.cxx                           |    2 
 comphelper/source/container/embeddedobjectcontainer.cxx         |    3 
 comphelper/source/property/ChainablePropertySet.cxx             |    4 
 comphelper/source/property/MasterPropertySet.cxx                |    4 
 comphelper/source/property/opropertybag.cxx                     |    2 
 comphelper/source/streaming/oslfile2streamwrap.cxx              |    3 
 connectivity/source/commontools/FValue.cxx                      |    3 
 connectivity/source/commontools/TIndexColumns.cxx               |    3 
 connectivity/source/commontools/TIndexes.cxx                    |    3 
 connectivity/source/drivers/calc/CTable.cxx                     |    3 
 connectivity/source/drivers/dbase/DTable.cxx                    |    3 
 connectivity/source/drivers/firebird/Connection.cxx             |    3 
 connectivity/source/drivers/firebird/DatabaseMetaData.cxx       |   21 +---
 connectivity/source/drivers/firebird/StatementCommonBase.cxx    |    3 
 connectivity/source/drivers/hsqldb/HDriver.cxx                  |    3 
 connectivity/source/drivers/jdbc/CallableStatement.cxx          |   10 -
 connectivity/source/drivers/jdbc/ResultSet.cxx                  |   10 -
 connectivity/source/drivers/mork/MDatabaseMetaData.cxx          |   51 +++-------
 connectivity/source/drivers/mork/MStatement.cxx                 |    3 
 connectivity/source/drivers/mysql/YCatalog.cxx                  |    4 
 connectivity/source/drivers/mysql/YTables.cxx                   |    2 
 connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx |    3 
 connectivity/source/drivers/postgresql/pq_tools.cxx             |    3 
 connectivity/source/drivers/postgresql/pq_xuser.cxx             |    3 
 24 files changed, 54 insertions(+), 98 deletions(-)

New commits:
commit 8ed77fae3e5e9e5f7409e03d5e4586f428a65c86
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Tue Jun 20 09:26:05 2017 +0200

    loplugin:oncevar in codemaker..connectivity
    
    Change-Id: Ia479d9d3d459a699dfc5c1148d01c35e8bc973bd
    Reviewed-on: https://gerrit.libreoffice.org/39000
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/codemaker/source/codemaker/global.cxx b/codemaker/source/codemaker/global.cxx
index 7f80faec432a..49ce44be7908 100644
--- a/codemaker/source/codemaker/global.cxx
+++ b/codemaker/source/codemaker/global.cxx
@@ -294,7 +294,7 @@ void FileStream::createTempFile(const OString& sPath)
 
     if (osl_createTempFile(sTmpPath.pData, &m_file, &sTmpName.pData) == osl_File_E_None) {
 #ifdef SAL_UNX
-        sal_uInt64 uAttr = osl_File_Attribute_OwnWrite |
+        sal_uInt64 const uAttr = osl_File_Attribute_OwnWrite |
                            osl_File_Attribute_OwnRead |
                            osl_File_Attribute_GrpWrite |
                            osl_File_Attribute_GrpRead |
diff --git a/comphelper/source/container/embeddedobjectcontainer.cxx b/comphelper/source/container/embeddedobjectcontainer.cxx
index 89068adafc19..2a045edf863c 100644
--- a/comphelper/source/container/embeddedobjectcontainer.cxx
+++ b/comphelper/source/container/embeddedobjectcontainer.cxx
@@ -214,12 +214,11 @@ void EmbeddedObjectContainer::CloseEmbeddedObjects()
 
 OUString EmbeddedObjectContainer::CreateUniqueObjectName()
 {
-    OUString aPersistName("Object ");
     OUString aStr;
     sal_Int32 i=1;
     do
     {
-        aStr = aPersistName + OUString::number( i++ );
+        aStr = "Object " + OUString::number( i++ );
     }
     while( HasEmbeddedObject( aStr ) );
     // TODO/LATER: should we consider deleted objects?
diff --git a/comphelper/source/property/ChainablePropertySet.cxx b/comphelper/source/property/ChainablePropertySet.cxx
index c847b393030b..258b6dad0495 100644
--- a/comphelper/source/property/ChainablePropertySet.cxx
+++ b/comphelper/source/property/ChainablePropertySet.cxx
@@ -194,9 +194,7 @@ PropertyState SAL_CALL ChainablePropertySet::getPropertyState( const OUString& P
     if( aIter == mxInfo->maMap.end())
         throw UnknownPropertyException( PropertyName, static_cast< XPropertySet* >( this ) );
 
-    PropertyState aState(PropertyState_AMBIGUOUS_VALUE);
-
-    return aState;
+    return PropertyState_AMBIGUOUS_VALUE;
 }
 
 Sequence< PropertyState > SAL_CALL ChainablePropertySet::getPropertyStates( const Sequence< OUString >& rPropertyNames )
diff --git a/comphelper/source/property/MasterPropertySet.cxx b/comphelper/source/property/MasterPropertySet.cxx
index f4df2305e6c6..3f83b12b2be4 100644
--- a/comphelper/source/property/MasterPropertySet.cxx
+++ b/comphelper/source/property/MasterPropertySet.cxx
@@ -322,8 +322,6 @@ PropertyState SAL_CALL MasterPropertySet::getPropertyState( const OUString& Prop
     if( aIter == mxInfo->maMap.end())
         throw UnknownPropertyException( PropertyName, static_cast< XPropertySet* >( this ) );
 
-    PropertyState aState(PropertyState_AMBIGUOUS_VALUE);
-
     // 0 means it's one of ours !
     if ( (*aIter).second->mnMapId != 0 )
     {
@@ -335,7 +333,7 @@ PropertyState SAL_CALL MasterPropertySet::getPropertyState( const OUString& Prop
             xMutexGuard.reset( new osl::Guard< comphelper::SolarMutex >(pSlave->mpMutex) );
     }
 
-    return aState;
+    return PropertyState_AMBIGUOUS_VALUE;
 }
 
 Sequence< PropertyState > SAL_CALL MasterPropertySet::getPropertyStates( const Sequence< OUString >& rPropertyNames )
diff --git a/comphelper/source/property/opropertybag.cxx b/comphelper/source/property/opropertybag.cxx
index 4fbdb8bfe96e..e36507a599ed 100644
--- a/comphelper/source/property/opropertybag.cxx
+++ b/comphelper/source/property/opropertybag.cxx
@@ -478,7 +478,7 @@ namespace comphelper
                 if ( m_bAutoAddProperties )
                 {
                     // add the property
-                    sal_Int16 nAttributes = PropertyAttribute::BOUND | PropertyAttribute::REMOVABLE | PropertyAttribute::MAYBEDEFAULT;
+                    sal_Int16 const nAttributes = PropertyAttribute::BOUND | PropertyAttribute::REMOVABLE | PropertyAttribute::MAYBEDEFAULT;
                     addProperty( *pName, nAttributes, pProperty->Value );
                     continue;
                 }
diff --git a/comphelper/source/streaming/oslfile2streamwrap.cxx b/comphelper/source/streaming/oslfile2streamwrap.cxx
index 888e0134f799..8a97e038e89e 100644
--- a/comphelper/source/streaming/oslfile2streamwrap.cxx
+++ b/comphelper/source/streaming/oslfile2streamwrap.cxx
@@ -107,8 +107,7 @@ sal_Int32 SAL_CALL OSLInputStreamWrapper::available()
     if (eError != FileBase::E_None)
         throw css::io::NotConnectedException(OUString(), static_cast<css::uno::XWeak*>(this));
 
-    sal_uInt64 nDummy = 0;
-    eError = m_pFile->setPos(osl_Pos_End, nDummy);
+    eError = m_pFile->setPos(osl_Pos_End, 0);
     if (eError != FileBase::E_None)
        throw css::io::NotConnectedException(OUString(),static_cast<css::uno::XWeak*>(this));
 
diff --git a/connectivity/source/commontools/FValue.cxx b/connectivity/source/commontools/FValue.cxx
index 721ca95d9a8c..55b639eab9d6 100644
--- a/connectivity/source/commontools/FValue.cxx
+++ b/connectivity/source/commontools/FValue.cxx
@@ -2208,7 +2208,6 @@ void ORowSetValue::fill(sal_Int32 _nPos,
 
 void ORowSetValue::impl_fill( const sal_Int32 _nType, bool _bNullable, const detail::IValueSource& _rValueSource )
 {
-    bool bReadData = true;
     switch(_nType)
     {
     case DataType::CHAR:
@@ -2288,7 +2287,7 @@ void ORowSetValue::impl_fill( const sal_Int32 _nType, bool _bNullable, const det
         (*this) = _rValueSource.getObject();
         break;
     }
-    if ( bReadData && _bNullable && _rValueSource.wasNull() )
+    if ( _bNullable && _rValueSource.wasNull() )
         setNull();
     setTypeKind(_nType);
 }
diff --git a/connectivity/source/commontools/TIndexColumns.cxx b/connectivity/source/commontools/TIndexColumns.cxx
index fcddb7f4caec..2d83fa7b2908 100644
--- a/connectivity/source/commontools/TIndexColumns.cxx
+++ b/connectivity/source/commontools/TIndexColumns.cxx
@@ -60,11 +60,10 @@ sdbcx::ObjectType OIndexColumns::createObject(const OUString& _rName)
     if ( xResult.is() )
     {
         Reference< XRow > xRow(xResult,UNO_QUERY);
-        OUString aD("D");
         while( xResult->next() )
         {
             if(xRow->getString(9) == _rName)
-                bAsc = xRow->getString(10) != aD;
+                bAsc = xRow->getString(10) != "D";
         }
     }
 
diff --git a/connectivity/source/commontools/TIndexes.cxx b/connectivity/source/commontools/TIndexes.cxx
index 0c950b919e24..050364e81462 100644
--- a/connectivity/source/commontools/TIndexes.cxx
+++ b/connectivity/source/commontools/TIndexes.cxx
@@ -138,7 +138,6 @@ sdbcx::ObjectType OIndexesHelper::appendObject( const OUString& _rForName, const
         ::dbtools::OPropertyMap& rPropMap = OMetaConnection::getPropMap();
         OUStringBuffer aSql( "CREATE " );
         OUString aQuote  = m_pTable->getMetaData()->getIdentifierQuoteString(  );
-        OUString aDot( "." );
 
         if(comphelper::getBOOL(descriptor->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_ISUNIQUE))))
             aSql.append("UNIQUE ");
@@ -192,7 +191,7 @@ sdbcx::ObjectType OIndexesHelper::appendObject( const OUString& _rForName, const
 
             xColumns->getByIndex(0) >>= xColProp;
 
-            aSql.append(aDot);
+            aSql.append(".");
             aSql.append(::dbtools::quoteName( aQuote,comphelper::getString(xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_NAME)))));
         }
 
diff --git a/connectivity/source/drivers/calc/CTable.cxx b/connectivity/source/drivers/calc/CTable.cxx
index 0f030b5fbbc0..f1d7d7f17b7c 100644
--- a/connectivity/source/drivers/calc/CTable.cxx
+++ b/connectivity/source/drivers/calc/CTable.cxx
@@ -776,8 +776,7 @@ bool OCalcTable::fetchRow( OValueRefRow& _rRow, const OSQLColumns & _rCols,
 {
     // read the bookmark
 
-    bool bIsCurRecordDeleted = false;
-    _rRow->setDeleted(bIsCurRecordDeleted);
+    _rRow->setDeleted(false);
     *(_rRow->get())[0] = m_nFilePos;
 
     if (!bRetrieveData)
diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx
index a684616771c6..97bed39062b8 100644
--- a/connectivity/source/drivers/dbase/DTable.cxx
+++ b/connectivity/source/drivers/dbase/DTable.cxx
@@ -2372,8 +2372,7 @@ void SAL_CALL ODbaseTable::renameImpl( const OUString& newName )
     renameFile(m_pConnection,m_Name,newName,m_pConnection->getExtension());
     if ( HasMemoFields() )
     {  // delete the memo fields
-        OUString sExt("dbt");
-        renameFile(m_pConnection,m_Name,newName,sExt);
+        renameFile(m_pConnection,m_Name,newName,"dbt");
     }
 }
 
diff --git a/connectivity/source/drivers/firebird/Connection.cxx b/connectivity/source/drivers/firebird/Connection.cxx
index 2d03917cc3e7..a17222f52f31 100644
--- a/connectivity/source/drivers/firebird/Connection.cxx
+++ b/connectivity/source/drivers/firebird/Connection.cxx
@@ -246,8 +246,7 @@ void Connection::construct(const ::rtl::OUString& url, const Sequence< PropertyV
             // set UTF8 as default character set
             const char sCharset[] = "UTF8";
             dpbBuffer.push_back(isc_dpb_set_db_charset);
-            int nCharsetLength = sizeof(sCharset) - 1;
-            dpbBuffer.push_back(nCharsetLength);
+            dpbBuffer.push_back(sizeof(sCharset) - 1);
             dpbBuffer.append(sCharset);
 
             // Do any more dpbBuffer additions here
diff --git a/connectivity/source/drivers/firebird/DatabaseMetaData.cxx b/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
index d456f5efcdaa..6bfa79c9794d 100644
--- a/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
+++ b/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
@@ -206,8 +206,7 @@ sal_Int32 SAL_CALL ODatabaseMetaData::getMaxTableNameLength()
 
 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxTablesInSelect(  )
 {
-    sal_Int32 nValue = 0; // 0 means no limit
-    return nValue;
+    return 0; // 0 means no limit
 }
 
 
@@ -341,8 +340,7 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsTableCorrelationNames()
 
 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxIndexLength(  )
 {
-    sal_Int32 nValue = 0; // 0 means no limit
-    return nValue;
+    return 0; // 0 means no limit
 }
 
 sal_Bool SAL_CALL ODatabaseMetaData::supportsNonNullableColumns(  )
@@ -444,14 +442,12 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsIntegrityEnhancementFacility(  )
 
 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxStatements(  )
 {
-    sal_Int32 nValue = 0; // 0 means no limit
-    return nValue;
+    return 0; // 0 means no limit
 }
 
 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxProcedureNameLength(  )
 {
-    sal_Int32 nValue = 31; // TODO: confirm
-    return nValue;
+    return 31; // TODO: confirm
 }
 
 sal_Bool SAL_CALL ODatabaseMetaData::allProceduresAreCallable(  )
@@ -682,20 +678,17 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsLimitedOuterJoins(  )
 
 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInGroupBy(  )
 {
-    sal_Int32 nValue = 0; // 0 means no limit
-    return nValue;
+    return 0; // 0 means no limit
 }
 
 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInOrderBy(  )
 {
-    sal_Int32 nValue = 0; // 0 means no limit
-    return nValue;
+    return 0; // 0 means no limit
 }
 
 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInSelect(  )
 {
-    sal_Int32 nValue = 0; // 0 means no limit
-    return nValue;
+    return 0; // 0 means no limit
 }
 
 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxUserNameLength(  )
diff --git a/connectivity/source/drivers/firebird/StatementCommonBase.cxx b/connectivity/source/drivers/firebird/StatementCommonBase.cxx
index 1cf44a849636..cc0e417f19db 100644
--- a/connectivity/source/drivers/firebird/StatementCommonBase.cxx
+++ b/connectivity/source/drivers/firebird/StatementCommonBase.cxx
@@ -302,9 +302,8 @@ sal_Bool OStatementCommonBase::convertFastPropertyValue(
     (void) rOldValue;
     (void) nHandle;
     (void) rValue;
-    bool bConverted = false;
     // here we have to try to convert
-    return bConverted;
+    return false;
 }
 
 void OStatementCommonBase::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue)
diff --git a/connectivity/source/drivers/hsqldb/HDriver.cxx b/connectivity/source/drivers/hsqldb/HDriver.cxx
index 4d35689f2f31..a60f32766e26 100644
--- a/connectivity/source/drivers/hsqldb/HDriver.cxx
+++ b/connectivity/source/drivers/hsqldb/HDriver.cxx
@@ -128,9 +128,8 @@ namespace connectivity
     {
         if ( !m_xDriver.is() )
         {
-            OUString sURL("jdbc:hsqldb:db");
             Reference<XDriverManager2> xDriverAccess = DriverManager::create( m_xContext );
-            m_xDriver = xDriverAccess->getDriverByURL(sURL);
+            m_xDriver = xDriverAccess->getDriverByURL("jdbc:hsqldb:db");
         }
 
         return m_xDriver;
diff --git a/connectivity/source/drivers/jdbc/CallableStatement.cxx b/connectivity/source/drivers/jdbc/CallableStatement.cxx
index 713a22e3dd49..8d431b77c851 100644
--- a/connectivity/source/drivers/jdbc/CallableStatement.cxx
+++ b/connectivity/source/drivers/jdbc/CallableStatement.cxx
@@ -88,7 +88,7 @@ sal_Int8 SAL_CALL java_sql_CallableStatement::getByte( sal_Int32 columnIndex )
     SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java environment has been deleted!");
     createStatement(t.pEnv);
     static jmethodID mID(nullptr);
-    jbyte (JNIEnv::*pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallByteMethod;
+    jbyte (JNIEnv::* const pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallByteMethod;
     return callMethodWithIntArg<jbyte>(pCallMethod,"getByte","(I)B",mID,columnIndex);
 }
 Sequence< sal_Int8 > SAL_CALL java_sql_CallableStatement::getBytes( sal_Int32 columnIndex )
@@ -123,7 +123,7 @@ double SAL_CALL java_sql_CallableStatement::getDouble( sal_Int32 columnIndex )
     SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java environment has been deleted!");
     createStatement(t.pEnv);
     static jmethodID mID(nullptr);
-    double (JNIEnv::*pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallDoubleMethod;
+    double (JNIEnv::* const pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallDoubleMethod;
     return callMethodWithIntArg<double>(pCallMethod,"getDouble","(I)D",mID,columnIndex);
 }
 
@@ -132,7 +132,7 @@ float SAL_CALL java_sql_CallableStatement::getFloat( sal_Int32 columnIndex )
     SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java environment has been deleted!");
     createStatement(t.pEnv);
     static jmethodID mID(nullptr);
-    jfloat (JNIEnv::*pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallFloatMethod;
+    jfloat (JNIEnv::* const pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallFloatMethod;
     return callMethodWithIntArg<jfloat>(pCallMethod,"getFloat","(I)F",mID,columnIndex);
 }
 
@@ -149,7 +149,7 @@ sal_Int64 SAL_CALL java_sql_CallableStatement::getLong( sal_Int32 columnIndex )
     SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java environment has been deleted!");
     createStatement(t.pEnv);
     static jmethodID mID(nullptr);
-    jlong (JNIEnv::*pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallLongMethod;
+    jlong (JNIEnv::* const pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallLongMethod;
     return callMethodWithIntArg<jlong>(pCallMethod,"getLong","(I)J",mID,columnIndex);
 }
 
@@ -168,7 +168,7 @@ sal_Int16 SAL_CALL java_sql_CallableStatement::getShort( sal_Int32 columnIndex )
     SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java environment has been deleted!");
     createStatement(t.pEnv);
     static jmethodID mID(nullptr);
-    jshort (JNIEnv::*pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallShortMethod;
+    jshort (JNIEnv::* const pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallShortMethod;
     return callMethodWithIntArg<jshort>(pCallMethod,"getShort","(I)S",mID,columnIndex);
 }
 
diff --git a/connectivity/source/drivers/jdbc/ResultSet.cxx b/connectivity/source/drivers/jdbc/ResultSet.cxx
index 29ad290bb25f..9f64d1bd6680 100644
--- a/connectivity/source/drivers/jdbc/ResultSet.cxx
+++ b/connectivity/source/drivers/jdbc/ResultSet.cxx
@@ -165,7 +165,7 @@ sal_Bool SAL_CALL java_sql_ResultSet::getBoolean( sal_Int32 columnIndex )
 sal_Int8 SAL_CALL java_sql_ResultSet::getByte( sal_Int32 columnIndex )
 {
     static jmethodID mID(nullptr);
-    jbyte (JNIEnv::*pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallByteMethod;
+    jbyte (JNIEnv::* const pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallByteMethod;
     return callMethodWithIntArg<jbyte>(pCallMethod,"getByte","(I)B",mID,columnIndex);
 }
 
@@ -200,7 +200,7 @@ css::util::Date SAL_CALL java_sql_ResultSet::getDate( sal_Int32 columnIndex )
 double SAL_CALL java_sql_ResultSet::getDouble( sal_Int32 columnIndex )
 {
     static jmethodID mID(nullptr);
-    jdouble (JNIEnv::*pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallDoubleMethod;
+    jdouble (JNIEnv::* const pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallDoubleMethod;
     return callMethodWithIntArg<double>(pCallMethod,"getDouble","(I)D",mID,columnIndex);
 }
 
@@ -208,7 +208,7 @@ double SAL_CALL java_sql_ResultSet::getDouble( sal_Int32 columnIndex )
 float SAL_CALL java_sql_ResultSet::getFloat( sal_Int32 columnIndex )
 {
     static jmethodID mID(nullptr);
-    jfloat (JNIEnv::*pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallFloatMethod;
+    jfloat (JNIEnv::* const pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallFloatMethod;
     return callMethodWithIntArg<jfloat>(pCallMethod,"getFloat","(I)F",mID,columnIndex);
 }
 
@@ -230,7 +230,7 @@ sal_Int32 SAL_CALL java_sql_ResultSet::getRow(  )
 sal_Int64 SAL_CALL java_sql_ResultSet::getLong( sal_Int32 columnIndex )
 {
     static jmethodID mID(nullptr);
-    jlong (JNIEnv::*pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallLongMethod;
+    jlong (JNIEnv::* const pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallLongMethod;
     return callMethodWithIntArg<jlong>(pCallMethod,"getLong","(I)J",mID,columnIndex);
 }
 
@@ -349,7 +349,7 @@ Any SAL_CALL java_sql_ResultSet::getObject( sal_Int32 columnIndex, const Referen
 sal_Int16 SAL_CALL java_sql_ResultSet::getShort( sal_Int32 columnIndex )
 {
     static jmethodID mID(nullptr);
-    jshort (JNIEnv::*pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallShortMethod;
+    jshort (JNIEnv::* const pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallShortMethod;
     return callMethodWithIntArg<jshort>(pCallMethod,"getShort","(I)S",mID,columnIndex);
 }
 
diff --git a/connectivity/source/drivers/mork/MDatabaseMetaData.cxx b/connectivity/source/drivers/mork/MDatabaseMetaData.cxx
index 3b5197df500e..f282d8575992 100644
--- a/connectivity/source/drivers/mork/MDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/mork/MDatabaseMetaData.cxx
@@ -145,56 +145,47 @@ OUString ODatabaseMetaData::impl_getCatalogSeparator_throw(  )
 
 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxBinaryLiteralLength(  )
 {
-    sal_Int32 nValue = 65535; // 0 means no limit
-    return nValue;
+    return 65535; // 0 means no limit
 }
 
 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxRowSize(  )
 {
-    sal_Int32 nValue = 0; // 0 means no limit
-    return nValue;
+    return 0; // 0 means no limit
 }
 
 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCatalogNameLength(  )
 {
-    sal_Int32 nValue = 0; // 0 means no limit
-    return nValue;
+    return 0; // 0 means no limit
 }
 
 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCharLiteralLength(  )
 {
-    sal_Int32 nValue = 254; // 0 means no limit
-    return nValue;
+    return 254; // 0 means no limit
 }
 
 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnNameLength(  )
 {
-    sal_Int32 nValue = 20; // 0 means no limit
-    return nValue;
+    return 20; // 0 means no limit
 }
 
 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInIndex(  )
 {
-    sal_Int32 nValue = 0; // 0 means no limit
-    return nValue;
+    return 0; // 0 means no limit
 }
 
 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCursorNameLength(  )
 {
-    sal_Int32 nValue = 0; // 0 means no limit
-    return nValue;
+    return 0; // 0 means no limit
 }
 
 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxConnections(  )
 {
-    sal_Int32 nValue = 0; // 0 means no limit
-    return nValue;
+    return 0; // 0 means no limit
 }
 
 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInTable(  )
 {
-    sal_Int32 nValue = 0; // 0 means no limit
-    return nValue;
+    return 0; // 0 means no limit
 }
 
 sal_Int32 ODatabaseMetaData::impl_getMaxStatements_throw(  )
@@ -204,8 +195,7 @@ sal_Int32 ODatabaseMetaData::impl_getMaxStatements_throw(  )
 
 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxTableNameLength(  )
 {
-    sal_Int32 nValue = 0; // 0 means no limit
-    return nValue;
+    return 0; // 0 means no limit
 }
 
 sal_Int32 ODatabaseMetaData::impl_getMaxTablesInSelect_throw(  )
@@ -262,8 +252,7 @@ bool ODatabaseMetaData::impl_supportsAlterTableWithDropColumn_throw(  )
 
 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxIndexLength(  )
 {
-    sal_Int32 nValue = 0; // 0 means no limit
-    return nValue;
+    return 0; // 0 means no limit
 }
 
 sal_Bool SAL_CALL ODatabaseMetaData::supportsNonNullableColumns(  )
@@ -412,14 +401,12 @@ sal_Int32 SAL_CALL ODatabaseMetaData::getMaxStatementLength(  )
 
 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxProcedureNameLength(  )
 {
-    sal_Int32 nValue = 0; // 0 means no limit
-    return nValue;
+    return 0; // 0 means no limit
 }
 
 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxSchemaNameLength(  )
 {
-    sal_Int32 nValue = 0; // 0 means no limit
-    return nValue;
+    return 0; // 0 means no limit
 }
 
 sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactions(  )
@@ -746,26 +733,22 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsLimitedOuterJoins(  )
 
 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInGroupBy(  )
 {
-    sal_Int32 nValue = 0; // 0 means no limit
-    return nValue;
+    return 0; // 0 means no limit
 }
 
 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInOrderBy(  )
 {
-    sal_Int32 nValue = 0; // 0 means no limit
-    return nValue;
+    return 0; // 0 means no limit
 }
 
 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInSelect(  )
 {
-    sal_Int32 nValue = 0; // 0 means no limit
-    return nValue;
+    return 0; // 0 means no limit
 }
 
 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxUserNameLength(  )
 {
-    sal_Int32 nValue = 0; // 0 means no limit
-    return nValue;
+    return 0; // 0 means no limit
 }
 
 sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetType( sal_Int32 /*setType*/ )
diff --git a/connectivity/source/drivers/mork/MStatement.cxx b/connectivity/source/drivers/mork/MStatement.cxx
index 864dc83c7b1d..13cb0d280073 100644
--- a/connectivity/source/drivers/mork/MStatement.cxx
+++ b/connectivity/source/drivers/mork/MStatement.cxx
@@ -325,9 +325,8 @@ sal_Bool OCommonStatement::convertFastPropertyValue(
                             sal_Int32 /*nHandle*/,
                             const Any& /*rValue*/ )
 {
-    bool bConverted = false;
     // here we have to try to convert
-    return bConverted;
+    return false;
 }
 
 void OCommonStatement::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& /*rValue*/)
diff --git a/connectivity/source/drivers/mysql/YCatalog.cxx b/connectivity/source/drivers/mysql/YCatalog.cxx
index eb755309fd41..47eb3dd38232 100644
--- a/connectivity/source/drivers/mysql/YCatalog.cxx
+++ b/connectivity/source/drivers/mysql/YCatalog.cxx
@@ -74,11 +74,9 @@ void OMySQLCatalog::refreshViews()
     // let's simply assume the server is new enough to support views. Current drivers
     // as of this writing might not return the proper information in getTableTypes, so
     // don't rely on it.
-    bool bSupportsViews = true;
 
     TStringVector aVector;
-    if ( bSupportsViews )
-        refreshObjects(aTypes,aVector);
+    refreshObjects(aTypes,aVector);
 
     if ( m_pViews )
         m_pViews->reFill(aVector);
diff --git a/connectivity/source/drivers/mysql/YTables.cxx b/connectivity/source/drivers/mysql/YTables.cxx
index a05bb0028873..26ac43ca60f6 100644
--- a/connectivity/source/drivers/mysql/YTables.cxx
+++ b/connectivity/source/drivers/mysql/YTables.cxx
@@ -67,7 +67,7 @@ sdbcx::ObjectType OTables::createObject(const OUString& _rName)
         Reference< XRow > xRow(xResult,UNO_QUERY);
         if ( xResult->next() ) // there can be only one table with this name
         {
-            sal_Int32 nPrivileges = Privilege::DROP         |
+            sal_Int32 const nPrivileges = Privilege::DROP         |
                                     Privilege::REFERENCE    |
                                     Privilege::ALTER        |
                                     Privilege::CREATE       |
diff --git a/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx b/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx
index f0345d5eefd7..44da0bb72aac 100644
--- a/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx
+++ b/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx
@@ -695,8 +695,7 @@ Any SAL_CALL ODatabaseMetaDataResultSet::getWarnings(  )
 
 sal_Int32 ODatabaseMetaDataResultSet::getFetchSize()
 {
-    sal_Int32 nValue=1;
-    return nValue;
+    return 1;
 }
 
 OUString ODatabaseMetaDataResultSet::getCursorName()
diff --git a/connectivity/source/drivers/postgresql/pq_tools.cxx b/connectivity/source/drivers/postgresql/pq_tools.cxx
index b6e021116326..02e2e58a59e3 100644
--- a/connectivity/source/drivers/postgresql/pq_tools.cxx
+++ b/connectivity/source/drivers/postgresql/pq_tools.cxx
@@ -1153,8 +1153,7 @@ bool implSetObject( const Reference< XParameters >& _rxParameters,
     {
         case css::uno::TypeClass_HYPER:
         {
-            sal_Int64 nValue = 0;
-            _rxParameters->setLong( _nColumnIndex, nValue );
+            _rxParameters->setLong( _nColumnIndex, sal_Int64(0) );
         }
         break;
 
diff --git a/connectivity/source/drivers/postgresql/pq_xuser.cxx b/connectivity/source/drivers/postgresql/pq_xuser.cxx
index f3fd5385df82..b41af2736076 100644
--- a/connectivity/source/drivers/postgresql/pq_xuser.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xuser.cxx
@@ -135,7 +135,6 @@ void User::changePassword(
 
 sal_Int32 User::getPrivileges( const OUString& objName, sal_Int32 objType )
 {
-    sal_Int32 ret = 0xffffffff;
     if (isLog(m_pSettings, LogLevel::Info))
     {
         Statics & st = getStatics();
@@ -147,7 +146,7 @@ sal_Int32 User::getPrivileges( const OUString& objName, sal_Int32 objType )
         log(m_pSettings, LogLevel::Info, buf.makeStringAndClear());
     }
     // all privileges
-    return ret;
+    return 0xffffffff;
 }
 
 sal_Int32 User::getGrantablePrivileges( const OUString& objName, sal_Int32 objType )


More information about the Libreoffice-commits mailing list