changeset 21388:be5f168e42ae

Use av_int2flt/av_int2dbl to read float values. This is simpler and more correct since it also works for int endianness != float endianness.
author reimar
date Thu, 30 Nov 2006 17:55:00 +0000
parents 8621736097f8
children deac3aacf67e
files libmpdemux/ebml.c
diffstat 1 files changed, 3 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/ebml.c	Thu Nov 30 17:48:00 2006 +0000
+++ b/libmpdemux/ebml.c	Thu Nov 30 17:55:00 2006 +0000
@@ -13,6 +13,7 @@
 #include "ebml.h"
 #include "libavutil/common.h"
 #include "libavutil/bswap.h"
+#include "libavutil/intfloat_readwrite.h"
 
 
 #ifndef SIZE_MAX
@@ -179,20 +180,12 @@
   switch (len)
     {
     case 4:
-      {
-        union {uint32_t i; float f;} u;
-        u.i = stream_read_dword (s);
-        value = u.f;
+        value = av_int2flt(stream_read_dword(s));
         break;
-      }
 
     case 8:
-      {
-        union {uint64_t i; double d;} u;
-        u.i = stream_read_qword (s);
-        value = u.d;
+        value = av_int2dbl(stream_read_qword(s));
         break;
-      }
 
     default:
       return EBML_FLOAT_INVALID;