summaryrefslogtreecommitdiff
path: root/gst/aiff/aiffmux.c
diff options
context:
space:
mode:
authorDavid Hoyt <dhoyt@llnl.gov>2010-07-09 17:44:56 +0300
committerStefan Kost <ensonic@users.sf.net>2010-07-09 17:44:56 +0300
commit3172e11121885c1b4c53deed214682e016ebbfc6 (patch)
tree3c8c13812b3bdb7bda379d82a598a621fc8bcd02 /gst/aiff/aiffmux.c
parente467a3e14b48bffc31b088dbfe011970d10b359e (diff)
downloadgstreamer-plugins-bad-3172e11121885c1b4c53deed214682e016ebbfc6.tar.gz
aifmmux: use alternative way to check for inf
MSVC emits a divide-by-zero error when compiling aiffmux.c on line 205. Fixes #623881.
Diffstat (limited to 'gst/aiff/aiffmux.c')
-rw-r--r--gst/aiff/aiffmux.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/gst/aiff/aiffmux.c b/gst/aiff/aiffmux.c
index 682ca8b49..39770cf2e 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)