1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-10 06:10:52 +02:00

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>
This commit is contained in:
Andreas Rheinhardt
2025-03-30 16:23:51 +02:00
parent 02eda84bf2
commit 830fab6891

View File

@@ -118,7 +118,7 @@ static const char* channel_order_names[] = {"UNSPEC", "NATIVE", "CUSTOM", "AMBI
static void describe_type(AVBPrint *bp, AVChannelLayout *layout) 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_bprintf(bp, "%-6s (", channel_order_names[layout->order]);
av_channel_layout_describe_bprint(layout, bp); av_channel_layout_describe_bprint(layout, bp);
av_bprintf(bp, ")"); av_bprintf(bp, ")");