ifconfig: Pacify a sign comparison warning in regdomain_sort.

Both ic_flags values are unsigned (uint32_t), so cast them to a signed
int to generate a signed result.  Both ic_req values are also
unsigned, but since they are uint16_t, they are implicitly promited to
int before the subtraction.

Reported by:	GCC -Wsign-compare
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D40610
This commit is contained in:
John Baldwin 2023-06-19 10:38:18 -07:00
parent a3b1138778
commit f19ae3633b

View File

@ -2062,7 +2062,7 @@ regdomain_sort(const void *a, const void *b)
const struct ieee80211_channel *cb = b;
return ca->ic_freq == cb->ic_freq ?
(ca->ic_flags & CHAN_ALL) - (cb->ic_flags & CHAN_ALL) :
(int)(ca->ic_flags & CHAN_ALL) - (int)(cb->ic_flags & CHAN_ALL) :
ca->ic_freq - cb->ic_freq;
#undef CHAN_ALL
}