From 3172e11121885c1b4c53deed214682e016ebbfc6 Mon Sep 17 00:00:00 2001 From: David Hoyt Date: Fri, 9 Jul 2010 17:44:56 +0300 Subject: [PATCH] aifmmux: use alternative way to check for inf MSVC emits a divide-by-zero error when compiling aiffmux.c on line 205. Fixes #623881. --- gst/aiff/aiffmux.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/gst/aiff/aiffmux.c b/gst/aiff/aiffmux.c index 682ca8b49d..39770cf2e3 100644 --- a/gst/aiff/aiffmux.c +++ b/gst/aiff/aiffmux.c @@ -183,6 +183,17 @@ typedef struct AVExtFloat guint8 mantissa[8]; } AVExtFloat; +/* Courtesy http://www.devx.com/tips/Tip/42853 */ +static inline gint +gst_aiff_mux_isinf (gdouble x) +{ + volatile gdouble temp = x; + if ((temp == x) && ((temp - x) != 0.0)) + return (x < 0.0 ? -1 : 1); + else + return 0; +} + static void gst_aiff_mux_write_ext (GstByteWriter * writer, double d) { @@ -202,7 +213,7 @@ gst_aiff_mux_write_ext (GstByteWriter * writer, double d) } else if (f != 0.0) { ext.exponent[0] = 0x7f; ext.exponent[1] = 0xff; - if (f != 1 / 0.0) + if (!gst_aiff_mux_isinf (f)) ext.mantissa[0] = ~0; } if (d < 0)