SOURCES: doomlegacy-c.patch (NEW) - lvalue fixes (needed for gcc 4)

qboosh qboosh at pld-linux.org
Mon Oct 23 16:53:58 CEST 2006


Author: qboosh                       Date: Mon Oct 23 14:53:58 2006 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- lvalue fixes (needed for gcc 4)

---- Files affected:
SOURCES:
   doomlegacy-c.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/doomlegacy-c.patch
diff -u /dev/null SOURCES/doomlegacy-c.patch:1.1
--- /dev/null	Mon Oct 23 16:53:58 2006
+++ SOURCES/doomlegacy-c.patch	Mon Oct 23 16:53:53 2006
@@ -0,0 +1,53 @@
+--- doomlegacy-1.42/doomlegacy_142_src/byteptr.h.orig	2004-04-18 23:02:24.000000000 +0200
++++ doomlegacy-1.42/doomlegacy_142_src/byteptr.h	2006-10-23 15:52:23.770159250 +0200
+@@ -36,30 +36,30 @@
+ //
+ // Little-endian machines
+ //
+-#define writeshort(p,b)     *(short*)  (p)   = b
+-#define writelong(p,b)      *(long *)  (p)   = b
+-#define WRITEBYTE(p,b)      *((byte   *)p)++ = b
+-#define WRITECHAR(p,b)      *((char   *)p)++ = b
+-#define WRITESHORT(p,b)     *((short  *)p)++ = b
+-#define WRITEUSHORT(p,b)    *((USHORT *)p)++ = b
+-#define WRITELONG(p,b)      *((long   *)p)++ = b
+-#define WRITEULONG(p,b)     *((ULONG  *)p)++ = b
+-#define WRITEFIXED(p,b)     *((fixed_t*)p)++ = b
+-#define WRITEANGLE(p,b)     *((angle_t*)p)++ = b
++#define writeshort(p,b)     ({ short tmp = b; memcpy(p, &tmp, sizeof(short)); tmp; })
++#define writelong(p,b)      ({ long tmp = b; memcpy(p, &tmp, sizeof(long)); tmp; })
++#define WRITEBYTE(p,b)      ({ byte tmp = b; memcpy(p, &tmp, sizeof(byte)); p+=sizeof(byte); tmp; })
++#define WRITECHAR(p,b)      ({ char tmp = b; memcpy(p, &tmp, sizeof(char)); p+=sizeof(char); tmp; })
++#define WRITESHORT(p,b)     ({ short tmp = b; memcpy(p, &tmp, sizeof(short)); p+=sizeof(short); tmp; })
++#define WRITEUSHORT(p,b)    ({ USHORT tmp = b; memcpy(p, &tmp, sizeof(USHORT)); p+=sizeof(USHORT); tmp; })
++#define WRITELONG(p,b)      ({ long tmp = b; memcpy(p, &tmp, sizeof(long)); p+=sizeof(long); tmp; })
++#define WRITEULONG(p,b)     ({ ULONG tmp = b; memcpy(p, &tmp, sizeof(ULONG)); p+=sizeof(ULONG); tmp; })
++#define WRITEFIXED(p,b)     ({ fixed_t tmp = b; memcpy(p, &tmp, sizeof(fixed_t)); p+=sizeof(fixed_t); tmp; })
++#define WRITEANGLE(p,b)     ({ angle_t tmp = b; memcpy(p, &tmp, sizeof(angle_t)); p+=sizeof(angle_t); tmp; })
+ #define WRITESTRING(p,b)    { int tmp_i=0; do { WRITECHAR(p,b[tmp_i]); } while(b[tmp_i++]); }
+ #define WRITESTRINGN(p,b,n) { int tmp_i=0; do { WRITECHAR(p,b[tmp_i]); if(!b[tmp_i]) break;tmp_i++; } while(tmp_i<n); }
+ #define WRITEMEM(p,s,n)     memcpy(p, s, n);p+=n
+ 
+-#define readshort(p)	    *((short  *)p)
+-#define readlong(p)	    *((long   *)p)
+-#define READBYTE(p)         *((byte   *)p)++
+-#define READCHAR(p)         *((char   *)p)++
+-#define READSHORT(p)        *((short  *)p)++
+-#define READUSHORT(p)       *((USHORT *)p)++
+-#define READLONG(p)         *((long   *)p)++
+-#define READULONG(p)        *((ULONG  *)p)++
+-#define READFIXED(p)        *((fixed_t*)p)++
+-#define READANGLE(p)        *((angle_t*)p)++
++#define readshort(p)	    ({ short tmp; memcpy(&tmp, p, sizeof(short)); tmp; })
++#define readlong(p)	    ({ long tmp; memcpy(&tmp, p, sizeof(long)); tmp; })
++#define READBYTE(p)         ({ byte tmp; memcpy(&tmp, p, sizeof(byte)); p+=sizeof(byte); tmp; })
++#define READCHAR(p)         ({ char tmp; memcpy(&tmp, p, sizeof(char)); p+=sizeof(char); tmp; })
++#define READSHORT(p)        ({ short tmp; memcpy(&tmp, p, sizeof(short)); p+=sizeof(short); tmp; })
++#define READUSHORT(p)       ({ USHORT tmp; memcpy(&tmp, p, sizeof(USHORT)); p+=sizeof(USHORT); tmp; })
++#define READLONG(p)         ({ long tmp; memcpy(&tmp, p, sizeof(long)); p+=sizeof(long); tmp; })
++#define READULONG(p)        ({ ULONG tmp; memcpy(&tmp, p, sizeof(ULONG)); p+=sizeof(ULONG); tmp; })
++#define READFIXED(p)        ({ fixed_t tmp; memcpy(&tmp, p, sizeof(fixed_t)); p+=sizeof(fixed_t); tmp; })
++#define READANGLE(p)        ({ angle_t tmp; memcpy(&tmp, p, sizeof(angle_t)); p+=sizeof(angle_t); tmp; })
+ #define READSTRING(p,s)     { int tmp_i=0; do { s[tmp_i]=READBYTE(p);  } while(s[tmp_i++]); }
+ #define SKIPSTRING(p)       while(READBYTE(p))
+ #define READMEM(p,s,n)      memcpy(s, p, n);p+=n
================================================================


More information about the pld-cvs-commit mailing list