mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-22 16:26:39 +00:00
libav: avcfg: Avoid brittle comparision
Subtracting a gint from another (or a guint from another) has no guarantees that it will result in a gint. Therefore do the actual comparision instead. Also use the *actual* type for comparing flags (the field value types are different) Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3319>
This commit is contained in:
parent
cadc067bde
commit
0213536f77
1 changed files with 7 additions and 3 deletions
|
@ -79,7 +79,9 @@ gst_ffmpeg_cfg_init (void)
|
|||
static gint
|
||||
cmp_enum_value (GEnumValue * val1, GEnumValue * val2)
|
||||
{
|
||||
return val1->value - val2->value;
|
||||
if (val1->value == val2->value)
|
||||
return 0;
|
||||
return (val1->value > val2->value) ? 1 : -1;
|
||||
}
|
||||
|
||||
static GType
|
||||
|
@ -176,9 +178,11 @@ done:
|
|||
}
|
||||
|
||||
static gint
|
||||
cmp_flags_value (GEnumValue * val1, GEnumValue * val2)
|
||||
cmp_flags_value (GFlagsValue * val1, GFlagsValue * val2)
|
||||
{
|
||||
return val1->value - val2->value;
|
||||
if (val1->value == val2->value)
|
||||
return 0;
|
||||
return (val1->value > val2->value) ? 1 : -1;
|
||||
}
|
||||
|
||||
static GType
|
||||
|
|
Loading…
Reference in a new issue