Kaydet (Commit) 4a779c4d authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:returnconstant in connectivity

Change-Id: I291bebbd644095d6632841abe56c4f28b84e228d
Reviewed-on: https://gerrit.libreoffice.org/58427
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 52f69445
...@@ -260,7 +260,8 @@ bool ODbaseIndex::Delete(sal_uInt32 nRec, const ORowSetValue& rValue) ...@@ -260,7 +260,8 @@ bool ODbaseIndex::Delete(sal_uInt32 nRec, const ORowSetValue& rValue)
m_aRoot->PrintPage(); m_aRoot->PrintPage();
#endif #endif
return m_aCurLeaf->Delete(m_nCurNode); m_aCurLeaf->Delete(m_nCurNode);
return true;
} }
void ODbaseIndex::Collect(ONDXPage* pPage) void ODbaseIndex::Collect(ONDXPage* pPage)
...@@ -423,7 +424,7 @@ void ODbaseIndex::createINFEntry() ...@@ -423,7 +424,7 @@ void ODbaseIndex::createINFEntry()
aInfFile.WriteKey(aNewEntry, OUStringToOString(sEntry, m_pTable->getConnection()->getTextEncoding())); aInfFile.WriteKey(aNewEntry, OUStringToOString(sEntry, m_pTable->getConnection()->getTextEncoding()));
} }
bool ODbaseIndex::DropImpl() void ODbaseIndex::DropImpl()
{ {
closeImpl(); closeImpl();
...@@ -463,7 +464,6 @@ bool ODbaseIndex::DropImpl() ...@@ -463,7 +464,6 @@ bool ODbaseIndex::DropImpl()
} }
} }
} }
return true;
} }
void ODbaseIndex::impl_killFileAndthrowError_throw(const char* pErrorId, const OUString& _sFile) 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 ...@@ -474,7 +474,7 @@ void ODbaseIndex::impl_killFileAndthrowError_throw(const char* pErrorId, const O
m_pTable->getConnection()->throwGenericSQLException(pErrorId, *this); m_pTable->getConnection()->throwGenericSQLException(pErrorId, *this);
} }
bool ODbaseIndex::CreateImpl() void ODbaseIndex::CreateImpl()
{ {
// Create the Index // Create the Index
const OUString sFile = getCompletePath(); const OUString sFile = getCompletePath();
...@@ -610,7 +610,6 @@ bool ODbaseIndex::CreateImpl() ...@@ -610,7 +610,6 @@ bool ODbaseIndex::CreateImpl()
} }
Release(); Release();
createINFEntry(); createINFEntry();
return true;
} }
......
...@@ -95,8 +95,9 @@ sdbcx::ObjectType ODbaseIndexes::appendObject( const OUString& _rForName, const ...@@ -95,8 +95,9 @@ sdbcx::ObjectType ODbaseIndexes::appendObject( const OUString& _rForName, const
if(xTunnel.is()) if(xTunnel.is())
{ {
ODbaseIndex* pIndex = reinterpret_cast< ODbaseIndex* >( xTunnel->getSomething(ODbaseIndex::getUnoTunnelImplementationId()) ); ODbaseIndex* pIndex = reinterpret_cast< ODbaseIndex* >( xTunnel->getSomething(ODbaseIndex::getUnoTunnelImplementationId()) );
if(!pIndex || !pIndex->CreateImpl()) if(!pIndex)
throw SQLException(); throw SQLException();
pIndex->CreateImpl();
} }
return createObject( _rForName ); return createObject( _rForName );
......
...@@ -544,7 +544,7 @@ void ODbaseTable::construct() ...@@ -544,7 +544,7 @@ void ODbaseTable::construct()
} }
} }
bool ODbaseTable::ReadMemoHeader() void ODbaseTable::ReadMemoHeader()
{ {
m_pMemoStream->SetEndian(SvStreamEndian::LITTLE); m_pMemoStream->SetEndian(SvStreamEndian::LITTLE);
m_pMemoStream->RefreshBuffer(); // make sure that the header information is actually read again m_pMemoStream->RefreshBuffer(); // make sure that the header information is actually read again
...@@ -590,7 +590,6 @@ bool ODbaseTable::ReadMemoHeader() ...@@ -590,7 +590,6 @@ bool ODbaseTable::ReadMemoHeader()
SAL_WARN( "connectivity.drivers", "ODbaseTable::ReadMemoHeader: unsupported memo type!" ); SAL_WARN( "connectivity.drivers", "ODbaseTable::ReadMemoHeader: unsupported memo type!" );
break; break;
} }
return true;
} }
OUString ODbaseTable::getEntry(OConnection const * _pConnection,const OUString& _sName ) OUString ODbaseTable::getEntry(OConnection const * _pConnection,const OUString& _sName )
...@@ -1916,8 +1915,9 @@ bool ODbaseTable::UpdateBuffer(OValueRefVector& rRow, const OValueRefRow& pOrgRo ...@@ -1916,8 +1915,9 @@ bool ODbaseTable::UpdateBuffer(OValueRefVector& rRow, const OValueRefRow& pOrgRo
// Next initial character restore again: // Next initial character restore again:
pData[nLen] = cNext; pData[nLen] = cNext;
if (!m_pMemoStream || !WriteMemo(thisColVal, nBlockNo)) if (!m_pMemoStream)
break; break;
WriteMemo(thisColVal, nBlockNo);
OString aBlock(OString::number(nBlockNo)); OString aBlock(OString::number(nBlockNo));
//align aBlock at the right of a nLen sequence, fill to the left with '0' //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 ...@@ -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 // if the BlockNo 0 is given, the block will be appended at the end
std::size_t nSize = 0; std::size_t nSize = 0;
...@@ -2099,7 +2099,6 @@ bool ODbaseTable::WriteMemo(const ORowSetValue& aVariable, std::size_t& rBlockNr ...@@ -2099,7 +2099,6 @@ bool ODbaseTable::WriteMemo(const ORowSetValue& aVariable, std::size_t& rBlockNr
(*m_pMemoStream).WriteUInt32( m_aMemoHeader.db_next ); (*m_pMemoStream).WriteUInt32( m_aMemoHeader.db_next );
m_pMemoStream->Flush(); m_pMemoStream->Flush();
} }
return true;
} }
......
...@@ -375,7 +375,7 @@ void ONDXPage::ReleaseFull() ...@@ -375,7 +375,7 @@ void ONDXPage::ReleaseFull()
} }
} }
bool ONDXPage::Delete(sal_uInt16 nNodePos) void ONDXPage::Delete(sal_uInt16 nNodePos)
{ {
if (IsLeaf()) if (IsLeaf())
{ {
...@@ -421,7 +421,6 @@ bool ONDXPage::Delete(sal_uInt16 nNodePos) ...@@ -421,7 +421,6 @@ bool ONDXPage::Delete(sal_uInt16 nNodePos)
else if (IsRoot()) else if (IsRoot())
// make sure that the position of the root is kept // make sure that the position of the root is kept
rIndex.SetRootPos(nPagePos); rIndex.SetRootPos(nPagePos);
return true;
} }
......
...@@ -64,14 +64,7 @@ ODatabaseMetaDataResultSet::ORows& ODatabaseMetaData::getColumnRows( ...@@ -64,14 +64,7 @@ ODatabaseMetaDataResultSet::ORows& ODatabaseMetaData::getColumnRows(
::osl::MutexGuard aGuard( m_aMutex ); ::osl::MutexGuard aGuard( m_aMutex );
std::vector< OUString > tables; std::vector< OUString > tables;
if (!connectivity::mork::MDatabaseMetaDataHelper::getTableStrings(m_pConnection, tables)) 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);
}
// **************************************************** // ****************************************************
// Some entries in a row never change, so set them now // Some entries in a row never change, so set them now
...@@ -907,13 +900,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables( ...@@ -907,13 +900,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables(
// aRows = m_pDbMetaDataHelper->getTables( m_pConnection, tableNamePattern ); // aRows = m_pDbMetaDataHelper->getTables( m_pConnection, tableNamePattern );
// pResultSet->setRows( aRows ); // pResultSet->setRows( aRows );
ODatabaseMetaDataResultSet::ORows _rRows; ODatabaseMetaDataResultSet::ORows _rRows;
if ( !connectivity::mork::MDatabaseMetaDataHelper::getTables( m_pConnection, tableNamePattern, _rRows ) ) { 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);
}
pResultSet->setRows( _rRows ); pResultSet->setRows( _rRows );
return xResultSet; return xResultSet;
...@@ -927,14 +914,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges( ...@@ -927,14 +914,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges(
Reference< XResultSet > xRef = pResult; Reference< XResultSet > xRef = pResult;
std::vector< OUString > tables; std::vector< OUString > tables;
if ( !connectivity::mork::MDatabaseMetaDataHelper::getTableStrings( m_pConnection, tables) ) 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::ODatabaseMetaDataResultSet::ORows aRows; ::connectivity::ODatabaseMetaDataResultSet::ORows aRows;
::connectivity::ODatabaseMetaDataResultSet::ORow aRow(8); ::connectivity::ODatabaseMetaDataResultSet::ORow aRow(8);
......
...@@ -40,7 +40,7 @@ MDatabaseMetaDataHelper::~MDatabaseMetaDataHelper() ...@@ -40,7 +40,7 @@ MDatabaseMetaDataHelper::~MDatabaseMetaDataHelper()
{ {
} }
bool MDatabaseMetaDataHelper::getTableStrings( OConnection* _pCon, void MDatabaseMetaDataHelper::getTableStrings( OConnection* _pCon,
std::vector< OUString >& _rStrings) std::vector< OUString >& _rStrings)
{ {
SAL_INFO("connectivity.mork", "=> MDatabaseMetaDataHelper::getTableStrings()"); SAL_INFO("connectivity.mork", "=> MDatabaseMetaDataHelper::getTableStrings()");
...@@ -75,11 +75,9 @@ bool MDatabaseMetaDataHelper::getTableStrings( OConnection* _pCon, ...@@ -75,11 +75,9 @@ bool MDatabaseMetaDataHelper::getTableStrings( OConnection* _pCon,
// remember the list in the mork parser, we'll use it later // remember the list in the mork parser, we'll use it later
pMork->lists_.push_back(groupTableName); pMork->lists_.push_back(groupTableName);
} }
return true;
} }
bool MDatabaseMetaDataHelper::getTables( OConnection* _pCon, void MDatabaseMetaDataHelper::getTables( OConnection* _pCon,
const OUString& tableNamePattern, const OUString& tableNamePattern,
ODatabaseMetaDataResultSet::ORows& _rRows) ODatabaseMetaDataResultSet::ORows& _rRows)
{ {
...@@ -97,8 +95,7 @@ bool MDatabaseMetaDataHelper::getTables( OConnection* _pCon, ...@@ -97,8 +95,7 @@ bool MDatabaseMetaDataHelper::getTables( OConnection* _pCon,
std::vector< OUString > tables; std::vector< OUString > tables;
if ( !getTableStrings( _pCon, tables ) ) getTableStrings( _pCon, tables );
return false;
for (OUString& aTableName : tables) { for (OUString& aTableName : tables) {
ODatabaseMetaDataResultSet::ORow aRow { nullptr, nullptr, nullptr }; ODatabaseMetaDataResultSet::ORow aRow { nullptr, nullptr, nullptr };
...@@ -130,7 +127,6 @@ bool MDatabaseMetaDataHelper::getTables( OConnection* _pCon, ...@@ -130,7 +127,6 @@ bool MDatabaseMetaDataHelper::getTables( OConnection* _pCon,
} }
_rRows = aRows; _rRows = aRows;
return true;
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -23,10 +23,10 @@ namespace connectivity ...@@ -23,10 +23,10 @@ namespace connectivity
~MDatabaseMetaDataHelper(); ~MDatabaseMetaDataHelper();
static bool getTableStrings( OConnection* _pCon, static void getTableStrings( OConnection* _pCon,
std::vector< OUString >& _rStrings); std::vector< OUString >& _rStrings);
static bool getTables( OConnection* _pCon, static void getTables( OConnection* _pCon,
const OUString& tableNamePattern, const OUString& tableNamePattern,
ODatabaseMetaDataResultSet::ORows& _rRows); ODatabaseMetaDataResultSet::ORows& _rRows);
}; };
......
...@@ -127,7 +127,7 @@ bool MorkParser::parse() ...@@ -127,7 +127,7 @@ bool MorkParser::parse()
// Row // Row
break; break;
case '@': case '@':
Result = parseGroup(); parseGroup();
// Group // Group
break; break;
default: default:
...@@ -389,7 +389,7 @@ bool MorkParser::parseTable() ...@@ -389,7 +389,7 @@ bool MorkParser::parseTable()
switch ( cur ) switch ( cur )
{ {
case '{': case '{':
Result = parseMeta( '}' ); parseMeta( '}' );
break; break;
case '[': case '[':
Result = parseRow( Id, Scope ); Result = parseRow( Id, Scope );
...@@ -514,7 +514,7 @@ bool MorkParser::parseRow( int TableId, int TableScope ) ...@@ -514,7 +514,7 @@ bool MorkParser::parseRow( int TableId, int TableScope )
Result = parseCell(); Result = parseCell();
break; break;
case '[': case '[':
Result = parseMeta( ']' ); parseMeta( ']' );
break; break;
default: default:
Result = false; Result = false;
...@@ -528,12 +528,12 @@ bool MorkParser::parseRow( int TableId, int TableScope ) ...@@ -528,12 +528,12 @@ bool MorkParser::parseRow( int TableId, int TableScope )
return Result; return Result;
} }
bool MorkParser::parseGroup() void MorkParser::parseGroup()
{ {
return parseMeta( '@' ); parseMeta( '@' );
} }
bool MorkParser::parseMeta( char c ) void MorkParser::parseMeta( char c )
{ {
char cur = nextChar(); char cur = nextChar();
...@@ -541,8 +541,6 @@ bool MorkParser::parseMeta( char c ) ...@@ -541,8 +541,6 @@ bool MorkParser::parseMeta( char c )
{ {
cur = nextChar(); cur = nextChar();
} }
return true;
} }
MorkTableMap *MorkParser::getTables( int TableScope ) MorkTableMap *MorkParser::getTables( int TableScope )
......
...@@ -115,9 +115,9 @@ private: // Members ...@@ -115,9 +115,9 @@ private: // Members
bool parseComment(); bool parseComment();
bool parseCell(); bool parseCell();
bool parseTable(); bool parseTable();
bool parseMeta( char c ); void parseMeta( char c );
bool parseRow( int TableId, int TableScope ); bool parseRow( int TableId, int TableScope );
bool parseGroup(); void parseGroup();
private: // Data private: // Data
......
...@@ -116,8 +116,8 @@ namespace connectivity ...@@ -116,8 +116,8 @@ namespace connectivity
bool Find(sal_uInt32 nRec, const ORowSetValue& rValue); bool Find(sal_uInt32 nRec, const ORowSetValue& rValue);
void createINFEntry(); void createINFEntry();
bool CreateImpl(); void CreateImpl();
bool DropImpl(); void DropImpl();
DECLARE_SERVICE_INFO(); DECLARE_SERVICE_INFO();
protected: protected:
......
...@@ -120,10 +120,10 @@ namespace connectivity ...@@ -120,10 +120,10 @@ namespace connectivity
bool CreateFile(const INetURLObject& aFile, bool& bCreateMemo); bool CreateFile(const INetURLObject& aFile, bool& bCreateMemo);
bool CreateMemoFile(const INetURLObject& aFile); bool CreateMemoFile(const INetURLObject& aFile);
bool HasMemoFields() const { return m_aHeader.type > dBaseIV;} bool HasMemoFields() const { return m_aHeader.type > dBaseIV;}
bool ReadMemoHeader(); void ReadMemoHeader();
bool ReadMemo(std::size_t nBlockNo, ORowSetValue& aVariable); 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 WriteBuffer();
bool UpdateBuffer(OValueRefVector& rRow, const OValueRefRow& pOrgRow, const css::uno::Reference< css::container::XIndexAccess>& _xCols, bool bForceAllFields); 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); css::uno::Reference< css::beans::XPropertySet> isUniqueByColumnName(sal_Int32 _nColumnPos);
......
...@@ -140,7 +140,7 @@ namespace connectivity ...@@ -140,7 +140,7 @@ namespace connectivity
bool Insert(ONDXNode& rNode, sal_uInt32 nRowsLeft = 0); bool Insert(ONDXNode& rNode, sal_uInt32 nRowsLeft = 0);
bool Insert(sal_uInt16 nIndex, ONDXNode& rNode); bool Insert(sal_uInt16 nIndex, ONDXNode& rNode);
bool Append(ONDXNode& rNode); bool Append(ONDXNode& rNode);
bool Delete(sal_uInt16); void Delete(sal_uInt16);
void Remove(sal_uInt16); void Remove(sal_uInt16);
void Release(bool bSave = true); void Release(bool bSave = true);
void ReleaseFull(); void ReleaseFull();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment