From 429650e50873462d89d00a2f60c8b4c6b4144ac2 Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Sun, 19 Mar 2023 19:02:29 +0200 Subject: [PATCH] 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). --- alternator/streams.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/alternator/streams.cc b/alternator/streams.cc index 0e310105a5..6377e51d67 100644 --- a/alternator/streams.cc +++ b/alternator/streams.cc @@ -167,7 +167,7 @@ future 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(); });