diff options
author | mosu <mosu@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2005-07-10 18:31:13 +0000 |
---|---|---|
committer | mosu <mosu@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2005-07-10 18:31:13 +0000 |
commit | 3987f2d26039fb6a7377073ed4d77c8dd208cda9 (patch) | |
tree | 4adca1ee8e8c8d4ee1ee74a023ca3e03701979ce /libmpdemux/ebml.c | |
parent | c54b5a06bd40fba8a37c7053cd7437785e9a7314 (diff) | |
download | mpv-3987f2d26039fb6a7377073ed4d77c8dd208cda9.tar.bz2 mpv-3987f2d26039fb6a7377073ed4d77c8dd208cda9.tar.xz |
Fix for gcc 4 and strict-aliasing. Patch by Uoti A Urpala ( urpala () cc ! helsinki ! fi ).
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@15960 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux/ebml.c')
-rw-r--r-- | libmpdemux/ebml.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/libmpdemux/ebml.c b/libmpdemux/ebml.c index 56664a2ded..952a3894a5 100644 --- a/libmpdemux/ebml.c +++ b/libmpdemux/ebml.c @@ -175,30 +175,26 @@ ebml_read_float (stream_t *s, uint64_t *length) { case 4: { - uint32_t i; - float *f; - i = stream_read_dword (s); - f = (float *) (void *) &i; - value = *f; + union {uint32_t i; float f;} u; + u.i = stream_read_dword (s); + value = u.f; break; } case 8: { - uint64_t i; - double *d; - i = stream_read_qword (s); - d = (double *) (void *) &i; - value = *d; + union {uint64_t i; double d;} u; + u.i = stream_read_qword (s); + value = u.d; break; } case 10: { - uint8_t data[10]; - if (stream_read (s, data, 10) != 10) + union {uint8_t data[10]; long double ld;} u; + if (stream_read (s, u.data, 10) != 10) return EBML_FLOAT_INVALID; - value = * (long double *) data; + value = u.ld; break; } |