[MPlayer-dev-eng] [PATCH] simplify and correct ebml.c float reading
Reimar Döffinger
Reimar.Doeffinger at stud.uni-karlsruhe.de
Tue Nov 28 20:03:42 CET 2006
Hello,
attached patch makes it use av_int2flt/av_int2dbl which is simpler and
also works if int endianness != float endianness.
I intend to apply soon.
Greetings,
Reimar Döffinger
-------------- next part --------------
Index: libmpdemux/ebml.c
===================================================================
--- libmpdemux/ebml.c (revision 21360)
+++ libmpdemux/ebml.c (working copy)
@@ -12,6 +12,7 @@
#include "stream.h"
#include "ebml.h"
#include "bswap.h"
+#include "libavutil/intfloat_readwrite.h"
#ifndef SIZE_MAX
@@ -178,20 +179,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;
More information about the MPlayer-dev-eng
mailing list