diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-01-24 09:08:34 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-02-11 13:25:31 +0100 |
commit | 0d1253c2328106a443d16b6c8e96347de33e2ace (patch) | |
tree | e26e7ca9f9b91f50573f446b8a93515f4c4302eb /connectivity | |
parent | 2dd7aba7564a222c2acbac22975a76a6ab33c41f (diff) |
new loplugin writeonlyvars
largely based on the relevant portion of the unusedfields loplugin, but
adapted for local vars
Change-Id: Ic522a941573940e8f75c88f90ba5f37508ca49b1
Reviewed-on: https://gerrit.libreoffice.org/66835
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'connectivity')
-rw-r--r-- | connectivity/source/drivers/dbase/DTable.cxx | 35 | ||||
-rw-r--r-- | connectivity/source/drivers/firebird/Connection.cxx | 5 | ||||
-rw-r--r-- | connectivity/source/drivers/firebird/Table.cxx | 3 | ||||
-rw-r--r-- | connectivity/source/drivers/mork/MorkParser.cxx | 3 |
4 files changed, 17 insertions, 29 deletions
diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx index 767f4d99ac99..e84494bb8f3d 100644 --- a/connectivity/source/drivers/dbase/DTable.cxx +++ b/connectivity/source/drivers/dbase/DTable.cxx @@ -2332,11 +2332,10 @@ void ODbaseTable::addColumn(const Reference< XPropertySet >& _xNewColumn) { OUString sTempName = createTempFile(); - ODbaseTable* pNewTable = new ODbaseTable(m_pTables,static_cast<ODbaseConnection*>(m_pConnection)); - Reference< XPropertySet > xHold = pNewTable; - pNewTable->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),makeAny(sTempName)); + rtl::Reference<ODbaseTable> xNewTable(new ODbaseTable(m_pTables,static_cast<ODbaseConnection*>(m_pConnection))); + xNewTable->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),makeAny(sTempName)); { - Reference<XAppend> xAppend(pNewTable->getColumns(),UNO_QUERY); + Reference<XAppend> xAppend(xNewTable->getColumns(),UNO_QUERY); bool bCase = getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers(); // copy the structure for(sal_Int32 i=0;i < m_xColumns->getCount();++i) @@ -2361,7 +2360,7 @@ void ODbaseTable::addColumn(const Reference< XPropertySet >& _xNewColumn) } // construct the new table - if(!pNewTable->CreateImpl()) + if(!xNewTable->CreateImpl()) { const OUString sError( getConnection()->getResources().getResourceStringWithSubstitution( STR_COLUMN_NOT_ADDABLE, @@ -2370,16 +2369,16 @@ void ODbaseTable::addColumn(const Reference< XPropertySet >& _xNewColumn) ::dbtools::throwGenericSQLException( sError, *this ); } - pNewTable->construct(); + xNewTable->construct(); // copy the data - copyData(pNewTable,pNewTable->m_xColumns->getCount()); + copyData(xNewTable.get(),xNewTable->m_xColumns->getCount()); // drop the old table if(DropImpl()) { - pNewTable->renameImpl(m_Name); + xNewTable->renameImpl(m_Name); // release the temp file } - xHold.clear(); + xNewTable.clear(); FileClose(); construct(); @@ -2391,11 +2390,10 @@ void ODbaseTable::dropColumn(sal_Int32 _nPos) { OUString sTempName = createTempFile(); - ODbaseTable* pNewTable = new ODbaseTable(m_pTables,static_cast<ODbaseConnection*>(m_pConnection)); - Reference< XPropertySet > xHold = pNewTable; - pNewTable->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),makeAny(sTempName)); + rtl::Reference<ODbaseTable> xNewTable(new ODbaseTable(m_pTables,static_cast<ODbaseConnection*>(m_pConnection))); + xNewTable->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),makeAny(sTempName)); { - Reference<XAppend> xAppend(pNewTable->getColumns(),UNO_QUERY); + Reference<XAppend> xAppend(xNewTable->getColumns(),UNO_QUERY); bool bCase = getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers(); // copy the structure for(sal_Int32 i=0;i < m_xColumns->getCount();++i) @@ -2419,24 +2417,23 @@ void ODbaseTable::dropColumn(sal_Int32 _nPos) } // construct the new table - if(!pNewTable->CreateImpl()) + if(!xNewTable->CreateImpl()) { - xHold.clear(); const OUString sError( getConnection()->getResources().getResourceStringWithSubstitution( STR_COLUMN_NOT_DROP, "$position$", OUString::number(_nPos) ) ); ::dbtools::throwGenericSQLException( sError, *this ); } - pNewTable->construct(); + xNewTable->construct(); // copy the data - copyData(pNewTable,_nPos); + copyData(xNewTable.get(),_nPos); // drop the old table if(DropImpl()) - pNewTable->renameImpl(m_Name); + xNewTable->renameImpl(m_Name); // release the temp file - xHold.clear(); + xNewTable.clear(); FileClose(); construct(); diff --git a/connectivity/source/drivers/firebird/Connection.cxx b/connectivity/source/drivers/firebird/Connection.cxx index 82e682c5a01d..877f83830b9b 100644 --- a/connectivity/source/drivers/firebird/Connection.cxx +++ b/connectivity/source/drivers/firebird/Connection.cxx @@ -135,7 +135,6 @@ void Connection::construct(const OUString& url, const Sequence< PropertyValue >& // the database may be stored as an // fdb file in older versions bool bIsFdbStored = false; - OUString aStorageURL; if (url == "sdbc:embedded:firebird") { m_bIsEmbedded = true; @@ -149,10 +148,6 @@ void Connection::construct(const OUString& url, const Sequence< PropertyValue >& { m_xEmbeddedStorage.set(pIter->Value,UNO_QUERY); } - else if ( pIter->Name == "URL" ) - { - pIter->Value >>= aStorageURL; - } else if ( pIter->Name == "Document" ) { pIter->Value >>= m_xParentDocument; diff --git a/connectivity/source/drivers/firebird/Table.cxx b/connectivity/source/drivers/firebird/Table.cxx index 0381128357da..13bb595d5692 100644 --- a/connectivity/source/drivers/firebird/Table.cxx +++ b/connectivity/source/drivers/firebird/Table.cxx @@ -195,8 +195,7 @@ void SAL_CALL Table::alterColumnByName(const OUString& rColName, if (bDefaultChanged) { - OUString sOldDefault, sNewDefault; - xColumn->getPropertyValue("DefaultValue") >>= sOldDefault; + OUString sNewDefault; rDescriptor->getPropertyValue("DefaultValue") >>= sNewDefault; OUString sSql; diff --git a/connectivity/source/drivers/mork/MorkParser.cxx b/connectivity/source/drivers/mork/MorkParser.cxx index 989455c37593..676488cb209d 100644 --- a/connectivity/source/drivers/mork/MorkParser.cxx +++ b/connectivity/source/drivers/mork/MorkParser.cxx @@ -100,13 +100,10 @@ bool MorkParser::parse() // Run over mork chars and parse each term char cur = nextChar(); - int i = 0; - while ( Result && cur ) { if ( !isWhiteSpace( cur ) ) { - i++; // Figure out what a term switch ( cur ) { |