🐛 warnings removed

This commit is contained in:
EntireTwix 2021-06-14 13:50:49 -07:00
parent de14e2983a
commit 2ccb18345f
3 changed files with 7 additions and 7 deletions

View file

@ -121,12 +121,12 @@ int_fast8_t Bank::SendFunds(const std::string &a_name, const std::string &b_name
{ {
if (state) if (state)
{ {
//if B doesnt exist //if B does exist
if (users.modify_if(b_name, [amount](User &b) { if (users.modify_if(b_name, [amount](User &b) {
b.balance += amount; b.balance += amount;
})) }))
{ {
if constexpr (max_log_size) if constexpr (max_log_size > 0)
{ {
Transaction temp(a_name, b_name, amount); Transaction temp(a_name, b_name, amount);
Transaction temp2 = temp; Transaction temp2 = temp;
@ -316,7 +316,7 @@ void Bank::Load()
user_save.close(); user_save.close();
for (const auto &u : temp.getMemberNames()) for (const auto &u : temp.getMemberNames())
{ {
if constexpr (max_log_size) if constexpr (max_log_size > 0)
{ {
users.try_emplace(u, temp[u]["balance"].asUInt(), std::move(temp[u]["password"].asUInt64()), temp[u]["log"]); users.try_emplace(u, temp[u]["balance"].asUInt(), std::move(temp[u]["password"].asUInt64()), temp[u]["log"]);
} }

View file

@ -104,7 +104,7 @@ void BankF::AdminVerifyPass(req_args)
} }
void BankF::GetLog(req_args, const std::string &name) void BankF::GetLog(req_args, const std::string &name)
{ {
if constexpr (max_log_size) if constexpr (max_log_size > 0)
{ {
JSON(bank.GetLogs(name, PASS_HEADER)); JSON(bank.GetLogs(name, PASS_HEADER));
} }

View file

@ -29,11 +29,11 @@ User::User(uint32_t init_bal, uint64_t init_pass, const Json::Value &log_j) : ba
log.data.reserve(std::min(pre_log_size * ((log_j.size() / pre_log_size) + 1), max_log_size)); log.data.reserve(std::min(pre_log_size * ((log_j.size() / pre_log_size) + 1), max_log_size));
for (uint32_t i = (log_j.size() - max_log_size) * (log_j.size() > max_log_size); i < log_j.size(); i++) for (uint32_t i = (log_j.size() - max_log_size) * (log_j.size() > max_log_size); i < log_j.size(); i++)
{ {
log.data.push_back(std::move(Transaction( log.data.push_back(Transaction(
log_j[i]["from"].asCString(), log_j[i]["from"].asCString(),
log_j[i]["to"].asCString(), log_j[i]["to"].asCString(),
log_j[i]["amount"].asUInt(), log_j[i]["amount"].asUInt(),
log_j[i]["time"].asUInt64()))); log_j[i]["time"].asUInt64()));
} }
} }
} }
@ -43,7 +43,7 @@ Json::Value User::Serialize() const
Json::Value res; Json::Value res;
res["balance"] = (Json::UInt)balance; res["balance"] = (Json::UInt)balance;
res["password"] = (Json::UInt64)password; res["password"] = (Json::UInt64)password;
if constexpr (max_log_size) if constexpr (max_log_size > 0)
{ {
res["log"] = log.Serialize(); res["log"] = log.Serialize();
} }