use more concrete UNO types in some local vars

found by a little plugin I created.

Change-Id: If89a8fa349bb823c4e8dfa5cd9732950149d06cd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182162
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2025-02-25 13:11:24 +02:00
parent 9b07819fba
commit d1c1b9cfe6
13 changed files with 18 additions and 32 deletions

View File

@@ -312,11 +312,10 @@ namespace dbtools
OUString(),
OUString(),
OUString());
Reference<XPropertySet> xColumn = pColumn;
pColumn->setFunction(true);
pColumn->setRealName(sField);
std::unique_ptr<OSQLParseNode> pParseNode = implPredicateTree( sError, _rPredicateValue, xColumn );
std::unique_ptr<OSQLParseNode> pParseNode = implPredicateTree( sError, _rPredicateValue, pColumn );
if(pParseNode)
{
implParseNode(std::move(pParseNode), true) >>= sReturn;

View File

@@ -2170,7 +2170,6 @@ void ODbaseTable::alterColumn(sal_Int32 index,
OUString sTempName = createTempFile();
rtl::Reference<ODbaseTable> pNewTable = new ODbaseTable(m_pTables,static_cast<ODbaseConnection*>(m_pConnection));
Reference<XPropertySet> xHoldTable = pNewTable;
pNewTable->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),Any(sTempName));
Reference<XAppend> xAppend(pNewTable->getColumns(),UNO_QUERY);
OSL_ENSURE(xAppend.is(),"ODbaseTable::alterColumn: No XAppend interface!");
@@ -2239,8 +2238,8 @@ void ODbaseTable::alterColumn(sal_Int32 index,
::dbtools::throwGenericSQLException( sError, *this );
}
// release the temp file
::comphelper::disposeComponent(pNewTable);
pNewTable = nullptr;
::comphelper::disposeComponent(xHoldTable);
}
else
{

View File

@@ -1563,8 +1563,7 @@ bool OResultSet::isRowDeleted() const
void SAL_CALL OResultSet::disposing( const EventObject& Source )
{
Reference<XPropertySet> xProp = m_pTable;
if(m_pTable.is() && Source.Source == xProp)
if(m_pTable.is() && Source.Source == Reference<XPropertySet>(m_pTable))
{
m_pTable.clear();
}

View File

@@ -370,7 +370,7 @@ namespace connectivity
xComp->addEventListener(this);
// we want to close all connections when the office shuts down
static Reference< XTerminateListener> s_xTerminateListener = [&]()
static rtl::Reference< OConnectionController > s_xTerminateListener = [&]()
{
Reference< XDesktop2 > xDesktop = Desktop::create( m_xContext );

View File

@@ -436,11 +436,10 @@ Reference< XStatement > SAL_CALL java_sql_Connection::createStatement( )
SDBThreadAttach t;
rtl::Reference<java_sql_Statement> pStatement = new java_sql_Statement( t.pEnv, *this );
Reference< XStatement > xStmt = pStatement;
m_aStatements.emplace_back(xStmt);
m_aStatements.emplace_back(Reference< XStatement >(pStatement));
m_aLogger.log( LogLevel::FINE, STR_LOG_CREATED_STATEMENT_ID, pStatement->getStatementObjectID() );
return xStmt;
return pStatement;
}
Reference< XPreparedStatement > SAL_CALL java_sql_Connection::prepareStatement( const OUString& sql )
@@ -452,11 +451,10 @@ Reference< XPreparedStatement > SAL_CALL java_sql_Connection::prepareStatement(
SDBThreadAttach t;
rtl::Reference<java_sql_PreparedStatement> pStatement = new java_sql_PreparedStatement( t.pEnv, *this, sql );
Reference< XPreparedStatement > xReturn( pStatement );
m_aStatements.emplace_back(xReturn);
m_aStatements.emplace_back(Reference< XPreparedStatement >( pStatement ));
m_aLogger.log( LogLevel::FINE, STR_LOG_PREPARED_STATEMENT_ID, pStatement->getStatementObjectID() );
return xReturn;
return pStatement;
}
Reference< XPreparedStatement > SAL_CALL java_sql_Connection::prepareCall( const OUString& sql )
@@ -468,11 +466,10 @@ Reference< XPreparedStatement > SAL_CALL java_sql_Connection::prepareCall( const
SDBThreadAttach t;
rtl::Reference<java_sql_CallableStatement> pStatement = new java_sql_CallableStatement( t.pEnv, *this, sql );
Reference< XPreparedStatement > xStmt( pStatement );
m_aStatements.emplace_back(xStmt);
m_aStatements.emplace_back(Reference< XPreparedStatement >( pStatement ));
m_aLogger.log( LogLevel::FINE, STR_LOG_PREPARED_CALL_ID, pStatement->getStatementObjectID() );
return xStmt;
return pStatement;
}
OUString SAL_CALL java_sql_Connection::nativeSQL( const OUString& sql )

View File

@@ -303,7 +303,6 @@ void Columns::refresh()
{
rtl::Reference<Column> pColumn =
new Column( m_xMutex, m_origin, m_pSettings );
Reference< css::beans::XPropertySet > prop = pColumn;
OUString name = columnMetaData2SDBCX( pColumn.get(), xRow );
// pColumn->addPropertyChangeListener(
@@ -317,7 +316,7 @@ void Columns::refresh()
// name ) );
{
m_values.emplace_back(prop);
m_values.emplace_back(Reference< css::beans::XPropertySet >(pColumn));
map[ name ] = columnIndex;
++columnIndex;
}

View File

@@ -127,13 +127,12 @@ void IndexColumns::refresh()
rtl::Reference<IndexColumn> pIndexColumn =
new IndexColumn( m_xMutex, m_origin, m_pSettings );
Reference< css::beans::XPropertySet > prop = pIndexColumn;
columnMetaData2SDBCX( pIndexColumn.get(), xRow );
pIndexColumn->setPropertyValue_NoBroadcast_public(
st.IS_ASCENDING , Any( false ) );
m_values[ index ] <<= prop;
m_values[ index ] <<= Reference< css::beans::XPropertySet >(pIndexColumn);
m_name2index[ columnName ] = index;
}
}

View File

@@ -142,7 +142,6 @@ void Indexes::refresh()
bool isUnique = row->getBoolean( C_IS_UNIQUE );
bool isPrimary = row->getBoolean( C_IS_PRIMARY );
bool isClusterd = row->getBoolean( C_IS_CLUSTERED );
Reference< css::beans::XPropertySet > prop = pIndex;
pIndex->setPropertyValue_NoBroadcast_public(
st.IS_UNIQUE, Any( isUnique ) );
pIndex->setPropertyValue_NoBroadcast_public(
@@ -164,7 +163,7 @@ void Indexes::refresh()
st.PRIVATE_COLUMN_INDEXES, Any( columnNames ));
{
m_values.emplace_back(prop);
m_values.emplace_back(Reference< css::beans::XPropertySet >(pIndex));
map[ currentIndexName ] = index;
++index;
}

View File

@@ -120,7 +120,6 @@ void KeyColumns::refresh()
rtl::Reference<KeyColumn> pKeyColumn =
new KeyColumn( m_xMutex, m_origin, m_pSettings );
Reference< css::beans::XPropertySet > prop = pKeyColumn;
OUString name = columnMetaData2SDBCX( pKeyColumn.get(), xRow );
if( keyindex < m_foreignColumnNames.getLength() )
@@ -130,7 +129,7 @@ void KeyColumns::refresh()
}
{
m_values.emplace_back(prop);
m_values.emplace_back(Reference< css::beans::XPropertySet >(pKeyColumn));
map[ name ] = columnIndex;
++columnIndex;
}

