diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-03-23 09:47:49 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-03-23 09:48:10 +0000 |
commit | ed76d1d3504c92bff6bb3e6417e4440572fcd959 (patch) | |
tree | 6d06b4a20bef5acf0c1a4118685f09acdd27fbb7 /connectivity | |
parent | a61c4ae9cef23a53ea88f957e090bd5ee9b28ca6 (diff) |
loplugins:redundantcast teach it about c-style typedef casts
Change-Id: I1ac11a2481c0f4d8be1e1fd7c7637ac0ece3d65c
Reviewed-on: https://gerrit.libreoffice.org/35558
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'connectivity')
13 files changed, 29 insertions, 29 deletions
diff --git a/connectivity/source/commontools/dbtools.cxx b/connectivity/source/commontools/dbtools.cxx index f883b576ee4d..341870bda331 100644 --- a/connectivity/source/commontools/dbtools.cxx +++ b/connectivity/source/commontools/dbtools.cxx @@ -1139,7 +1139,7 @@ try nKey = xFormats->addNew(sNewFormat, _rLocale); } - xNewProps->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FORMATKEY), makeAny((sal_Int32)nKey)); + xNewProps->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FORMATKEY), makeAny(nKey)); } // min-/max-Value diff --git a/connectivity/source/drivers/calc/CTable.cxx b/connectivity/source/drivers/calc/CTable.cxx index 7777318cb1ae..0d31b4b34cd9 100644 --- a/connectivity/source/drivers/calc/CTable.cxx +++ b/connectivity/source/drivers/calc/CTable.cxx @@ -732,8 +732,8 @@ bool OCalcTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 n m_nFilePos = nNumberOfRecords; break; case IResultSetHelper::RELATIVE1: - m_nFilePos = (((sal_Int32)m_nFilePos) + nOffset < 0) ? 0L - : (sal_uInt32)(((sal_Int32)m_nFilePos) + nOffset); + m_nFilePos = (m_nFilePos + nOffset < 0) ? 0L + : (sal_uInt32)(m_nFilePos + nOffset); break; case IResultSetHelper::ABSOLUTE1: case IResultSetHelper::BOOKMARK: diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx index 167ff3ccf3db..ab223a886257 100644 --- a/connectivity/source/drivers/dbase/DTable.cxx +++ b/connectivity/source/drivers/dbase/DTable.cxx @@ -2592,7 +2592,7 @@ bool ODbaseTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 // prepare positioning: OSL_ENSURE(m_pFileStream,"ODbaseTable::seekRow: FileStream is NULL!"); - sal_uInt32 nNumberOfRecords = (sal_uInt32)m_aHeader.db_anz; + sal_uInt32 nNumberOfRecords = m_aHeader.db_anz; sal_uInt32 nTempPos = m_nFilePos; m_nFilePos = nCurPos; @@ -2612,8 +2612,8 @@ bool ODbaseTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 m_nFilePos = nNumberOfRecords; break; case IResultSetHelper::RELATIVE1: - m_nFilePos = (((sal_Int32)m_nFilePos) + nOffset < 0) ? 0L - : (sal_uInt32)(((sal_Int32)m_nFilePos) + nOffset); + m_nFilePos = (m_nFilePos + nOffset < 0) ? 0L + : (sal_uInt32)(m_nFilePos + nOffset); break; case IResultSetHelper::ABSOLUTE1: case IResultSetHelper::BOOKMARK: diff --git a/connectivity/source/drivers/file/FNoException.cxx b/connectivity/source/drivers/file/FNoException.cxx index d1392bf7027a..299c37a27181 100644 --- a/connectivity/source/drivers/file/FNoException.cxx +++ b/connectivity/source/drivers/file/FNoException.cxx @@ -91,7 +91,7 @@ OKeyValue* OResultSet::GetOrderbyKeyValue(OValueRefRow& _rRow) { sal_uInt32 nBookmarkValue = std::abs((sal_Int32)(_rRow->get())[0]->getValue()); - OKeyValue* pKeyValue = OKeyValue::createKeyValue((sal_uInt32)nBookmarkValue); + OKeyValue* pKeyValue = OKeyValue::createKeyValue(nBookmarkValue); std::vector<sal_Int32>::const_iterator aIter = m_aOrderbyColumnNumber.begin(); for (;aIter != m_aOrderbyColumnNumber.end(); ++aIter) diff --git a/connectivity/source/drivers/file/FResultSetMetaData.cxx b/connectivity/source/drivers/file/FResultSetMetaData.cxx index 070cd4492bc1..173bf318db78 100644 --- a/connectivity/source/drivers/file/FResultSetMetaData.cxx +++ b/connectivity/source/drivers/file/FResultSetMetaData.cxx @@ -51,7 +51,7 @@ OResultSetMetaData::~OResultSetMetaData() void OResultSetMetaData::checkColumnIndex(sal_Int32 column) { - if(column <= 0 || column > (sal_Int32)(sal_Int32)m_xColumns->get().size()) + if(column <= 0 || column > (sal_Int32)m_xColumns->get().size()) throwInvalidIndexException(*this); } diff --git a/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx b/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx index 5697c71908d5..788da44fafd7 100644 --- a/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx +++ b/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx @@ -564,16 +564,16 @@ OUString java_sql_DatabaseMetaData::impl_callStringMethod( const char* _pMethodN sal_Int32 java_sql_DatabaseMetaData::impl_callIntMethod_ThrowSQL(const char* _pMethodName, jmethodID& _inout_MethodID) { m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_METHOD, _pMethodName ); - sal_Int32 out( (sal_Int32)callIntMethod_ThrowSQL(_pMethodName,_inout_MethodID) ); - m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_RESULT, _pMethodName, (sal_Int32)out ); + sal_Int32 out( callIntMethod_ThrowSQL(_pMethodName,_inout_MethodID) ); + m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_RESULT, _pMethodName, out ); return out; } sal_Int32 java_sql_DatabaseMetaData::impl_callIntMethod_ThrowRuntime(const char* _pMethodName, jmethodID& _inout_MethodID) { m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_METHOD, _pMethodName ); - sal_Int32 out( (sal_Int32)callIntMethod_ThrowRuntime(_pMethodName,_inout_MethodID) ); - m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_RESULT, _pMethodName, (sal_Int32)out ); + sal_Int32 out( callIntMethod_ThrowRuntime(_pMethodName,_inout_MethodID) ); + m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_RESULT, _pMethodName, out ); return out; } diff --git a/connectivity/source/drivers/jdbc/JStatement.cxx b/connectivity/source/drivers/jdbc/JStatement.cxx index ccee37942388..4f3e47679391 100644 --- a/connectivity/source/drivers/jdbc/JStatement.cxx +++ b/connectivity/source/drivers/jdbc/JStatement.cxx @@ -363,7 +363,7 @@ sal_Int32 SAL_CALL java_sql_Statement_Base::getUpdateCount( ) createStatement(t.pEnv); static jmethodID mID(nullptr); sal_Int32 out = callIntMethod_ThrowSQL("getUpdateCount", mID); - m_aLogger.log( LogLevel::FINER, STR_LOG_UPDATE_COUNT, (sal_Int32)out ); + m_aLogger.log( LogLevel::FINER, STR_LOG_UPDATE_COUNT, out ); return out; } @@ -519,7 +519,7 @@ void java_sql_Statement_Base::setResultSetConcurrency(sal_Int32 _par0) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); - m_aLogger.log( LogLevel::FINE, STR_LOG_RESULT_SET_CONCURRENCY, (sal_Int32)_par0 ); + m_aLogger.log( LogLevel::FINE, STR_LOG_RESULT_SET_CONCURRENCY, _par0 ); m_nResultSetConcurrency = _par0; clearObject(); @@ -529,7 +529,7 @@ void java_sql_Statement_Base::setResultSetType(sal_Int32 _par0) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); - m_aLogger.log( LogLevel::FINE, STR_LOG_RESULT_SET_TYPE, (sal_Int32)_par0 ); + m_aLogger.log( LogLevel::FINE, STR_LOG_RESULT_SET_TYPE, _par0 ); m_nResultSetType = _par0; clearObject(); @@ -539,7 +539,7 @@ void java_sql_Statement_Base::setFetchDirection(sal_Int32 _par0) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); - m_aLogger.log( LogLevel::FINER, STR_LOG_FETCH_DIRECTION, (sal_Int32)_par0 ); + m_aLogger.log( LogLevel::FINER, STR_LOG_FETCH_DIRECTION, _par0 ); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); createStatement(t.pEnv); static jmethodID mID(nullptr); @@ -550,7 +550,7 @@ void java_sql_Statement_Base::setFetchSize(sal_Int32 _par0) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); - m_aLogger.log( LogLevel::FINER, STR_LOG_FETCH_SIZE, (sal_Int32)_par0 ); + m_aLogger.log( LogLevel::FINER, STR_LOG_FETCH_SIZE, _par0 ); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); createStatement(t.pEnv); diff --git a/connectivity/source/drivers/jdbc/PreparedStatement.cxx b/connectivity/source/drivers/jdbc/PreparedStatement.cxx index ee084a45a6b1..6ded278caffa 100644 --- a/connectivity/source/drivers/jdbc/PreparedStatement.cxx +++ b/connectivity/source/drivers/jdbc/PreparedStatement.cxx @@ -540,9 +540,9 @@ void SAL_CALL java_sql_PreparedStatement::setBinaryStream( sal_Int32 parameterIn // functions.html#wp22933>; work around that difference in a way // that doesn't trigger loplugin:redundantcast t.pEnv->SetByteArrayRegion(pByteArray,0,actualLength,aSeqData); - args2[0].l = pByteArray; - args2[1].i = 0; - args2[2].i = (sal_Int32)actualLength; + args2[0].l = pByteArray; + args2[1].i = 0; + args2[2].i = actualLength; // Java-Call jclass aClass = t.pEnv->FindClass("java/io/ByteArrayInputStream"); @@ -556,7 +556,7 @@ void SAL_CALL java_sql_PreparedStatement::setBinaryStream( sal_Int32 parameterIn jobject tempObj = nullptr; if(mID2) tempObj = t.pEnv->NewObjectA( aClass, mID2, args2 ); - t.pEnv->CallVoidMethod( object, mID, parameterIndex,tempObj,(sal_Int32)actualLength); + t.pEnv->CallVoidMethod( object, mID, parameterIndex,tempObj,actualLength); // and clean up t.pEnv->DeleteLocalRef(pByteArray); t.pEnv->DeleteLocalRef(tempObj); diff --git a/connectivity/source/drivers/jdbc/ResultSet.cxx b/connectivity/source/drivers/jdbc/ResultSet.cxx index ec446f973c5e..490006b529f7 100644 --- a/connectivity/source/drivers/jdbc/ResultSet.cxx +++ b/connectivity/source/drivers/jdbc/ResultSet.cxx @@ -294,7 +294,7 @@ Any SAL_CALL java_sql_ResultSet::getObject( sal_Int32 columnIndex, const Referen { jvalue args[2]; // convert parameter - args[0].i = (sal_Int32)columnIndex; + args[0].i = columnIndex; args[1].l = convertTypeMapToJavaMap(t.pEnv,typeMap); // initialize temporary Variable // Java-Call diff --git a/connectivity/source/drivers/mork/MResultSet.cxx b/connectivity/source/drivers/mork/MResultSet.cxx index e0cfea8cb5f7..f7e29c8612b7 100644 --- a/connectivity/source/drivers/mork/MResultSet.cxx +++ b/connectivity/source/drivers/mork/MResultSet.cxx @@ -307,7 +307,7 @@ bool OResultSet::fetchRow(sal_Int32 cardNumber,bool bForceReload) if (!bForceReload) { // Check whether we've already fetched the row... - if ( !(m_aRow->get())[0].isNull() && (sal_Int32)(m_aRow->get())[0] == (sal_Int32)cardNumber ) + if ( !(m_aRow->get())[0].isNull() && (sal_Int32)(m_aRow->get())[0] == cardNumber ) return true; //Check whether the old row has been changed if (cardNumber == m_nUpdatedRow) @@ -323,7 +323,7 @@ bool OResultSet::fetchRow(sal_Int32 cardNumber,bool bForceReload) if ( !validRow( cardNumber ) ) return false; - (m_aRow->get())[0] = (sal_Int32)cardNumber; + (m_aRow->get())[0] = cardNumber; sal_Int32 nCount = m_aColumnNames.getLength(); //m_RowStates = m_aQuery.getRowStates(cardNumber); for( sal_Int32 i = 1; i <= nCount; i++ ) diff --git a/connectivity/source/drivers/mork/MResultSetMetaData.cxx b/connectivity/source/drivers/mork/MResultSetMetaData.cxx index 707e51f4dd2c..59ed049d26b7 100644 --- a/connectivity/source/drivers/mork/MResultSetMetaData.cxx +++ b/connectivity/source/drivers/mork/MResultSetMetaData.cxx @@ -43,7 +43,7 @@ OResultSetMetaData::~OResultSetMetaData() void OResultSetMetaData::checkColumnIndex(sal_Int32 column) { - if(column <= 0 || column > (sal_Int32)(sal_Int32)m_xColumns->get().size()) + if(column <= 0 || column > (sal_Int32)m_xColumns->get().size()) throwInvalidIndexException(*this); } diff --git a/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx b/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx index 8bcc770d7927..dfa72d49ed3a 100644 --- a/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx +++ b/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx @@ -455,7 +455,7 @@ void PreparedStatement::setInt( sal_Int32 parameterIndex, sal_Int32 x ) checkColumnIndex( parameterIndex ); OStringBuffer buf( 20 ); buf.append( "'" ); - buf.append( (sal_Int32) x ); + buf.append( x ); buf.append( "'" ); m_vars[parameterIndex-1] = buf.makeStringAndClear(); } @@ -467,7 +467,7 @@ void PreparedStatement::setLong( sal_Int32 parameterIndex, sal_Int64 x ) checkColumnIndex( parameterIndex ); OStringBuffer buf( 20 ); buf.append( "'" ); - buf.append( (sal_Int64) x ); + buf.append( x ); buf.append( "'" ); m_vars[parameterIndex-1] = buf.makeStringAndClear(); } diff --git a/connectivity/source/drivers/postgresql/pq_tools.cxx b/connectivity/source/drivers/postgresql/pq_tools.cxx index f040b37086b5..3ab8d1d621d5 100644 --- a/connectivity/source/drivers/postgresql/pq_tools.cxx +++ b/connectivity/source/drivers/postgresql/pq_tools.cxx @@ -697,11 +697,11 @@ std::vector< sal_Int32 > parseIntArray( const OUString & str ) // printf( ">%s<\n" , OUStringToOString( str, RTL_TEXTENCODING_UTF8 ).getStr() ); for( sal_Int32 i = str.indexOf( ' ' ) ; i != -1 ; i = str.indexOf( ' ', start) ) { - vec.push_back( (sal_Int32)rtl_ustr_toInt32( &str.pData->buffer[start], 10 ) ); + vec.push_back( rtl_ustr_toInt32( &str.pData->buffer[start], 10 ) ); // printf( "found %d\n" , rtl_ustr_toInt32( &str.pData->buffer[start], 10 )); start = i + 1; } - vec.push_back( (sal_Int32)rtl_ustr_toInt32( &str.pData->buffer[start], 10 ) ); + vec.push_back( rtl_ustr_toInt32( &str.pData->buffer[start], 10 ) ); // printf( "found %d\n" , rtl_ustr_toInt32( &str.pData->buffer[start], 10 )); return vec; } |