alternator: streams: fix signed/unsigned comparison

We compare a signed variable to an unsigned one, which can
yield surprising results. In this case, it is harmless since
we already validated the signed input is positive, but
use std::cmp_less() to quench any doubts (and warnings).
This commit is contained in:
Avi Kivity
2023-03-19 19:02:29 +02:00
parent 0770b328c7
commit 429650e508

View File

@@ -167,7 +167,7 @@ future<alternator::executor::request_return_type> alternator::executor::list_str
// generate duplicates in a paged listing here. Can obviously miss things if they
// are added between paged calls and end up with a "smaller" UUID/ARN, but that
// is to be expected.
if (limit < cfs.size() || streams_start) {
if (std::cmp_less(limit, cfs.size()) || streams_start) {
std::sort(cfs.begin(), cfs.end(), [](const data_dictionary::table& t1, const data_dictionary::table& t2) {
return t1.schema()->id().uuid() < t2.schema()->id().uuid();
});