Fix -wreturn-type warnings

This commit is contained in:
Albert S. 2021-10-25 18:13:25 +02:00
parent ed61003636
commit 017932e673
4 changed files with 8 additions and 9 deletions

View File

@ -75,10 +75,7 @@ std::pair<bool, std::string> CLIHandler::user_change_pw([[maybe_unused]] const s
userDao->save(*user); userDao->save(*user);
} }
else return {false, "User not found"};
{
return {false, "User not found"};
}
} }
std::pair<bool, std::string> CLIHandler::user_rename([[maybe_unused]] const std::vector<std::string> &args) std::pair<bool, std::string> CLIHandler::user_rename([[maybe_unused]] const std::vector<std::string> &args)

View File

@ -42,6 +42,7 @@ std::optional<Category> CategoryDaoSqlite::find(std::string name)
{ {
throwFrom(e); throwFrom(e);
} }
return {};
} }
void CategoryDaoSqlite::save(const Category &c) void CategoryDaoSqlite::save(const Category &c)

View File

@ -22,18 +22,17 @@ SOFTWARE.
bool SqliteDao::execBool(sqlite::database_binder &binder) const bool SqliteDao::execBool(sqlite::database_binder &binder) const
{ {
bool result; bool result = false;
try try
{ {
bool result;
binder >> result; binder >> result;
return result;
} }
catch(sqlite::sqlite_exception &e) catch(sqlite::sqlite_exception &e)
{ {
// TODO: well, we may want to check whether rows have found or not and thus log this here // TODO: well, we may want to check whether rows have found or not and thus log this here
return false; result = false;
} }
return result;
} }
int SqliteDao::execInt(sqlite::database_binder &binder) const int SqliteDao::execInt(sqlite::database_binder &binder) const
@ -52,4 +51,5 @@ int SqliteDao::execInt(sqlite::database_binder &binder) const
{ {
throwFrom(e); throwFrom(e);
} }
return 0;
} }

View File

@ -37,7 +37,6 @@ bool UserDaoSqlite::exists(std::string username)
std::optional<User> UserDaoSqlite::find(std::string username) std::optional<User> UserDaoSqlite::find(std::string username)
{ {
try try
{ {
User user; User user;
@ -58,6 +57,7 @@ std::optional<User> UserDaoSqlite::find(std::string username)
{ {
throwFrom(e); throwFrom(e);
} }
return {};
} }
std::optional<User> UserDaoSqlite::find(int id) std::optional<User> UserDaoSqlite::find(int id)
@ -81,6 +81,7 @@ std::optional<User> UserDaoSqlite::find(int id)
{ {
throwFrom(e); throwFrom(e);
} }
return {};
} }
std::vector<User> UserDaoSqlite::list(QueryOption o) std::vector<User> UserDaoSqlite::list(QueryOption o)