[Mplayer-cvslog] CVS: main/libmpdemux demux_mov.c,1.74,1.75

Jürgen Keil jkeil at mplayerhq.hu
Mon Oct 7 18:43:26 CEST 2002


Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var/tmp.root/cvs-serv7060

Modified Files:
	demux_mov.c 
Log Message:
BE_16/BE_32 macro was accessing integers from unaligned addresses on SPARC

char2short/char2int broken on BIGENDIAN


Index: demux_mov.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_mov.c,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -r1.74 -r1.75
--- demux_mov.c	27 Sep 2002 20:33:09 -0000	1.74
+++ demux_mov.c	7 Oct 2002 16:43:04 -0000	1.75
@@ -47,17 +47,15 @@
 #include <fcntl.h>
 #endif
 
-#define BE_16(x) (be2me_16(*(unsigned short *)(x)))
-#define BE_32(x) (be2me_32(*(unsigned int *)(x)))
+#define BE_16(x) (((unsigned char *)(x))[0] <<  8 | \
+		  ((unsigned char *)(x))[1])
+#define BE_32(x) (((unsigned char *)(x))[0] << 24 | \
+		  ((unsigned char *)(x))[1] << 16 | \
+		  ((unsigned char *)(x))[2] <<  8 | \
+		  ((unsigned char *)(x))[3])
 
-#ifndef WORDS_BIGENDIAN
-#define char2short(x,y) ((x[y]<<8)|x[y+1])
-#define char2int(x,y) ((x[y]<<24)|(x[y+1]<<16)|(x[y+2]<<8)|x[y+3])
-#else
-#warning Check the implementation of char2short and char2int on BIGENDIAN!!!
-#define char2short(x,y) (x[y]|(x[y+1]<<8))
-#define char2int(x,y) (x[y]|(x[y+1]<<8)|(x[y+2]<<16)|(x[y+3]<<24))
-#endif
+#define char2short(x,y)	BE_16(&(x)[(y)])
+#define char2int(x,y) 	BE_32(&(x)[(y)])
 
 typedef struct {
     unsigned int pts; // duration




More information about the MPlayer-cvslog mailing list