diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-01 16:13:12 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-01 21:40:49 +0200 |
commit | 4a779c4d01b0482457e189af991b3b1b7c1a47a9 (patch) | |
tree | d55d15b81d0c36c3f49e4ac24cfcebc2f1d41a05 /connectivity/source | |
parent | loplugin:stringloop in sc (diff) | |
download | core-4a779c4d01b0482457e189af991b3b1b7c1a47a9.tar.gz core-4a779c4d01b0482457e189af991b3b1b7c1a47a9.zip |
loplugin:returnconstant in connectivity
Change-Id: I291bebbd644095d6632841abe56c4f28b84e228d
Reviewed-on: https://gerrit.libreoffice.org/58427
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'connectivity/source')
-rw-r--r-- | connectivity/source/drivers/dbase/DIndex.cxx | 9 | ||||
-rw-r--r-- | connectivity/source/drivers/dbase/DIndexes.cxx | 3 | ||||
-rw-r--r-- | connectivity/source/drivers/dbase/DTable.cxx | 9 | ||||
-rw-r--r-- | connectivity/source/drivers/dbase/dindexnode.cxx | 3 | ||||
-rw-r--r-- | connectivity/source/drivers/mork/MDatabaseMetaData.cxx | 26 | ||||
-rw-r--r-- | connectivity/source/drivers/mork/MDatabaseMetaDataHelper.cxx | 10 | ||||
-rw-r--r-- | connectivity/source/drivers/mork/MDatabaseMetaDataHelper.hxx | 4 | ||||
-rw-r--r-- | connectivity/source/drivers/mork/MorkParser.cxx | 14 | ||||
-rw-r--r-- | connectivity/source/drivers/mork/MorkParser.hxx | 4 | ||||
-rw-r--r-- | connectivity/source/inc/dbase/DIndex.hxx | 4 | ||||
-rw-r--r-- | connectivity/source/inc/dbase/DTable.hxx | 4 | ||||
-rw-r--r-- | connectivity/source/inc/dbase/dindexnode.hxx | 2 |
12 files changed, 32 insertions, 60 deletions
diff --git a/connectivity/source/drivers/dbase/DIndex.cxx b/connectivity/source/drivers/dbase/DIndex.cxx index 95c076357ad4..84047f811244 100644 --- a/connectivity/source/drivers/dbase/DIndex.cxx +++ b/connectivity/source/drivers/dbase/DIndex.cxx @@ -260,7 +260,8 @@ bool ODbaseIndex::Delete(sal_uInt32 nRec, const ORowSetValue& rValue) m_aRoot->PrintPage(); #endif - return m_aCurLeaf->Delete(m_nCurNode); + m_aCurLeaf->Delete(m_nCurNode); + return true; } void ODbaseIndex::Collect(ONDXPage* pPage) @@ -423,7 +424,7 @@ void ODbaseIndex::createINFEntry() aInfFile.WriteKey(aNewEntry, OUStringToOString(sEntry, m_pTable->getConnection()->getTextEncoding())); } -bool ODbaseIndex::DropImpl() +void ODbaseIndex::DropImpl() { closeImpl(); @@ -463,7 +464,6 @@ bool ODbaseIndex::DropImpl() } } } - return true; } void ODbaseIndex::impl_killFileAndthrowError_throw(const char* pErrorId, const OUString& _sFile) @@ -474,7 +474,7 @@ void ODbaseIndex::impl_killFileAndthrowError_throw(const char* pErrorId, const O m_pTable->getConnection()->throwGenericSQLException(pErrorId, *this); } -bool ODbaseIndex::CreateImpl() +void ODbaseIndex::CreateImpl() { // Create the Index const OUString sFile = getCompletePath(); @@ -610,7 +610,6 @@ bool ODbaseIndex::CreateImpl() } Release(); createINFEntry(); - return true; } diff --git a/connectivity/source/drivers/dbase/DIndexes.cxx b/connectivity/source/drivers/dbase/DIndexes.cxx index 541eb3287634..416e05eaa576 100644 --- a/connectivity/source/drivers/dbase/DIndexes.cxx +++ b/connectivity/source/drivers/dbase/DIndexes.cxx @@ -95,8 +95,9 @@ sdbcx::ObjectType ODbaseIndexes::appendObject( const OUString& _rForName, const if(xTunnel.is()) { ODbaseIndex* pIndex = reinterpret_cast< ODbaseIndex* >( xTunnel->getSomething(ODbaseIndex::getUnoTunnelImplementationId()) ); - if(!pIndex || !pIndex->CreateImpl()) + if(!pIndex) throw SQLException(); + pIndex->CreateImpl(); } return createObject( _rForName ); diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx index ee39a607ba83..b4c8a7c5fd5c 100644 --- a/connectivity/source/drivers/dbase/DTable.cxx +++ b/connectivity/source/drivers/dbase/DTable.cxx @@ -544,7 +544,7 @@ void ODbaseTable::construct() } } -bool ODbaseTable::ReadMemoHeader() +void ODbaseTable::ReadMemoHeader() { m_pMemoStream->SetEndian(SvStreamEndian::LITTLE); m_pMemoStream->RefreshBuffer(); // make sure that the header information is actually read again @@ -590,7 +590,6 @@ bool ODbaseTable::ReadMemoHeader() SAL_WARN( "connectivity.drivers", "ODbaseTable::ReadMemoHeader: unsupported memo type!" ); break; } - return true; } OUString ODbaseTable::getEntry(OConnection const * _pConnection,const OUString& _sName ) @@ -1916,8 +1915,9 @@ bool ODbaseTable::UpdateBuffer(OValueRefVector& rRow, const OValueRefRow& pOrgRo // Next initial character restore again: pData[nLen] = cNext; - if (!m_pMemoStream || !WriteMemo(thisColVal, nBlockNo)) + if (!m_pMemoStream) break; + WriteMemo(thisColVal, nBlockNo); OString aBlock(OString::number(nBlockNo)); //align aBlock at the right of a nLen sequence, fill to the left with '0' @@ -1969,7 +1969,7 @@ bool ODbaseTable::UpdateBuffer(OValueRefVector& rRow, const OValueRefRow& pOrgRo } -bool ODbaseTable::WriteMemo(const ORowSetValue& aVariable, std::size_t& rBlockNr) +void ODbaseTable::WriteMemo(const ORowSetValue& aVariable, std::size_t& rBlockNr) { // if the BlockNo 0 is given, the block will be appended at the end std::size_t nSize = 0; @@ -2099,7 +2099,6 @@ bool ODbaseTable::WriteMemo(const ORowSetValue& aVariable, std::size_t& rBlockNr (*m_pMemoStream).WriteUInt32( m_aMemoHeader.db_next ); m_pMemoStream->Flush(); } - return true; } diff --git a/connectivity/source/drivers/dbase/dindexnode.cxx b/connectivity/source/drivers/dbase/dindexnode.cxx index 3a19f34f6316..0db31184a876 100644 --- a/connectivity/source/drivers/dbase/dindexnode.cxx +++ b/connectivity/source/drivers/dbase/dindexnode.cxx @@ -375,7 +375,7 @@ void ONDXPage::ReleaseFull() } } -bool ONDXPage::Delete(sal_uInt16 nNodePos) +void ONDXPage::Delete(sal_uInt16 nNodePos) { if (IsLeaf()) { @@ -421,7 +421,6 @@ bool ONDXPage::Delete(sal_uInt16 nNodePos) else if (IsRoot()) // make sure that the position of the root is kept rIndex.SetRootPos(nPagePos); - return true; } diff --git a/connectivity/source/drivers/mork/MDatabaseMetaData.cxx b/connectivity/source/drivers/mork/MDatabaseMetaData.cxx index 3e04925cf509..50b9347d642f 100644 --- a/connectivity/source/drivers/mork/MDatabaseMetaData.cxx +++ b/connectivity/source/drivers/mork/MDatabaseMetaData.cxx @@ -64,14 +64,7 @@ ODatabaseMetaDataResultSet::ORows& ODatabaseMetaData::getColumnRows( ::osl::MutexGuard aGuard( m_aMutex ); std::vector< OUString > tables; - if (!connectivity::mork::MDatabaseMetaDataHelper::getTableStrings(m_pConnection, tables)) - { - ::connectivity::SharedResources aResources; - // TODO: - // get better message here? - const OUString sMessage = aResources.getResourceString(STR_UNKNOWN_COLUMN_TYPE); - ::dbtools::throwGenericSQLException(sMessage ,*this); - } + connectivity::mork::MDatabaseMetaDataHelper::getTableStrings(m_pConnection, tables); // **************************************************** // Some entries in a row never change, so set them now @@ -907,13 +900,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables( // aRows = m_pDbMetaDataHelper->getTables( m_pConnection, tableNamePattern ); // pResultSet->setRows( aRows ); ODatabaseMetaDataResultSet::ORows _rRows; - if ( !connectivity::mork::MDatabaseMetaDataHelper::getTables( m_pConnection, tableNamePattern, _rRows ) ) { - ::connectivity::SharedResources aResources; - // TODO: - // get better message here? - const OUString sMessage = aResources.getResourceString(STR_UNKNOWN_COLUMN_TYPE); - ::dbtools::throwGenericSQLException(sMessage ,*this); - } + connectivity::mork::MDatabaseMetaDataHelper::getTables( m_pConnection, tableNamePattern, _rRows ); pResultSet->setRows( _rRows ); return xResultSet; @@ -927,14 +914,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges( Reference< XResultSet > xRef = pResult; std::vector< OUString > tables; - if ( !connectivity::mork::MDatabaseMetaDataHelper::getTableStrings( m_pConnection, tables) ) - { - ::connectivity::SharedResources aResources; - // TODO: - // get better message here? - const OUString sMessage = aResources.getResourceString(STR_UNKNOWN_COLUMN_TYPE); - ::dbtools::throwGenericSQLException(sMessage ,*this); - } + connectivity::mork::MDatabaseMetaDataHelper::getTableStrings( m_pConnection, tables); ::connectivity::ODatabaseMetaDataResultSet::ORows aRows; ::connectivity::ODatabaseMetaDataResultSet::ORow aRow(8); diff --git a/connectivity/source/drivers/mork/MDatabaseMetaDataHelper.cxx b/connectivity/source/drivers/mork/MDatabaseMetaDataHelper.cxx index 41d3670a8077..c8d2c15abe2c 100644 --- a/connectivity/source/drivers/mork/MDatabaseMetaDataHelper.cxx +++ b/connectivity/source/drivers/mork/MDatabaseMetaDataHelper.cxx @@ -40,7 +40,7 @@ MDatabaseMetaDataHelper::~MDatabaseMetaDataHelper() { } -bool MDatabaseMetaDataHelper::getTableStrings( OConnection* _pCon, +void MDatabaseMetaDataHelper::getTableStrings( OConnection* _pCon, std::vector< OUString >& _rStrings) { SAL_INFO("connectivity.mork", "=> MDatabaseMetaDataHelper::getTableStrings()"); @@ -75,11 +75,9 @@ bool MDatabaseMetaDataHelper::getTableStrings( OConnection* _pCon, // remember the list in the mork parser, we'll use it later pMork->lists_.push_back(groupTableName); } - - return true; } -bool MDatabaseMetaDataHelper::getTables( OConnection* _pCon, +void MDatabaseMetaDataHelper::getTables( OConnection* _pCon, const OUString& tableNamePattern, ODatabaseMetaDataResultSet::ORows& _rRows) { @@ -97,8 +95,7 @@ bool MDatabaseMetaDataHelper::getTables( OConnection* _pCon, std::vector< OUString > tables; - if ( !getTableStrings( _pCon, tables ) ) - return false; + getTableStrings( _pCon, tables ); for (OUString& aTableName : tables) { ODatabaseMetaDataResultSet::ORow aRow { nullptr, nullptr, nullptr }; @@ -130,7 +127,6 @@ bool MDatabaseMetaDataHelper::getTables( OConnection* _pCon, } _rRows = aRows; - return true; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/mork/MDatabaseMetaDataHelper.hxx b/connectivity/source/drivers/mork/MDatabaseMetaDataHelper.hxx index 21eabd597eb1..7e892949ec25 100644 --- a/connectivity/source/drivers/mork/MDatabaseMetaDataHelper.hxx +++ b/connectivity/source/drivers/mork/MDatabaseMetaDataHelper.hxx @@ -23,10 +23,10 @@ namespace connectivity ~MDatabaseMetaDataHelper(); - static bool getTableStrings( OConnection* _pCon, + static void getTableStrings( OConnection* _pCon, std::vector< OUString >& _rStrings); - static bool getTables( OConnection* _pCon, + static void getTables( OConnection* _pCon, const OUString& tableNamePattern, ODatabaseMetaDataResultSet::ORows& _rRows); }; diff --git a/connectivity/source/drivers/mork/MorkParser.cxx b/connectivity/source/drivers/mork/MorkParser.cxx index 143e3d6ca3e2..0b31c3e0e4cc 100644 --- a/connectivity/source/drivers/mork/MorkParser.cxx +++ b/connectivity/source/drivers/mork/MorkParser.cxx @@ -127,7 +127,7 @@ bool MorkParser::parse() // Row break; case '@': - Result = parseGroup(); + parseGroup(); // Group break; default: @@ -389,7 +389,7 @@ bool MorkParser::parseTable() switch ( cur ) { case '{': - Result = parseMeta( '}' ); + parseMeta( '}' ); break; case '[': Result = parseRow( Id, Scope ); @@ -514,7 +514,7 @@ bool MorkParser::parseRow( int TableId, int TableScope ) Result = parseCell(); break; case '[': - Result = parseMeta( ']' ); + parseMeta( ']' ); break; default: Result = false; @@ -528,12 +528,12 @@ bool MorkParser::parseRow( int TableId, int TableScope ) return Result; } -bool MorkParser::parseGroup() +void MorkParser::parseGroup() { - return parseMeta( '@' ); + parseMeta( '@' ); } -bool MorkParser::parseMeta( char c ) +void MorkParser::parseMeta( char c ) { char cur = nextChar(); @@ -541,8 +541,6 @@ bool MorkParser::parseMeta( char c ) { cur = nextChar(); } - - return true; } MorkTableMap *MorkParser::getTables( int TableScope ) diff --git a/connectivity/source/drivers/mork/MorkParser.hxx b/connectivity/source/drivers/mork/MorkParser.hxx index 8cc4a555ea68..392f4f01bbd6 100644 --- a/connectivity/source/drivers/mork/MorkParser.hxx +++ b/connectivity/source/drivers/mork/MorkParser.hxx @@ -115,9 +115,9 @@ private: // Members bool parseComment(); bool parseCell(); bool parseTable(); - bool parseMeta( char c ); + void parseMeta( char c ); bool parseRow( int TableId, int TableScope ); - bool parseGroup(); + void parseGroup(); private: // Data diff --git a/connectivity/source/inc/dbase/DIndex.hxx b/connectivity/source/inc/dbase/DIndex.hxx index bcb273aec506..337e7780c185 100644 --- a/connectivity/source/inc/dbase/DIndex.hxx +++ b/connectivity/source/inc/dbase/DIndex.hxx @@ -116,8 +116,8 @@ namespace connectivity bool Find(sal_uInt32 nRec, const ORowSetValue& rValue); void createINFEntry(); - bool CreateImpl(); - bool DropImpl(); + void CreateImpl(); + void DropImpl(); DECLARE_SERVICE_INFO(); protected: diff --git a/connectivity/source/inc/dbase/DTable.hxx b/connectivity/source/inc/dbase/DTable.hxx index 1a1e45c64e99..5a509bb59542 100644 --- a/connectivity/source/inc/dbase/DTable.hxx +++ b/connectivity/source/inc/dbase/DTable.hxx @@ -120,10 +120,10 @@ namespace connectivity bool CreateFile(const INetURLObject& aFile, bool& bCreateMemo); bool CreateMemoFile(const INetURLObject& aFile); bool HasMemoFields() const { return m_aHeader.type > dBaseIV;} - bool ReadMemoHeader(); + void ReadMemoHeader(); bool ReadMemo(std::size_t nBlockNo, ORowSetValue& aVariable); - bool WriteMemo(const ORowSetValue& aVariable, std::size_t& rBlockNr); + void WriteMemo(const ORowSetValue& aVariable, std::size_t& rBlockNr); bool WriteBuffer(); bool UpdateBuffer(OValueRefVector& rRow, const OValueRefRow& pOrgRow, const css::uno::Reference< css::container::XIndexAccess>& _xCols, bool bForceAllFields); css::uno::Reference< css::beans::XPropertySet> isUniqueByColumnName(sal_Int32 _nColumnPos); diff --git a/connectivity/source/inc/dbase/dindexnode.hxx b/connectivity/source/inc/dbase/dindexnode.hxx index eb1ce0b9ea51..ec5896058aa5 100644 --- a/connectivity/source/inc/dbase/dindexnode.hxx +++ b/connectivity/source/inc/dbase/dindexnode.hxx @@ -140,7 +140,7 @@ namespace connectivity bool Insert(ONDXNode& rNode, sal_uInt32 nRowsLeft = 0); bool Insert(sal_uInt16 nIndex, ONDXNode& rNode); bool Append(ONDXNode& rNode); - bool Delete(sal_uInt16); + void Delete(sal_uInt16); void Remove(sal_uInt16); void Release(bool bSave = true); void ReleaseFull(); |