mirror of
https://github.com/Expand-sys/CCash
synced 2025-12-17 08:32:13 +11:00
🐛 seg fault bug fixed
This commit is contained in:
parent
7972f9857d
commit
c833f66d9f
2 changed files with 5 additions and 5 deletions
|
|
@ -173,7 +173,7 @@ public:
|
||||||
{
|
{
|
||||||
if constexpr (max_log_size)
|
if constexpr (max_log_size)
|
||||||
{
|
{
|
||||||
Json::Value res;
|
Json::Value res;
|
||||||
if (!users.if_contains(name, [&res, &attempt](const User &u) {
|
if (!users.if_contains(name, [&res, &attempt](const User &u) {
|
||||||
if (u.password != XXH3_64bits(attempt.data(), attempt.size()))
|
if (u.password != XXH3_64bits(attempt.data(), attempt.size()))
|
||||||
{
|
{
|
||||||
|
|
@ -187,7 +187,7 @@ public:
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,9 +10,9 @@ struct Log
|
||||||
uint32_t end = 0;
|
uint32_t end = 0;
|
||||||
void AddTrans(Transaction &&v)
|
void AddTrans(Transaction &&v)
|
||||||
{
|
{
|
||||||
if (data.size() <= end+1 && end+1 < max_log_size) //if memory reserved is full
|
if (data.size() <= end + 1 && end + 1 < max_log_size) //if memory reserved is full
|
||||||
{
|
{
|
||||||
if(data.size() + pre_log_size > max_log_size)
|
if (data.size() + pre_log_size > max_log_size)
|
||||||
{
|
{
|
||||||
data.resize(max_log_size);
|
data.resize(max_log_size);
|
||||||
}
|
}
|
||||||
|
|
@ -26,7 +26,7 @@ struct Log
|
||||||
data[i] = std::move(data[i - 1]);
|
data[i] = std::move(data[i - 1]);
|
||||||
}
|
}
|
||||||
data[0] = std::move(v);
|
data[0] = std::move(v);
|
||||||
end += (end < max_log_size); //branchless
|
end += (end + 1 < max_log_size); //branchless
|
||||||
}
|
}
|
||||||
Json::Value Serialize() const
|
Json::Value Serialize() const
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue