diff options
author | Noel Grandin <noel@peralex.com> | 2014-10-02 08:40:50 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-10-03 15:20:03 +0200 |
commit | 7d7b289da49ccd7979f650222bfb669cd6b623de (patch) | |
tree | 4a6f6d2608214e513984926142200f9bc26c26c9 /connectivity/source | |
parent | 11d22e164ec5e62e067a38ce11929b157381d1b7 (diff) |
loplugin: cstylecast
Change-Id: I114924d5e0407883b2e77016da3c2e3e55657b21
Diffstat (limited to 'connectivity/source')
36 files changed, 89 insertions, 91 deletions
diff --git a/connectivity/source/commontools/FValue.cxx b/connectivity/source/commontools/FValue.cxx index 38626ba58988..8e63f87f9e5e 100644 --- a/connectivity/source/commontools/FValue.cxx +++ b/connectivity/source/commontools/FValue.cxx @@ -892,7 +892,7 @@ Any ORowSetValue::makeAny() const case DataType::NUMERIC: case DataType::LONGVARCHAR: OSL_ENSURE(m_aValue.m_pString,"Value is null!"); - rValue <<= (OUString)m_aValue.m_pString; + rValue <<= OUString(m_aValue.m_pString); break; case DataType::FLOAT: rValue <<= m_aValue.m_nFloat; diff --git a/connectivity/source/drivers/calc/CCatalog.cxx b/connectivity/source/drivers/calc/CCatalog.cxx index 8bc6fa6240d4..36b3bfc23566 100644 --- a/connectivity/source/drivers/calc/CCatalog.cxx +++ b/connectivity/source/drivers/calc/CCatalog.cxx @@ -40,7 +40,7 @@ void OCalcCatalog::refreshTables() { TStringVector aVector; Sequence< OUString > aTypes; - OCalcConnection::ODocHolder aDocHodler(((OCalcConnection*)m_pConnection)); + OCalcConnection::ODocHolder aDocHolder(static_cast<OCalcConnection*>(m_pConnection)); Reference< XResultSet > xResult = m_xMetaData->getTables(Any(), OUString("%"),OUString("%"),aTypes); diff --git a/connectivity/source/drivers/calc/CColumns.cxx b/connectivity/source/drivers/calc/CColumns.cxx index f5227b316864..3cd002cd3681 100644 --- a/connectivity/source/drivers/calc/CColumns.cxx +++ b/connectivity/source/drivers/calc/CColumns.cxx @@ -32,7 +32,7 @@ using namespace ::com::sun::star::container; sdbcx::ObjectType OCalcColumns::createObject(const OUString& _rName) { - OCalcTable* pTable = (OCalcTable*)m_pTable; + OCalcTable* pTable = static_cast<OCalcTable*>(m_pTable); ::rtl::Reference<OSQLColumns> aCols = pTable->getTableColumns(); OSQLColumns::Vector::const_iterator aIter = find(aCols->get().begin(),aCols->get().end(),_rName,::comphelper::UStringMixEqual(isCaseSensitive())); diff --git a/connectivity/source/drivers/calc/CDatabaseMetaData.cxx b/connectivity/source/drivers/calc/CDatabaseMetaData.cxx index bb26ce95a85f..a689e3bf186a 100644 --- a/connectivity/source/drivers/calc/CDatabaseMetaData.cxx +++ b/connectivity/source/drivers/calc/CDatabaseMetaData.cxx @@ -383,7 +383,7 @@ Reference< XResultSet > SAL_CALL OCalcDatabaseMetaData::getTables( // get the sheet names from the document - OCalcConnection::ODocHolder aDocHodler(((OCalcConnection*)m_pConnection)); + OCalcConnection::ODocHolder aDocHodler(static_cast<OCalcConnection*>(m_pConnection)); Reference<XSpreadsheetDocument> xDoc = aDocHodler.getDoc(); if ( !xDoc.is() ) throw SQLException(); diff --git a/connectivity/source/drivers/dbase/DColumns.cxx b/connectivity/source/drivers/dbase/DColumns.cxx index dccd3fb9782c..126514003ba3 100644 --- a/connectivity/source/drivers/dbase/DColumns.cxx +++ b/connectivity/source/drivers/dbase/DColumns.cxx @@ -34,8 +34,7 @@ using namespace ::com::sun::star::container; sdbcx::ObjectType ODbaseColumns::createObject(const OUString& _rName) { - - ODbaseTable* pTable = (ODbaseTable*)m_pTable; + ODbaseTable* pTable = static_cast<ODbaseTable*>(m_pTable); ::rtl::Reference<OSQLColumns> aCols = pTable->getTableColumns(); OSQLColumns::Vector::const_iterator aIter = find(aCols->get().begin(),aCols->get().end(),_rName,::comphelper::UStringMixEqual(isCaseSensitive())); diff --git a/connectivity/source/drivers/file/FDriver.cxx b/connectivity/source/drivers/file/FDriver.cxx index 950a76c96764..684bf1fe2e50 100644 --- a/connectivity/source/drivers/file/FDriver.cxx +++ b/connectivity/source/drivers/file/FDriver.cxx @@ -197,7 +197,7 @@ Reference< XTablesSupplier > SAL_CALL OFileDriver::getDataDefinitionByConnection OConnection* pConnection = NULL; for (OWeakRefArray::iterator i = m_xConnections.begin(); m_xConnections.end() != i; ++i) { - if ((OConnection*) Reference< XConnection >::query(i->get().get()).get() == pSearchConnection) + if (static_cast<OConnection*>( Reference< XConnection >::query(i->get().get()).get() ) == pSearchConnection) { pConnection = pSearchConnection; break; diff --git a/connectivity/source/drivers/file/FPreparedStatement.cxx b/connectivity/source/drivers/file/FPreparedStatement.cxx index 199b4f6ee522..d54540c394db 100644 --- a/connectivity/source/drivers/file/FPreparedStatement.cxx +++ b/connectivity/source/drivers/file/FPreparedStatement.cxx @@ -192,7 +192,7 @@ Reference< XConnection > SAL_CALL OPreparedStatement::getConnection( ) throw(SQ ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); - return (Reference< XConnection >)m_pConnection; + return Reference< XConnection >(m_pConnection); } diff --git a/connectivity/source/drivers/file/FStatement.cxx b/connectivity/source/drivers/file/FStatement.cxx index 229cc8ee88b7..d93fef878f16 100644 --- a/connectivity/source/drivers/file/FStatement.cxx +++ b/connectivity/source/drivers/file/FStatement.cxx @@ -281,7 +281,7 @@ Reference< XResultSet > SAL_CALL OStatement::executeQuery( const OUString& sql ) Reference< XConnection > SAL_CALL OStatement::getConnection( ) throw(SQLException, RuntimeException, std::exception) { - return (Reference< XConnection >)m_pConnection; + return Reference< XConnection >(m_pConnection); } sal_Int32 SAL_CALL OStatement::executeUpdate( const OUString& sql ) throw(SQLException, RuntimeException, std::exception) diff --git a/connectivity/source/drivers/file/fcomp.cxx b/connectivity/source/drivers/file/fcomp.cxx index 5ed3e0d92f47..7a86ce36b15e 100644 --- a/connectivity/source/drivers/file/fcomp.cxx +++ b/connectivity/source/drivers/file/fcomp.cxx @@ -372,16 +372,16 @@ OOperand* OPredicateCompiler::execute_BETWEEN(OSQLParseNode* pPredicateNode) thr pOb2->setValue((double)pOb2->getValue()); break; case DataType::DATE: - pOb1->setValue((util::Date)pOb1->getValue()); - pOb2->setValue((util::Date)pOb2->getValue()); + pOb1->setValue(static_cast<util::Date>(pOb1->getValue())); + pOb2->setValue(static_cast<util::Date>(pOb2->getValue())); break; case DataType::TIME: - pOb1->setValue((util::Time)pOb1->getValue()); - pOb2->setValue((util::Time)pOb2->getValue()); + pOb1->setValue(static_cast<util::Time>(pOb1->getValue())); + pOb2->setValue(static_cast<util::Time>(pOb2->getValue())); break; case DataType::TIMESTAMP: - pOb1->setValue((util::DateTime)pOb1->getValue()); - pOb2->setValue((util::DateTime)pOb2->getValue()); + pOb1->setValue(static_cast<util::DateTime>(pOb1->getValue())); + pOb2->setValue(static_cast<util::DateTime>(pOb2->getValue())); break; } } @@ -557,7 +557,7 @@ bool OPredicateInterpreter::evaluate(OCodeList& rCodeList) if (pOperand) m_aStack.push(pOperand); else - ((OOperator *)(*aIter))->Exec(m_aStack); + static_cast<OOperator *>(*aIter)->Exec(m_aStack); } OOperand* pOperand = m_aStack.top(); @@ -584,7 +584,7 @@ void OPredicateInterpreter::evaluateSelection(OCodeList& rCodeList,ORowSetValueD if (pOperand) m_aStack.push(pOperand); else - ((OOperator *)(*aIter))->Exec(m_aStack); + static_cast<OOperator *>(*aIter)->Exec(m_aStack); } OOperand* pOperand = m_aStack.top(); diff --git a/connectivity/source/drivers/firebird/DatabaseMetaData.cxx b/connectivity/source/drivers/firebird/DatabaseMetaData.cxx index bff558ce3e50..52a96ef6ba0c 100644 --- a/connectivity/source/drivers/firebird/DatabaseMetaData.cxx +++ b/connectivity/source/drivers/firebird/DatabaseMetaData.cxx @@ -832,7 +832,7 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsBatchUpdates() uno::Reference< XConnection > SAL_CALL ODatabaseMetaData::getConnection() throw(SQLException, RuntimeException, std::exception) { - return (uno::Reference< XConnection >) m_pConnection; + return uno::Reference< XConnection >(m_pConnection); } // here follow all methods which return a resultset diff --git a/connectivity/source/drivers/firebird/Statement.cxx b/connectivity/source/drivers/firebird/Statement.cxx index 94b947409245..42478941dc1f 100644 --- a/connectivity/source/drivers/firebird/Statement.cxx +++ b/connectivity/source/drivers/firebird/Statement.cxx @@ -162,7 +162,7 @@ uno::Reference< XConnection > SAL_CALL OStatement::getConnection() MutexGuard aGuard(m_aMutex); checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed); - return (uno::Reference< XConnection >)m_pConnection; + return uno::Reference< XConnection >(m_pConnection); } Any SAL_CALL OStatement::queryInterface( const Type & rType ) throw(RuntimeException, std::exception) diff --git a/connectivity/source/drivers/flat/EColumns.cxx b/connectivity/source/drivers/flat/EColumns.cxx index 4102d52141f3..033f0a9aafd2 100644 --- a/connectivity/source/drivers/flat/EColumns.cxx +++ b/connectivity/source/drivers/flat/EColumns.cxx @@ -32,8 +32,7 @@ using namespace ::com::sun::star::container; sdbcx::ObjectType OFlatColumns::createObject(const OUString& _rName) { - - OFlatTable* pTable = (OFlatTable*)m_pTable; + OFlatTable* pTable = static_cast<OFlatTable*>(m_pTable); ::rtl::Reference<OSQLColumns> aCols = pTable->getTableColumns(); OSQLColumns::Vector::const_iterator aIter = find(aCols->get().begin(),aCols->get().end(),_rName,::comphelper::UStringMixEqual(isCaseSensitive())); sdbcx::ObjectType xRet; diff --git a/connectivity/source/drivers/flat/ETables.cxx b/connectivity/source/drivers/flat/ETables.cxx index 9abaf9b34740..f0ce8151d0b6 100644 --- a/connectivity/source/drivers/flat/ETables.cxx +++ b/connectivity/source/drivers/flat/ETables.cxx @@ -41,7 +41,7 @@ using namespace ::com::sun::star::container; sdbcx::ObjectType OFlatTables::createObject(const OUString& _rName) { - OFlatTable* pRet = new OFlatTable(this,(OFlatConnection*)static_cast<OFileCatalog&>(m_rParent).getConnection(), + OFlatTable* pRet = new OFlatTable(this, static_cast<OFlatConnection*>(static_cast<OFileCatalog&>(m_rParent).getConnection()), _rName,OUString("TABLE")); sdbcx::ObjectType xRet = pRet; pRet->construct(); diff --git a/connectivity/source/drivers/jdbc/Blob.cxx b/connectivity/source/drivers/jdbc/Blob.cxx index a76831aa0380..50eaf103fbff 100644 --- a/connectivity/source/drivers/jdbc/Blob.cxx +++ b/connectivity/source/drivers/jdbc/Blob.cxx @@ -77,7 +77,7 @@ sal_Int64 SAL_CALL java_sql_Blob::length( ) throw(::com::sun::star::sdbc::SQLEx // submit Java-Call static jmethodID mID(NULL); obtainMethodId(t.pEnv, cMethodName,cSignature, mID); - jbyteArray out = (jbyteArray)t.pEnv->CallObjectMethod( object, mID,pos,count); + jbyteArray out = static_cast<jbyteArray>(t.pEnv->CallObjectMethod( object, mID,pos,count)); ThrowSQLException(t.pEnv,*this); if(out) { diff --git a/connectivity/source/drivers/jdbc/CallableStatement.cxx b/connectivity/source/drivers/jdbc/CallableStatement.cxx index 7b48aeada968..6638b55aa1c3 100644 --- a/connectivity/source/drivers/jdbc/CallableStatement.cxx +++ b/connectivity/source/drivers/jdbc/CallableStatement.cxx @@ -99,7 +99,7 @@ Sequence< sal_Int8 > SAL_CALL java_sql_CallableStatement::getBytes( sal_Int32 co SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); createStatement(t.pEnv); static jmethodID mID(NULL); - jbyteArray out = (jbyteArray)callObjectMethodWithIntArg(t.pEnv,"getBytes","(I)[B", mID, columnIndex); + jbyteArray out = static_cast<jbyteArray>(callObjectMethodWithIntArg(t.pEnv,"getBytes","(I)[B", mID, columnIndex)); if (out) { jboolean p = sal_False; diff --git a/connectivity/source/drivers/jdbc/Clob.cxx b/connectivity/source/drivers/jdbc/Clob.cxx index 842ae71caede..a157a3321b7f 100644 --- a/connectivity/source/drivers/jdbc/Clob.cxx +++ b/connectivity/source/drivers/jdbc/Clob.cxx @@ -76,7 +76,7 @@ OUString SAL_CALL java_sql_Clob::getSubString( sal_Int64 pos, sal_Int32 subStrin // execute Java-Call static jmethodID mID(NULL); obtainMethodId(t.pEnv, cMethodName,cSignature, mID); - jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID,pos,subStringLength); + jstring out = static_cast<jstring>(t.pEnv->CallObjectMethod( object, mID,pos,subStringLength)); ThrowSQLException(t.pEnv,*this); aStr = JavaString2String(t.pEnv,out); } //t.pEnv @@ -111,7 +111,7 @@ sal_Int64 SAL_CALL java_sql_Clob::position( const OUString& searchstr, sal_Int32 obtainMethodId(t.pEnv, cMethodName,cSignature, mID); out = t.pEnv->CallLongMethod( object, mID, args[0].l,start ); ThrowSQLException(t.pEnv,*this); - t.pEnv->DeleteLocalRef((jstring)args[0].l); + t.pEnv->DeleteLocalRef(static_cast<jstring>(args[0].l)); } //t.pEnv return (sal_Int64)out; } diff --git a/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx b/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx index d332d11ff43a..d256c7be5c96 100644 --- a/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx +++ b/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx @@ -173,23 +173,23 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTables( t.pEnv->ExceptionClear();// we have to clear the exception here because we want to handle it below if ( aCatalogFilter.hasValue() ) { - t.pEnv->DeleteLocalRef((jstring)args[0].l); + t.pEnv->DeleteLocalRef(static_cast<jstring>(args[0].l)); OSL_VERIFY_RES( !isExceptionOccurred( t.pEnv, true ), "Exception occurred!" ); } if(args[1].l) { - t.pEnv->DeleteLocalRef((jstring)args[1].l); + t.pEnv->DeleteLocalRef(static_cast<jstring>(args[1].l)); OSL_VERIFY_RES( !isExceptionOccurred( t.pEnv, true ), "Exception occurred!" ); } if(!tableNamePattern.isEmpty()) { - t.pEnv->DeleteLocalRef((jstring)args[2].l); + t.pEnv->DeleteLocalRef(static_cast<jstring>(args[2].l)); OSL_VERIFY_RES( !isExceptionOccurred( t.pEnv, true ), "Exception occurred!" ); } //for(INT16 i=0;i<len;i++) if ( args[3].l ) { - t.pEnv->DeleteLocalRef( (jobjectArray)args[3].l ); + t.pEnv->DeleteLocalRef( static_cast<jobjectArray>(args[3].l) ); OSL_VERIFY_RES( !isExceptionOccurred( t.pEnv, true ), "Exception occurred!" ); } @@ -358,11 +358,11 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getIndexInfo( // and clean up if(catalog.hasValue()) - t.pEnv->DeleteLocalRef((jstring)args[0].l); + t.pEnv->DeleteLocalRef(static_cast<jstring>(args[0].l)); if(args[1].l) - t.pEnv->DeleteLocalRef((jstring)args[1].l); + t.pEnv->DeleteLocalRef(static_cast<jstring>(args[1].l)); if(!table.isEmpty()) - t.pEnv->DeleteLocalRef((jstring)args[2].l); + t.pEnv->DeleteLocalRef(static_cast<jstring>(args[2].l)); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); } if ( !out ) @@ -397,11 +397,11 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getBestRowIdentifier // and cleanup if(catalog.hasValue()) - t.pEnv->DeleteLocalRef((jstring)args[0].l); + t.pEnv->DeleteLocalRef(static_cast<jstring>(args[0].l)); if(args[1].l) - t.pEnv->DeleteLocalRef((jstring)args[1].l); + t.pEnv->DeleteLocalRef(static_cast<jstring>(args[1].l)); if(!table.isEmpty()) - t.pEnv->DeleteLocalRef((jstring)args[2].l); + t.pEnv->DeleteLocalRef(static_cast<jstring>(args[2].l)); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); } @@ -516,17 +516,17 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getCrossReference( // and clean up if(primaryCatalog.hasValue()) - t.pEnv->DeleteLocalRef((jstring)args[0].l); + t.pEnv->DeleteLocalRef(static_cast<jstring>(args[0].l)); if(args[1].l) - t.pEnv->DeleteLocalRef((jstring)args[1].l); + t.pEnv->DeleteLocalRef(static_cast<jstring>(args[1].l)); if(!primaryTable.isEmpty()) - t.pEnv->DeleteLocalRef((jstring)args[2].l); + t.pEnv->DeleteLocalRef(static_cast<jstring>(args[2].l)); if(foreignCatalog.hasValue()) - t.pEnv->DeleteLocalRef((jstring)args[3].l); + t.pEnv->DeleteLocalRef(static_cast<jstring>(args[3].l)); if(args[4].l) - t.pEnv->DeleteLocalRef((jstring)args[4].l); + t.pEnv->DeleteLocalRef(static_cast<jstring>(args[4].l)); if(!foreignTable.isEmpty()) - t.pEnv->DeleteLocalRef((jstring)args[5].l); + t.pEnv->DeleteLocalRef(static_cast<jstring>(args[5].l)); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); } @@ -645,13 +645,13 @@ Reference< XResultSet > java_sql_DatabaseMetaData::impl_callResultSetMethodWithS // clean up if ( args[0].l ) - t.pEnv->DeleteLocalRef( (jstring)args[0].l ); + t.pEnv->DeleteLocalRef( static_cast<jstring>(args[0].l) ); if ( args[1].l ) - t.pEnv->DeleteLocalRef( (jstring)args[1].l ); + t.pEnv->DeleteLocalRef( static_cast<jstring>(args[1].l) ); if ( args[2].l ) - t.pEnv->DeleteLocalRef( (jstring)args[2].l ); + t.pEnv->DeleteLocalRef( static_cast<jstring>(args[2].l) ); if ( args[3].l ) - t.pEnv->DeleteLocalRef( (jstring)args[3].l ); + t.pEnv->DeleteLocalRef( static_cast<jstring>(args[3].l) ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); } @@ -1432,13 +1432,13 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getUDTs( out = t.pEnv->CallObjectMethod( object, mID, args[0].l, args[1].l,args[2].l,args[3].l); if(catalog.hasValue()) - t.pEnv->DeleteLocalRef((jstring)args[0].l); + t.pEnv->DeleteLocalRef(static_cast<jstring>(args[0].l)); if(!schemaPattern.isEmpty()) - t.pEnv->DeleteLocalRef((jstring)args[1].l); + t.pEnv->DeleteLocalRef(static_cast<jstring>(args[1].l)); if(!typeNamePattern.isEmpty()) - t.pEnv->DeleteLocalRef((jstring)args[2].l); + t.pEnv->DeleteLocalRef(static_cast<jstring>(args[2].l)); if(args[3].l) - t.pEnv->DeleteLocalRef((jintArray)args[3].l); + t.pEnv->DeleteLocalRef(static_cast<jintArray>(args[3].l)); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); } } diff --git a/connectivity/source/drivers/jdbc/DriverPropertyInfo.cxx b/connectivity/source/drivers/jdbc/DriverPropertyInfo.cxx index d0c35e5b9fea..07b49af2af75 100644 --- a/connectivity/source/drivers/jdbc/DriverPropertyInfo.cxx +++ b/connectivity/source/drivers/jdbc/DriverPropertyInfo.cxx @@ -68,7 +68,7 @@ OUString java_sql_DriverPropertyInfo::name() { jfieldID id = t.pEnv->GetFieldID(getMyClass(),"name","Ljava/lang/String;"); if(id) - aStr = JavaString2String(t.pEnv,(jstring)t.pEnv->GetObjectField( object, id)); + aStr = JavaString2String(t.pEnv, static_cast<jstring>(t.pEnv->GetObjectField( object, id))); } //t.pEnv return aStr; } @@ -81,7 +81,7 @@ OUString java_sql_DriverPropertyInfo::description() { jfieldID id = t.pEnv->GetFieldID(getMyClass(),"description","Ljava/lang/String;"); if(id) - aStr = JavaString2String(t.pEnv,(jstring)t.pEnv->GetObjectField( object, id)); + aStr = JavaString2String(t.pEnv, static_cast<jstring>(t.pEnv->GetObjectField( object, id))); } //t.pEnv return aStr; } @@ -94,7 +94,7 @@ OUString java_sql_DriverPropertyInfo::value() { jfieldID id = t.pEnv->GetFieldID(getMyClass(),"value","Ljava/lang/String;"); if(id) - aStr = JavaString2String(t.pEnv,(jstring)t.pEnv->GetObjectField( object, id)); + aStr = JavaString2String(t.pEnv, static_cast<jstring>(t.pEnv->GetObjectField( object, id))); } //t.pEnv return aStr; } @@ -122,7 +122,7 @@ Sequence< OUString> java_sql_DriverPropertyInfo::choices() { const java_lang_String * pEmpty = NULL; const OUString * pEmpty2 = NULL; - return copyArrayAndDelete(t.pEnv,(jobjectArray)t.pEnv->GetObjectField( object, id), pEmpty2, pEmpty); + return copyArrayAndDelete(t.pEnv, static_cast<jobjectArray>(t.pEnv->GetObjectField( object, id)), pEmpty2, pEmpty); } } //t.pEnv return Sequence< OUString>(); diff --git a/connectivity/source/drivers/jdbc/JConnection.cxx b/connectivity/source/drivers/jdbc/JConnection.cxx index f1b341ea7f35..b1e17770e2d6 100644 --- a/connectivity/source/drivers/jdbc/JConnection.cxx +++ b/connectivity/source/drivers/jdbc/JConnection.cxx @@ -545,7 +545,7 @@ OUString SAL_CALL java_sql_Connection::nativeSQL( const OUString& sql ) throw(SQ jdbc::LocalRef< jstring > str( t.env(),convertwchar_tToJavaString(t.pEnv,sql)); jobject out = t.pEnv->CallObjectMethod( object, mID, str.get() ); - aStr = JavaString2String(t.pEnv, (jstring)out ); + aStr = JavaString2String(t.pEnv, static_cast<jstring>(out) ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); } //t.pEnv @@ -725,7 +725,7 @@ void java_sql_Connection::loadDriverFromProperties( const OUString& _sDriverClas jclass tempClass = t.pEnv->GetObjectClass(m_pDriverobject); if ( m_pDriverobject ) { - m_Driver_theClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + m_Driver_theClass = static_cast<jclass>(t.pEnv->NewGlobalRef( tempClass )); t.pEnv->DeleteLocalRef( tempClass ); } } diff --git a/connectivity/source/drivers/jdbc/JStatement.cxx b/connectivity/source/drivers/jdbc/JStatement.cxx index 12fa5d6b43c3..3f5958e6032c 100644 --- a/connectivity/source/drivers/jdbc/JStatement.cxx +++ b/connectivity/source/drivers/jdbc/JStatement.cxx @@ -292,7 +292,7 @@ Reference< XConnection > SAL_CALL java_sql_Statement_Base::getConnection( ) thr { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); - return (Reference< XConnection >)m_pConnection; + return Reference< XConnection >(m_pConnection); } @@ -324,7 +324,7 @@ Sequence< sal_Int32 > SAL_CALL java_sql_Statement::executeBatch( ) throw(::com: SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); createStatement(t.pEnv); static jmethodID mID(NULL); - jintArray out = (jintArray)callObjectMethod(t.pEnv,"executeBatch","()[I", mID); + jintArray out = static_cast<jintArray>(callObjectMethod(t.pEnv,"executeBatch","()[I", mID)); if (out) { jboolean p = sal_False; diff --git a/connectivity/source/drivers/jdbc/Object.cxx b/connectivity/source/drivers/jdbc/Object.cxx index 7fe79967e23d..67529483b29d 100644 --- a/connectivity/source/drivers/jdbc/Object.cxx +++ b/connectivity/source/drivers/jdbc/Object.cxx @@ -334,7 +334,7 @@ OUString java_lang_Object::callStringMethod( const char* _pMethodName, jmethodID OSL_ENSURE( t.pEnv, "java_lang_Object::callStringMethod: no Java environment anymore!" ); // call method - jstring out = (jstring)callObjectMethod(t.pEnv,_pMethodName,"()Ljava/lang/String;", _inout_MethodID); + jstring out = static_cast<jstring>(callObjectMethod(t.pEnv,_pMethodName,"()Ljava/lang/String;", _inout_MethodID)); return JavaString2String( t.pEnv, out ); } @@ -362,7 +362,7 @@ OUString java_lang_Object::callStringMethodWithIntArg( const char* _pMethodName, { SDBThreadAttach t; OSL_ENSURE( t.pEnv, "java_lang_Object::callStringMethod: no Java environment anymore!" ); - jstring out = (jstring)callObjectMethodWithIntArg(t.pEnv,_pMethodName,"(I)Ljava/lang/String;",_inout_MethodID,_nArgument); + jstring out = static_cast<jstring>(callObjectMethodWithIntArg(t.pEnv,_pMethodName,"(I)Ljava/lang/String;",_inout_MethodID,_nArgument)); return JavaString2String( t.pEnv, out ); } @@ -410,7 +410,7 @@ jclass java_lang_Object::findMyClass(const char* _pClassName) t.pEnv->ExceptionDescribe(); t.pEnv->ExceptionClear(); } - jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + jclass globClass = static_cast<jclass>(t.pEnv->NewGlobalRef( tempClass )); t.pEnv->DeleteLocalRef( tempClass ); return globClass; } diff --git a/connectivity/source/drivers/jdbc/PreparedStatement.cxx b/connectivity/source/drivers/jdbc/PreparedStatement.cxx index 6da0c5794b60..ecd7d01818cb 100644 --- a/connectivity/source/drivers/jdbc/PreparedStatement.cxx +++ b/connectivity/source/drivers/jdbc/PreparedStatement.cxx @@ -141,7 +141,7 @@ void SAL_CALL java_sql_PreparedStatement::setString( sal_Int32 parameterIndex, c ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL java_sql_PreparedStatement::getConnection( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) { - return (Reference< XConnection >)m_pConnection; + return Reference< XConnection >(m_pConnection); } @@ -587,7 +587,7 @@ void SAL_CALL java_sql_PreparedStatement::addBatch( ) throw(::com::sun::star::sd SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); createStatement(t.pEnv); static jmethodID mID(NULL); - jintArray out = (jintArray)callObjectMethod(t.pEnv,"executeBatch","()[I", mID); + jintArray out = static_cast<jintArray>(callObjectMethod(t.pEnv,"executeBatch","()[I", mID)); if(out) { jboolean p = sal_False; @@ -651,7 +651,7 @@ void java_sql_PreparedStatement::createStatement(JNIEnv* _pEnv) if ( mID2 ) out = _pEnv->CallObjectMethod( m_pConnection->getJavaObject(), mID2, args[0].l ); } - _pEnv->DeleteLocalRef((jstring)args[0].l); + _pEnv->DeleteLocalRef(static_cast<jstring>(args[0].l)); ThrowLoggedSQLException( m_aLogger, _pEnv, *this ); if ( out ) object = _pEnv->NewGlobalRef( out ); diff --git a/connectivity/source/drivers/jdbc/ResultSet.cxx b/connectivity/source/drivers/jdbc/ResultSet.cxx index c8390e65a8ee..d6553a8d2749 100644 --- a/connectivity/source/drivers/jdbc/ResultSet.cxx +++ b/connectivity/source/drivers/jdbc/ResultSet.cxx @@ -177,7 +177,7 @@ Sequence< sal_Int8 > SAL_CALL java_sql_ResultSet::getBytes( sal_Int32 columnInde Sequence< sal_Int8 > aSeq; SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); static jmethodID mID(NULL); - jbyteArray out = (jbyteArray)callObjectMethodWithIntArg(t.pEnv,"getBytes","(I)[B", mID, columnIndex); + jbyteArray out = static_cast<jbyteArray>(callObjectMethodWithIntArg(t.pEnv,"getBytes","(I)[B", mID, columnIndex)); if (out) { jboolean p = sal_False; @@ -309,7 +309,7 @@ Any SAL_CALL java_sql_ResultSet::getObject( sal_Int32 columnIndex, const Referen } out = t.pEnv->CallObjectMethodA( object, mID, args); - t.pEnv->DeleteLocalRef((jstring)args[1].l); + t.pEnv->DeleteLocalRef(static_cast<jstring>(args[1].l)); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // and clean up if ( out ) @@ -317,7 +317,7 @@ Any SAL_CALL java_sql_ResultSet::getObject( sal_Int32 columnIndex, const Referen if ( t.pEnv->IsInstanceOf(out,java_lang_String::st_getMyClass()) ) { java_lang_String aVal(t.pEnv,out); - aRet <<= (OUString)aVal; + aRet <<= OUString(aVal); } else if ( t.pEnv->IsInstanceOf(out,java_lang_Boolean::st_getMyClass()) ) { @@ -328,17 +328,17 @@ Any SAL_CALL java_sql_ResultSet::getObject( sal_Int32 columnIndex, const Referen else if ( t.pEnv->IsInstanceOf(out,java_sql_Date::st_getMyClass()) ) { java_sql_Date aVal(t.pEnv,out); - aRet <<= (::com::sun::star::util::Date)aVal; + aRet <<= ::com::sun::star::util::Date(aVal); } else if ( t.pEnv->IsInstanceOf(out,java_sql_Time::st_getMyClass()) ) { java_sql_Time aVal(t.pEnv,out); - aRet <<= (::com::sun::star::util::Time)aVal; + aRet <<= ::com::sun::star::util::Time(aVal); } else if ( t.pEnv->IsInstanceOf(out,java_sql_Timestamp::st_getMyClass()) ) { java_sql_Timestamp aVal(t.pEnv,out); - aRet <<= (::com::sun::star::util::DateTime)aVal; + aRet <<= ::com::sun::star::util::DateTime(aVal); } else t.pEnv->DeleteLocalRef(out); diff --git a/connectivity/source/drivers/jdbc/SQLException.cxx b/connectivity/source/drivers/jdbc/SQLException.cxx index 6249a4e92159..be3d244884e3 100644 --- a/connectivity/source/drivers/jdbc/SQLException.cxx +++ b/connectivity/source/drivers/jdbc/SQLException.cxx @@ -70,7 +70,7 @@ css::sdbc::SQLException java_sql_SQLException_BASE::getNextException() const if( out ) { java_sql_SQLException_BASE warn_base(t.pEnv,out); - return (css::sdbc::SQLException)java_sql_SQLException(warn_base,0); + return css::sdbc::SQLException(java_sql_SQLException(warn_base,0)); } return css::sdbc::SQLException(); diff --git a/connectivity/source/drivers/jdbc/String.cxx b/connectivity/source/drivers/jdbc/String.cxx index f8c1368e9cc7..db873c1bdcb6 100644 --- a/connectivity/source/drivers/jdbc/String.cxx +++ b/connectivity/source/drivers/jdbc/String.cxx @@ -47,7 +47,7 @@ java_lang_String::operator OUString() SDBThreadAttach t; if(!t.pEnv) return OUString(); - return JavaString2String(t.pEnv,(jstring)object); + return JavaString2String(t.pEnv, static_cast<jstring>(object)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/jdbc/Timestamp.cxx b/connectivity/source/drivers/jdbc/Timestamp.cxx index cc2c7e1d7399..86f0fe7a8705 100644 --- a/connectivity/source/drivers/jdbc/Timestamp.cxx +++ b/connectivity/source/drivers/jdbc/Timestamp.cxx @@ -116,7 +116,7 @@ java_sql_Time::java_sql_Time( const ::com::sun::star::util::Time& _rOut ): java_ mID = t.pEnv->GetStaticMethodID( getMyClass(), "valueOf", cSignature ); OSL_ENSURE(mID,"Unknown method id!"); tempObj = t.pEnv->CallStaticObjectMethod( getMyClass(), mID, args[0].l ); - t.pEnv->DeleteLocalRef((jstring)args[0].l); + t.pEnv->DeleteLocalRef(static_cast<jstring>(args[0].l)); saveRef( t.pEnv, tempObj ); t.pEnv->DeleteLocalRef( tempObj ); // and clean diff --git a/connectivity/source/drivers/jdbc/tools.cxx b/connectivity/source/drivers/jdbc/tools.cxx index 6c569f2909f9..46cc4c4f49c7 100644 --- a/connectivity/source/drivers/jdbc/tools.cxx +++ b/connectivity/source/drivers/jdbc/tools.cxx @@ -53,8 +53,8 @@ void java_util_Properties::setProperty(const OUString& key, const OUString& valu obtainMethodId(t.pEnv, cMethodName,cSignature, mID); out = t.pEnv->CallObjectMethod(object, mID, args[0].l,args[1].l); ThrowSQLException(t.pEnv,NULL); - t.pEnv->DeleteLocalRef((jstring)args[1].l); - t.pEnv->DeleteLocalRef((jstring)args[0].l); + t.pEnv->DeleteLocalRef(static_cast<jstring>(args[1].l)); + t.pEnv->DeleteLocalRef(static_cast<jstring>(args[0].l)); ThrowSQLException(t.pEnv,0); if(out) t.pEnv->DeleteLocalRef(out); diff --git a/connectivity/source/drivers/mork/MPreparedStatement.cxx b/connectivity/source/drivers/mork/MPreparedStatement.cxx index 55fdee52d5bb..47312759551d 100644 --- a/connectivity/source/drivers/mork/MPreparedStatement.cxx +++ b/connectivity/source/drivers/mork/MPreparedStatement.cxx @@ -194,7 +194,7 @@ Reference< XConnection > SAL_CALL OPreparedStatement::getConnection( ) throw(SQ ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed); - return (Reference< XConnection >)m_pConnection; + return Reference< XConnection >(m_pConnection); } diff --git a/connectivity/source/drivers/mork/MStatement.cxx b/connectivity/source/drivers/mork/MStatement.cxx index 3dd425e9ec4e..a5ae705f0674 100644 --- a/connectivity/source/drivers/mork/MStatement.cxx +++ b/connectivity/source/drivers/mork/MStatement.cxx @@ -341,7 +341,7 @@ Reference< XConnection > SAL_CALL OCommonStatement::getConnection( ) throw(SQLE checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed); // just return our connection here - return (Reference< XConnection >)m_pConnection; + return Reference< XConnection >(m_pConnection); } Any SAL_CALL OStatement::queryInterface( const Type & rType ) throw(RuntimeException, std::exception) diff --git a/connectivity/source/drivers/odbc/OConnection.cxx b/connectivity/source/drivers/odbc/OConnection.cxx index 5a0761d81d37..3c524aece845 100644 --- a/connectivity/source/drivers/odbc/OConnection.cxx +++ b/connectivity/source/drivers/odbc/OConnection.cxx @@ -113,7 +113,7 @@ SQLRETURN OConnection::OpenConnection(const OUString& aConnectStr, sal_Int32 nTi memcpy(szConnStrIn, (SDB_ODBC_CHAR*) aConStr.getStr(), ::std::min<sal_Int32>((sal_Int32)2048,aConStr.getLength())); #ifndef MACOSX - N3SQLSetConnectAttr(m_aConnectionHandle,SQL_ATTR_LOGIN_TIMEOUT,(SQLPOINTER)(sal_IntPtr)nTimeOut,SQL_IS_UINTEGER); + N3SQLSetConnectAttr(m_aConnectionHandle,SQL_ATTR_LOGIN_TIMEOUT,reinterpret_cast<SQLPOINTER>(nTimeOut),SQL_IS_UINTEGER); #else (void)nTimeOut; /* WaE */ #endif @@ -172,7 +172,7 @@ SQLRETURN OConnection::OpenConnection(const OUString& aConnectStr, sal_Int32 nTi // autocoomit is always default if (!m_bReadOnly) - N3SQLSetConnectAttr(m_aConnectionHandle,SQL_ATTR_AUTOCOMMIT,(SQLPOINTER)SQL_AUTOCOMMIT_ON,SQL_IS_INTEGER); + N3SQLSetConnectAttr(m_aConnectionHandle,SQL_ATTR_AUTOCOMMIT, reinterpret_cast<SQLPOINTER>(SQL_AUTOCOMMIT_ON),SQL_IS_INTEGER); return nSQLRETURN; } @@ -327,7 +327,7 @@ void SAL_CALL OConnection::setAutoCommit( sal_Bool autoCommit ) throw(SQLExcepti OTools::ThrowException(this,N3SQLSetConnectAttr(m_aConnectionHandle, SQL_ATTR_AUTOCOMMIT, - (SQLPOINTER)((autoCommit) ? SQL_AUTOCOMMIT_ON : SQL_AUTOCOMMIT_OFF) ,SQL_IS_INTEGER), + reinterpret_cast<SQLPOINTER>((autoCommit) ? SQL_AUTOCOMMIT_ON : SQL_AUTOCOMMIT_OFF) ,SQL_IS_INTEGER), m_aConnectionHandle,SQL_HANDLE_DBC,*this); } @@ -435,7 +435,7 @@ void SAL_CALL OConnection::setTransactionIsolation( sal_Int32 level ) throw(SQLE OTools::ThrowException(this,N3SQLSetConnectAttr(m_aConnectionHandle, SQL_ATTR_TXN_ISOLATION, - (SQLPOINTER)(sal_IntPtr)level,SQL_IS_INTEGER), + reinterpret_cast<SQLPOINTER>(level),SQL_IS_INTEGER), m_aConnectionHandle,SQL_HANDLE_DBC,*this); } diff --git a/connectivity/source/drivers/odbc/OPreparedStatement.cxx b/connectivity/source/drivers/odbc/OPreparedStatement.cxx index a99900e88344..59cd828c2c5d 100644 --- a/connectivity/source/drivers/odbc/OPreparedStatement.cxx +++ b/connectivity/source/drivers/odbc/OPreparedStatement.cxx @@ -253,7 +253,7 @@ Reference< XConnection > SAL_CALL OPreparedStatement::getConnection( ) throw(SQ ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); - return (Reference< XConnection >)m_pConnection; + return Reference< XConnection >(m_pConnection); } diff --git a/connectivity/source/drivers/odbc/ORealDriver.cxx b/connectivity/source/drivers/odbc/ORealDriver.cxx index 6d0dde33fe5b..6ff10e25e471 100644 --- a/connectivity/source/drivers/odbc/ORealDriver.cxx +++ b/connectivity/source/drivers/odbc/ORealDriver.cxx @@ -343,7 +343,7 @@ SQLHANDLE ORealObdcDriver::EnvironmentHandle(OUString &_rPath) // Save in global Structure m_pDriverHandle = h; - SQLRETURN nError = N3SQLSetEnvAttr(h, SQL_ATTR_ODBC_VERSION,(SQLPOINTER) SQL_OV_ODBC3, SQL_IS_UINTEGER); + SQLRETURN nError = N3SQLSetEnvAttr(h, SQL_ATTR_ODBC_VERSION, reinterpret_cast<SQLPOINTER>(SQL_OV_ODBC3), SQL_IS_UINTEGER); OSL_UNUSED( nError ); //N3SQLSetEnvAttr(h, SQL_ATTR_CONNECTION_POOLING,(SQLPOINTER) SQL_CP_ONE_PER_HENV, SQL_IS_INTEGER); } diff --git a/connectivity/source/drivers/odbc/OStatement.cxx b/connectivity/source/drivers/odbc/OStatement.cxx index 879d9c22b9f3..9c39db691533 100644 --- a/connectivity/source/drivers/odbc/OStatement.cxx +++ b/connectivity/source/drivers/odbc/OStatement.cxx @@ -468,7 +468,7 @@ Reference< XConnection > SAL_CALL OStatement_Base::getConnection( ) throw(SQLEx ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); - return (Reference< XConnection >)m_pConnection; + return Reference< XConnection >(m_pConnection); } diff --git a/connectivity/source/drivers/odbc/OTools.cxx b/connectivity/source/drivers/odbc/OTools.cxx index 13a14104d232..e09a89b1d701 100644 --- a/connectivity/source/drivers/odbc/OTools.cxx +++ b/connectivity/source/drivers/odbc/OTools.cxx @@ -246,7 +246,7 @@ void OTools::bindValue( OConnection* _pConnection, } break; case SQL_LONGVARBINARY: { - _pData = (void*)(sal_IntPtr)(columnIndex); + _pData = reinterpret_cast<void*>(columnIndex); sal_Int32 nLen = 0; nLen = ((const ::com::sun::star::uno::Sequence< sal_Int8 > *)_pValue)->getLength(); *pLen = (SQLLEN)SQL_LEN_DATA_AT_EXEC(nLen); @@ -254,7 +254,7 @@ void OTools::bindValue( OConnection* _pConnection, break; case SQL_LONGVARCHAR: { - _pData = (void*)(sal_IntPtr)(columnIndex); + _pData = reinterpret_cast<void*>(columnIndex); sal_Int32 nLen = 0; nLen = ((OUString*)_pValue)->getLength(); *pLen = (SQLLEN)SQL_LEN_DATA_AT_EXEC(nLen); diff --git a/connectivity/source/drivers/postgresql/pq_xcontainer.cxx b/connectivity/source/drivers/postgresql/pq_xcontainer.cxx index 2af77d5004a2..8e9ec4f4b79e 100644 --- a/connectivity/source/drivers/postgresql/pq_xcontainer.cxx +++ b/connectivity/source/drivers/postgresql/pq_xcontainer.cxx @@ -94,7 +94,7 @@ public: virtual void fire( XEventListener * listener ) const SAL_OVERRIDE { - ((XContainerListener*)listener)->elementReplaced( m_event ); + static_cast<XContainerListener*>(listener)->elementReplaced( m_event ); } virtual Type getType() const SAL_OVERRIDE { @@ -115,7 +115,7 @@ public: virtual void fire( XEventListener * listener ) const SAL_OVERRIDE { - ((XContainerListener*)listener)->elementInserted( m_event ); + static_cast<XContainerListener*>(listener)->elementInserted( m_event ); } virtual Type getType() const SAL_OVERRIDE @@ -136,7 +136,7 @@ public: virtual void fire( XEventListener * listener ) const SAL_OVERRIDE { - ((XContainerListener*)listener)->elementRemoved( m_event ); + static_cast<XContainerListener*>(listener)->elementRemoved( m_event ); } virtual Type getType() const SAL_OVERRIDE @@ -461,7 +461,7 @@ void Container::fire( const EventBroadcastHelper &helper ) { try { - helper.fire( (XEventListener * ) iterator.next() ); + helper.fire( static_cast<XEventListener *>(iterator.next()) ); } catch ( com::sun::star::uno::RuntimeException & ) { diff --git a/connectivity/source/drivers/postgresql/pq_xcontainer.hxx b/connectivity/source/drivers/postgresql/pq_xcontainer.hxx index 0800e09735ea..6a867e280ca4 100644 --- a/connectivity/source/drivers/postgresql/pq_xcontainer.hxx +++ b/connectivity/source/drivers/postgresql/pq_xcontainer.hxx @@ -76,7 +76,7 @@ public: virtual void fire( com::sun::star::lang::XEventListener * listener ) const SAL_OVERRIDE { - ((com::sun::star::util::XRefreshListener*)listener)->refreshed( m_event ); + static_cast<com::sun::star::util::XRefreshListener*>(listener)->refreshed( m_event ); } virtual com::sun::star::uno::Type getType() const SAL_OVERRIDE |