From ef393a06505e6cb16015a7e6f57e9164aec6d2e4 Mon Sep 17 00:00:00 2001 From: reimar Date: Thu, 30 Nov 2006 17:55:00 +0000 Subject: Use av_int2flt/av_int2dbl to read float values. This is simpler and more correct since it also works for int endianness != float endianness. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21404 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpdemux/ebml.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/libmpdemux/ebml.c b/libmpdemux/ebml.c index af69e61aaf..df1fda647b 100644 --- a/libmpdemux/ebml.c +++ b/libmpdemux/ebml.c @@ -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 @@ ebml_read_float (stream_t *s, uint64_t *length) 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; -- cgit v1.2.3