forked from Mirrorlandia_minetest/minetest
Remove unnecessary bool return types
This commit is contained in:
parent
7c21347a40
commit
8b26bab37d
@ -81,7 +81,7 @@ void Database_Dummy::listPlayers(std::vector<std::string> &res)
|
||||
}
|
||||
}
|
||||
|
||||
bool Database_Dummy::getModEntries(const std::string &modname, StringMap *storage)
|
||||
void Database_Dummy::getModEntries(const std::string &modname, StringMap *storage)
|
||||
{
|
||||
const auto mod_pair = m_mod_storage_database.find(modname);
|
||||
if (mod_pair != m_mod_storage_database.cend()) {
|
||||
@ -89,10 +89,9 @@ bool Database_Dummy::getModEntries(const std::string &modname, StringMap *storag
|
||||
(*storage)[pair.first] = pair.second;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Database_Dummy::getModKeys(const std::string &modname, std::vector<std::string> *storage)
|
||||
void Database_Dummy::getModKeys(const std::string &modname, std::vector<std::string> *storage)
|
||||
{
|
||||
const auto mod_pair = m_mod_storage_database.find(modname);
|
||||
if (mod_pair != m_mod_storage_database.cend()) {
|
||||
@ -100,7 +99,6 @@ bool Database_Dummy::getModKeys(const std::string &modname, std::vector<std::str
|
||||
for (const auto &pair : mod_pair->second)
|
||||
storage->push_back(pair.first);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Database_Dummy::getModEntry(const std::string &modname,
|
||||
|
@ -37,8 +37,8 @@ public:
|
||||
bool removePlayer(const std::string &name);
|
||||
void listPlayers(std::vector<std::string> &res);
|
||||
|
||||
bool getModEntries(const std::string &modname, StringMap *storage);
|
||||
bool getModKeys(const std::string &modname, std::vector<std::string> *storage);
|
||||
void getModEntries(const std::string &modname, StringMap *storage);
|
||||
void getModKeys(const std::string &modname, std::vector<std::string> *storage);
|
||||
bool getModEntry(const std::string &modname,
|
||||
const std::string &key, std::string *value);
|
||||
bool hasModEntry(const std::string &modname, const std::string &key);
|
||||
|
@ -381,34 +381,30 @@ ModStorageDatabaseFiles::ModStorageDatabaseFiles(const std::string &savedir):
|
||||
{
|
||||
}
|
||||
|
||||
bool ModStorageDatabaseFiles::getModEntries(const std::string &modname, StringMap *storage)
|
||||
void ModStorageDatabaseFiles::getModEntries(const std::string &modname, StringMap *storage)
|
||||
{
|
||||
Json::Value *meta = getOrCreateJson(modname);
|
||||
if (!meta)
|
||||
return false;
|
||||
return;
|
||||
|
||||
const Json::Value::Members attr_list = meta->getMemberNames();
|
||||
for (const auto &it : attr_list) {
|
||||
Json::Value attr_value = (*meta)[it];
|
||||
(*storage)[it] = attr_value.asString();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ModStorageDatabaseFiles::getModKeys(const std::string &modname,
|
||||
void ModStorageDatabaseFiles::getModKeys(const std::string &modname,
|
||||
std::vector<std::string> *storage)
|
||||
{
|
||||
Json::Value *meta = getOrCreateJson(modname);
|
||||
if (!meta)
|
||||
return false;
|
||||
return;
|
||||
|
||||
std::vector<std::string> keys = meta->getMemberNames();
|
||||
storage->reserve(storage->size() + keys.size());
|
||||
for (std::string &key : keys)
|
||||
storage->push_back(std::move(key));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ModStorageDatabaseFiles::getModEntry(const std::string &modname,
|
||||
|
@ -78,8 +78,8 @@ public:
|
||||
ModStorageDatabaseFiles(const std::string &savedir);
|
||||
virtual ~ModStorageDatabaseFiles() = default;
|
||||
|
||||
virtual bool getModEntries(const std::string &modname, StringMap *storage);
|
||||
virtual bool getModKeys(const std::string &modname, std::vector<std::string> *storage);
|
||||
virtual void getModEntries(const std::string &modname, StringMap *storage);
|
||||
virtual void getModKeys(const std::string &modname, std::vector<std::string> *storage);
|
||||
virtual bool getModEntry(const std::string &modname,
|
||||
const std::string &key, std::string *value);
|
||||
virtual bool hasModEntry(const std::string &modname, const std::string &key);
|
||||
|
@ -866,7 +866,7 @@ void ModStorageDatabasePostgreSQL::initStatements()
|
||||
"SELECT DISTINCT modname FROM mod_storage");
|
||||
}
|
||||
|
||||
bool ModStorageDatabasePostgreSQL::getModEntries(const std::string &modname, StringMap *storage)
|
||||
void ModStorageDatabasePostgreSQL::getModEntries(const std::string &modname, StringMap *storage)
|
||||
{
|
||||
verifyDatabase();
|
||||
|
||||
@ -882,11 +882,9 @@ bool ModStorageDatabasePostgreSQL::getModEntries(const std::string &modname, Str
|
||||
(*storage)[pg_to_string(results, row, 0)] = pg_to_string(results, row, 1);
|
||||
|
||||
PQclear(results);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ModStorageDatabasePostgreSQL::getModKeys(const std::string &modname,
|
||||
void ModStorageDatabasePostgreSQL::getModKeys(const std::string &modname,
|
||||
std::vector<std::string> *storage)
|
||||
{
|
||||
verifyDatabase();
|
||||
@ -904,8 +902,6 @@ bool ModStorageDatabasePostgreSQL::getModKeys(const std::string &modname,
|
||||
storage->push_back(pg_to_string(results, row, 0));
|
||||
|
||||
PQclear(results);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ModStorageDatabasePostgreSQL::getModEntry(const std::string &modname,
|
||||
|
@ -181,8 +181,8 @@ public:
|
||||
ModStorageDatabasePostgreSQL(const std::string &connect_string);
|
||||
~ModStorageDatabasePostgreSQL() = default;
|
||||
|
||||
bool getModEntries(const std::string &modname, StringMap *storage);
|
||||
bool getModKeys(const std::string &modname, std::vector<std::string> *storage);
|
||||
void getModEntries(const std::string &modname, StringMap *storage);
|
||||
void getModKeys(const std::string &modname, std::vector<std::string> *storage);
|
||||
bool getModEntry(const std::string &modname, const std::string &key, std::string *value);
|
||||
bool hasModEntry(const std::string &modname, const std::string &key);
|
||||
bool setModEntry(const std::string &modname,
|
||||
|
@ -808,7 +808,7 @@ void ModStorageDatabaseSQLite3::initStatements()
|
||||
PREPARE_STATEMENT(remove_all, "DELETE FROM `entries` WHERE `modname` = ?");
|
||||
}
|
||||
|
||||
bool ModStorageDatabaseSQLite3::getModEntries(const std::string &modname, StringMap *storage)
|
||||
void ModStorageDatabaseSQLite3::getModEntries(const std::string &modname, StringMap *storage)
|
||||
{
|
||||
verifyDatabase();
|
||||
|
||||
@ -823,11 +823,9 @@ bool ModStorageDatabaseSQLite3::getModEntries(const std::string &modname, String
|
||||
sqlite3_vrfy(sqlite3_errcode(m_database), SQLITE_DONE);
|
||||
|
||||
sqlite3_reset(m_stmt_get_all);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ModStorageDatabaseSQLite3::getModKeys(const std::string &modname,
|
||||
void ModStorageDatabaseSQLite3::getModKeys(const std::string &modname,
|
||||
std::vector<std::string> *storage)
|
||||
{
|
||||
verifyDatabase();
|
||||
@ -841,8 +839,6 @@ bool ModStorageDatabaseSQLite3::getModKeys(const std::string &modname,
|
||||
sqlite3_vrfy(sqlite3_errcode(m_database), SQLITE_DONE);
|
||||
|
||||
sqlite3_reset(m_stmt_get_keys);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ModStorageDatabaseSQLite3::getModEntry(const std::string &modname,
|
||||
|
@ -239,8 +239,8 @@ public:
|
||||
ModStorageDatabaseSQLite3(const std::string &savedir);
|
||||
virtual ~ModStorageDatabaseSQLite3();
|
||||
|
||||
virtual bool getModEntries(const std::string &modname, StringMap *storage);
|
||||
virtual bool getModKeys(const std::string &modname, std::vector<std::string> *storage);
|
||||
virtual void getModEntries(const std::string &modname, StringMap *storage);
|
||||
virtual void getModKeys(const std::string &modname, std::vector<std::string> *storage);
|
||||
virtual bool getModEntry(const std::string &modname,
|
||||
const std::string &key, std::string *value);
|
||||
virtual bool hasModEntry(const std::string &modname, const std::string &key);
|
||||
|
@ -91,8 +91,8 @@ class ModStorageDatabase : public Database
|
||||
public:
|
||||
virtual ~ModStorageDatabase() = default;
|
||||
|
||||
virtual bool getModEntries(const std::string &modname, StringMap *storage) = 0;
|
||||
virtual bool getModKeys(const std::string &modname, std::vector<std::string> *storage) = 0;
|
||||
virtual void getModEntries(const std::string &modname, StringMap *storage) = 0;
|
||||
virtual void getModKeys(const std::string &modname, std::vector<std::string> *storage) = 0;
|
||||
virtual bool hasModEntry(const std::string &modname, const std::string &key) = 0;
|
||||
virtual bool getModEntry(const std::string &modname,
|
||||
const std::string &key, std::string *value) = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user