diff --git a/matrix/acquire.cc b/matrix/acquire.cc index 52b3b1d9b..cb5caa141 100644 --- a/matrix/acquire.cc +++ b/matrix/acquire.cc @@ -218,7 +218,7 @@ ircd::m::acquire::fetch_history(event::idx &ref_min) // Fortunately in practice the majority of estimates are close enough. // XXX /get_missing_events should be considered if there's low // confidence in a gap estimate. - const auto &limit + const auto limit { std::clamp(gap, 1UL, 48UL) }; @@ -557,12 +557,12 @@ ircd::m::acquire::fetch_head(const m::event &result, 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 diff --git a/matrix/room_head_fetch.cc b/matrix/room_head_fetch.cc index 2c4c51535..1c0fcaeed 100644 --- a/matrix/room_head_fetch.cc +++ b/matrix/room_head_fetch.cc @@ -211,9 +211,9 @@ ircd::m::room::head::fetch::fetch(const opts &opts, // The depth comes back as one greater than any existing // 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