ircd:Ⓜ️ Ensure signed integer subtractions are defined.
This commit is contained in:
parent
7d60b6fddc
commit
29f4620826
|
@ -218,7 +218,7 @@ ircd::m::acquire::fetch_history(event::idx &ref_min)
|
||||||
// Fortunately in practice the majority of estimates are close enough.
|
// Fortunately in practice the majority of estimates are close enough.
|
||||||
// XXX /get_missing_events should be considered if there's low
|
// XXX /get_missing_events should be considered if there's low
|
||||||
// confidence in a gap estimate.
|
// confidence in a gap estimate.
|
||||||
const auto &limit
|
const auto limit
|
||||||
{
|
{
|
||||||
std::clamp(gap, 1UL, 48UL)
|
std::clamp(gap, 1UL, 48UL)
|
||||||
};
|
};
|
||||||
|
@ -557,12 +557,12 @@ ircd::m::acquire::fetch_head(const m::event &result,
|
||||||
|
|
||||||
const auto gap
|
const auto gap
|
||||||
{
|
{
|
||||||
json::get<"depth"_>(result) - top_depth
|
uint64_t(json::get<"depth"_>(result)) - top_depth
|
||||||
};
|
};
|
||||||
|
|
||||||
const auto &limit
|
const auto limit
|
||||||
{
|
{
|
||||||
std::clamp(gap, 1L, 48L)
|
std::clamp(int64_t(gap), 1L, 48L)
|
||||||
};
|
};
|
||||||
|
|
||||||
const auto &hint
|
const auto &hint
|
||||||
|
|
|
@ -211,9 +211,9 @@ ircd::m::room::head::fetch::fetch(const opts &opts,
|
||||||
|
|
||||||
// The depth comes back as one greater than any existing
|
// The depth comes back as one greater than any existing
|
||||||
// depth so we subtract one.
|
// depth so we subtract one.
|
||||||
const auto &depth
|
const auto depth
|
||||||
{
|
{
|
||||||
std::max(json::get<"depth"_>(event) - 1L, 0L)
|
int64_t(std::max(uint64_t(json::get<"depth"_>(event)) - 1, 0UL))
|
||||||
};
|
};
|
||||||
|
|
||||||
const auto &ots
|
const auto &ots
|
||||||
|
|
Loading…
Reference in New Issue