View File

@@ -155,7 +155,6 @@ void Keys::refresh()
{
rtl::Reference<Key> pKey =
new Key( m_xMutex, m_origin, m_pSettings , m_schemaName, m_tableName );
Reference< css::beans::XPropertySet > prop = pKey;
pKey->setPropertyValue_NoBroadcast_public(
st.NAME, Any( xRow->getString( 1 ) ) );
@@ -191,7 +190,7 @@ void Keys::refresh()
{
map[ xRow->getString( 1 ) ] = keyIndex;
m_values.push_back( Any( prop ) );
m_values.push_back( Any( Reference< css::beans::XPropertySet >(pKey) ) );
++keyIndex;
}
}

View File

@@ -106,7 +106,6 @@ void Tables::refresh()
// instead offer a factory interface
rtl::Reference<Table> pTable =
new Table( m_xMutex, m_origin, m_pSettings );
Reference< css::beans::XPropertySet > prop = pTable;
OUString name = xRow->getString( TABLE_INDEX_NAME+1);
OUString schema = xRow->getString( TABLE_INDEX_SCHEMA+1);
@@ -131,7 +130,7 @@ void Tables::refresh()
css::sdbcx::Privilege::DROP ) ) );
{
m_values.push_back( Any( prop ) );
m_values.push_back( Any( Reference< css::beans::XPropertySet >(pTable) ) );
map[ schema + "." + name ] = tableIndex;
++tableIndex;
}

View File

@@ -95,14 +95,13 @@ void Users::refresh()
{
rtl::Reference<User> pUser =
new User( m_xMutex, m_origin, m_pSettings );
Reference< css::beans::XPropertySet > prop = pUser;
OUString name = xRow->getString( 1);
pUser->setPropertyValue_NoBroadcast_public(
st.NAME , Any(xRow->getString( TABLE_INDEX_CATALOG+1) ) );
{
m_values.push_back( Any( prop ) );
m_values.push_back( Any( Reference< css::beans::XPropertySet >(pUser) ) );
map[ name ] = tableIndex;
++tableIndex;
}

View File

@@ -109,14 +109,13 @@ void Views::refresh()
command = xRow->getString( 3 );
rtl::Reference<View> pView = new View (m_xMutex, m_origin, m_pSettings );
Reference< css::beans::XPropertySet > prop = pView;
pView->setPropertyValue_NoBroadcast_public(st.NAME , Any(table) );
pView->setPropertyValue_NoBroadcast_public(st.SCHEMA_NAME, Any(schema) );
pView->setPropertyValue_NoBroadcast_public(st.COMMAND, Any(command) );
{
m_values.push_back( Any( prop ) );
m_values.push_back( Any( Reference< css::beans::XPropertySet >(pView) ) );
map[ schema + "." + table ] = viewIndex;
++viewIndex;
}