summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2018-10-16 04:08:57 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2018-10-16 04:29:37 +0530
commit21a18e22e141ca01d4e23517c813ea45a7d701db (patch)
treefd306c382feb3facb7defda87ca885627a521e3c /ext
parentef106350d4837d9509a636491c723fc5aae8df96 (diff)
downloadgst-libav-21a18e22e141ca01d4e23517c813ea45a7d701db.tar.gz
avcfg: Ensure that ternary operator always evaluates to int64
When building with MSVC, if the 3rd operator is a double, the entire expression always promoted double, and is then cast to int64. When TRUE, this evaluates to (gint64) (gdouble) (INT64_MAX) which overflows to INT64_MIN on MSVC, but not on C99 compilers. This causes us to fail the g_return_if_fail inside g_param_spec_int64 when built with MSVC.
Diffstat (limited to 'ext')
-rw-r--r--ext/libav/gstavcfg.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/libav/gstavcfg.c b/ext/libav/gstavcfg.c
index 8df5d14..9236078 100644
--- a/ext/libav/gstavcfg.c
+++ b/ext/libav/gstavcfg.c
@@ -298,8 +298,8 @@ install_opts (GObjectClass * gobject_class, const AVClass ** obj, guint prop_id,
case AV_OPT_TYPE_INT64:
/* ffmpeg expresses all ranges with doubles, this is sad */
pspec = g_param_spec_int64 (name, name, help,
- (gint64) (min == (gdouble) INT64_MIN ? INT64_MIN : min),
- (gint64) (max == (gdouble) INT64_MAX ? INT64_MAX : max),
+ (min == (gdouble) INT64_MIN ? INT64_MIN : (gint64) min),
+ (max == (gdouble) INT64_MAX ? INT64_MAX : (gint64) max),
opt->default_val.i64, G_PARAM_READWRITE);
g_object_class_install_property (gobject_class, prop_id++, pspec);
break;