From 052f9bba9924335ce03cd1bef0d54cd0a37e6dc5 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Date: Sun, 30 Mar 2025 16:23:51 +0200 Subject: [PATCH] avutil/tests/channel_layout: Improve enum range check Both GCC and Clang use unsigned as underlying type of an enum with no negative enumeration constants, making checks like "layout->order >= 0" here tautologically true. Clang warns about this. Combine both range checks by casting to unsigned to suppress this warning. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavutil/tests/channel_layout.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavutil/tests/channel_layout.c b/libavutil/tests/channel_layout.c index 8132b83434..e79e4c3611 100644 --- a/libavutil/tests/channel_layout.c +++ b/libavutil/tests/channel_layout.c @@ -118,7 +118,7 @@ static const char* channel_order_names[] = {"UNSPEC", "NATIVE", "CUSTOM", "AMBI static void describe_type(AVBPrint *bp, AVChannelLayout *layout) { - if (layout->order >= 0 && layout->order < FF_ARRAY_ELEMS(channel_order_names)) { + if ((unsigned)layout->order < FF_ARRAY_ELEMS(channel_order_names)) { av_bprintf(bp, "%-6s (", channel_order_names[layout->order]); av_channel_layout_describe_bprint(layout, bp); av_bprintf(bp, ")"); -- 2.45.2