From 2c38fcd1e6d59ab4c87e1e6eada50cf769db66d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 2 Jul 2008 09:04:50 +0000 Subject: [PATCH] gst/matroska/ebml-read.c: Use NAN constant instead of 0.0/0.0 if possible. NAN is defined in math.h except on MSVC wh... Original commit message from CVS: * gst/matroska/ebml-read.c: (_ext2dbl): Use NAN constant instead of 0.0/0.0 if possible. NAN is defined in math.h except on MSVC where it is defined in xmath.h. Fixes compilation with MSVC. --- ChangeLog | 7 +++++++ gst/matroska/ebml-read.c | 12 +++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 3d2d026b40..64cfe2b472 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-07-02 Sebastian Dröge + + * gst/matroska/ebml-read.c: (_ext2dbl): + Use NAN constant instead of 0.0/0.0 if possible. NAN is defined + in math.h except on MSVC where it is defined in xmath.h. + Fixes compilation with MSVC. + 2008-07-02 Sebastian Dröge * gst/matroska/matroska-demux.c: (gst_matroska_demux_reset), diff --git a/gst/matroska/ebml-read.c b/gst/matroska/ebml-read.c index 6ce679da92..2220a229f6 100644 --- a/gst/matroska/ebml-read.c +++ b/gst/matroska/ebml-read.c @@ -31,6 +31,16 @@ #include +/* NAN is supposed to be in math.h, Microsoft defines it in xmath.h */ +#ifdef _MSC_VER +#include +#endif + +/* If everything goes wrong try 0.0/0.0 which should be NAN */ +#ifndef NAN +#define NAN (0.0 / 0.0) +#endif + GST_DEBUG_CATEGORY_STATIC (ebmlread_debug); #define GST_CAT_DEFAULT ebmlread_debug @@ -706,7 +716,7 @@ _ext2dbl (guint8 * data) m = (m << 8) + ext.mantissa[i]; e = (((gint) ext.exponent[0] & 0x7f) << 8) | ext.exponent[1]; if (e == 0x7fff && m) - return 0.0 / 0.0; + return NAN; e -= 16383 + 63; /* In IEEE 80 bits, the whole (i.e. 1.xxxx) * mantissa bit is written as opposed to the * single and double precision formats */