changeset 8957:36a5cdca733b

bunkus: Encapsulated arguments to #define in ( ... ) so that the #defines can be safely used like functions: mydef(flag ? val1 : val2)
author mosu
date Wed, 15 Jan 2003 11:16:33 +0000
parents 9787abc8039e
children 56bf90cefb10
files Gui/wm/ws.h Gui/wm/wsxdnd.h drivers/radeon/radeon_vid.h libaf/af.h libaf/af_mp.h libaf/af_resample.h libaf/filter.h libmpcodecs/img_format.h libmpdemux/asf.h libmpeg2/attributes.h mp_msg.h vidix/drivers/cyberblade_regs.h vidix/drivers/pm3_regs.h
diffstat 13 files changed, 32 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/Gui/wm/ws.h	Wed Jan 15 09:50:44 2003 +0000
+++ b/Gui/wm/ws.h	Wed Jan 15 11:16:33 2003 +0000
@@ -254,7 +254,7 @@
 extern void wsScreenSaverOn( Display *mDisplay );
 extern void wsScreenSaverOff( Display * mDisplay );
 
-#define wgIsRect( X,Y,tX,tY,bX,bY ) ( ( X > tX )&&( Y > tY )&&( X < bX )&&( Y < bY ) )
+#define wgIsRect( X,Y,tX,tY,bX,bY ) ( ( (X) > (tX) )&&( (Y) > (tY) )&&( (X) < (bX) )&&( (Y) < (bY) ) )
 
 #endif
 
--- a/Gui/wm/wsxdnd.h	Wed Jan 15 09:50:44 2003 +0000
+++ b/Gui/wm/wsxdnd.h	Wed Jan 15 11:16:33 2003 +0000
@@ -17,7 +17,7 @@
 #define XDND_ENTER_THREE_TYPES_SET(e,b)	(e)->xclient.data.l[1] = ((e)->xclient.data.l[1] & ~0x1UL) | (((b) == 0) ? 0 : 0x1UL)
 #define XDND_ENTER_VERSION(e)		((e)->xclient.data.l[1] >> 24)
 #define XDND_ENTER_VERSION_SET(e,v)	(e)->xclient.data.l[1] = ((e)->xclient.data.l[1] & ~(0xFF << 24)) | ((v) << 24)
-#define XDND_ENTER_TYPE(e,i)		((e)->xclient.data.l[2 + i])	/* i => (0, 1, 2) */
+#define XDND_ENTER_TYPE(e,i)		((e)->xclient.data.l[2 + (i)])	/* i => (0, 1, 2) */
 
 /* XdndPosition */
 #define XDND_POSITION_SOURCE_WIN(e)	((e)->xclient.data.l[0])
--- a/drivers/radeon/radeon_vid.h	Wed Jan 15 09:50:44 2003 +0000
+++ b/drivers/radeon/radeon_vid.h	Wed Jan 15 11:16:33 2003 +0000
@@ -52,11 +52,11 @@
 #define IMGFMT_BGR24 (IMGFMT_BGR|24)
 #define IMGFMT_BGR32 (IMGFMT_BGR|32)
 
-#define IMGFMT_IS_RGB(fmt) ((fmt&IMGFMT_RGB_MASK)==IMGFMT_RGB)
-#define IMGFMT_IS_BGR(fmt) ((fmt&IMGFMT_BGR_MASK)==IMGFMT_BGR)
+#define IMGFMT_IS_RGB(fmt) (((fmt)&IMGFMT_RGB_MASK)==IMGFMT_RGB)
+#define IMGFMT_IS_BGR(fmt) (((fmt)&IMGFMT_BGR_MASK)==IMGFMT_BGR)
 
-#define IMGFMT_RGB_DEPTH(fmt) (fmt&~IMGFMT_RGB)
-#define IMGFMT_BGR_DEPTH(fmt) (fmt&~IMGFMT_BGR)
+#define IMGFMT_RGB_DEPTH(fmt) ((fmt)&~IMGFMT_RGB)
+#define IMGFMT_BGR_DEPTH(fmt) ((fmt)&~IMGFMT_BGR)
 
 
 /* Planar YUV Formats */
--- a/libaf/af.h	Wed Jan 15 09:50:44 2003 +0000
+++ b/libaf/af.h	Wed Jan 15 11:16:33 2003 +0000
@@ -247,8 +247,8 @@
 /* Macro for printing error messages */
 #ifndef af_msg
 #define af_msg(lev, args... ) \
-((lev<AF_MSG_WARN)?(fprintf(af_msg_cfg.err?af_msg_cfg.err:stderr, ## args )): \
-((lev<=af_msg_cfg.level)?(fprintf(af_msg_cfg.msg?af_msg_cfg.msg:stdout, ## args )):0))
+(((lev)<AF_MSG_WARN)?(fprintf(af_msg_cfg.err?af_msg_cfg.err:stderr, ## args )): \
+(((lev)<=af_msg_cfg.level)?(fprintf(af_msg_cfg.msg?af_msg_cfg.msg:stdout, ## args )):0))
 #endif
 
 #endif /* __aop_h__ */
--- a/libaf/af_mp.h	Wed Jan 15 09:50:44 2003 +0000
+++ b/libaf/af_mp.h	Wed Jan 15 11:16:33 2003 +0000
@@ -18,7 +18,7 @@
 #undef af_msg
 #endif
 #define af_msg(lev, args... ) \
-  mp_msg(MSGT_AFILTER,((lev<0)?(lev+3):((lev==0)?MSGL_INFO:(lev+5))), ##args )
+  mp_msg(MSGT_AFILTER,(((lev)<0)?((lev)+3):(((lev)==0)?MSGL_INFO:((lev)+5))), ##args )
 
 /* Decodes the format from mplayer format to libaf format */
 extern int af_format_decode(int format);
--- a/libaf/af_resample.h	Wed Jan 15 09:50:44 2003 +0000
+++ b/libaf/af_resample.h	Wed Jan 15 11:16:33 2003 +0000
@@ -66,8 +66,8 @@
 
 // Macro to add data to circular que 
 #define ADDQUE(xi,xq,in)\
-  xq[xi]=xq[xi+L]=(*in);\
-  xi=(xi-1)&(L-1);
+  xq[xi]=xq[(xi)+L]=*(in);\
+  xi=((xi)-1)&(L-1);
 
 #if defined(UP)
 
--- a/libaf/filter.h	Wed Jan 15 09:50:44 2003 +0000
+++ b/libaf/filter.h	Wed Jan 15 11:16:33 2003 +0000
@@ -63,7 +63,7 @@
    long. 
 */
 #define updateq(n,xi,xq,in)\
-  xq[xi]=xq[xi+n]=*in;\
-  xi=(++xi)&(n-1);
+  xq[xi]=(xq)[(xi)+(n)]=*(in);\
+  xi=(++(xi))&((n)-1);
 
 #endif
--- a/libmpcodecs/img_format.h	Wed Jan 15 09:50:44 2003 +0000
+++ b/libmpcodecs/img_format.h	Wed Jan 15 11:16:33 2003 +0000
@@ -24,11 +24,11 @@
 #define IMGFMT_BGR24 (IMGFMT_BGR|24)
 #define IMGFMT_BGR32 (IMGFMT_BGR|32)
 
-#define IMGFMT_IS_RGB(fmt) ((fmt&IMGFMT_RGB_MASK)==IMGFMT_RGB)
-#define IMGFMT_IS_BGR(fmt) ((fmt&IMGFMT_BGR_MASK)==IMGFMT_BGR)
+#define IMGFMT_IS_RGB(fmt) (((fmt)&IMGFMT_RGB_MASK)==IMGFMT_RGB)
+#define IMGFMT_IS_BGR(fmt) (((fmt)&IMGFMT_BGR_MASK)==IMGFMT_BGR)
 
-#define IMGFMT_RGB_DEPTH(fmt) (fmt&~IMGFMT_RGB)
-#define IMGFMT_BGR_DEPTH(fmt) (fmt&~IMGFMT_BGR)
+#define IMGFMT_RGB_DEPTH(fmt) ((fmt)&~IMGFMT_RGB)
+#define IMGFMT_BGR_DEPTH(fmt) ((fmt)&~IMGFMT_BGR)
 
 
 /* Planar YUV Formats */
--- a/libmpdemux/asf.h	Wed Jan 15 09:50:44 2003 +0000
+++ b/libmpdemux/asf.h	Wed Jan 15 11:16:33 2003 +0000
@@ -6,7 +6,7 @@
 #include "bswap.h"
 
 #ifndef MIN
-#define MIN(a,b) ((a<b)?a:b)
+#define MIN(a,b) (((a)<(b))?(a):(b))
 #endif
 
 ///////////////////////
--- a/libmpeg2/attributes.h	Wed Jan 15 09:50:44 2003 +0000
+++ b/libmpeg2/attributes.h	Wed Jan 15 11:16:33 2003 +0000
@@ -21,7 +21,7 @@
 
 /* use gcc attribs to align critical data structures */
 #ifdef ATTRIBUTE_ALIGNED_MAX
-#define ATTR_ALIGN(align) __attribute__ ((__aligned__ ((ATTRIBUTE_ALIGNED_MAX < align) ? ATTRIBUTE_ALIGNED_MAX : align)))
+#define ATTR_ALIGN(align) __attribute__ ((__aligned__ ((ATTRIBUTE_ALIGNED_MAX < (align)) ? ATTRIBUTE_ALIGNED_MAX : (align))))
 #else
 #define ATTR_ALIGN(align)
 #endif
--- a/mp_msg.h	Wed Jan 15 09:50:44 2003 +0000
+++ b/mp_msg.h	Wed Jan 15 11:16:33 2003 +0000
@@ -93,7 +93,7 @@
 
 #ifdef TARGET_OS2
 // va_start/vsnprintf seems to be broken under OS2 :(
-#define mp_msg(mod,lev, fmt, args... ) do{if(lev<=mp_msg_levels[mod]) printf( fmt, ## args );}while(0)
+#define mp_msg(mod,lev, fmt, args... ) do{if((lev)<=mp_msg_levels[mod]) printf( fmt, ## args );}while(0)
 #define mp_dbg(mod,lev, args... ) 
 #else
 
@@ -108,19 +108,19 @@
 void mp_msg_c( int x, const char *format, ... );
 
 #ifdef __GNUC__
-#define mp_msg(mod,lev, args... ) mp_msg_c((mod<<8)|lev, ## args )
+#define mp_msg(mod,lev, args... ) mp_msg_c(((mod)<<8)|(lev), ## args )
 
 #ifdef MP_DEBUG
-#define mp_dbg(mod,lev, args... ) mp_msg_c((mod<<8)|lev, ## args )
+#define mp_dbg(mod,lev, args... ) mp_msg_c(((mod)<<8)|(lev), ## args )
 #else
 // these messages are only usefull for developers, disable them
 #define mp_dbg(mod,lev, args... ) 
 #endif
 #else // not GNU C
-#define mp_msg(mod,lev, ... ) mp_msg_c((mod<<8)|lev, __VA_ARGS__)
+#define mp_msg(mod,lev, ... ) mp_msg_c(((mod)<<8)|(lev), __VA_ARGS__)
 
 #ifdef MP_DEBUG
-#define mp_dbg(mod,lev, ... ) mp_msg_c((mod<<8)|lev, __VA_ARGS__)
+#define mp_dbg(mod,lev, ... ) mp_msg_c(((mod)<<8)|(lev), __VA_ARGS__)
 #else
 // these messages are only usefull for developers, disable them
 #define mp_dbg(mod,lev, ... ) 
--- a/vidix/drivers/cyberblade_regs.h	Wed Jan 15 09:50:44 2003 +0000
+++ b/vidix/drivers/cyberblade_regs.h	Wed Jan 15 11:16:33 2003 +0000
@@ -129,10 +129,10 @@
 
 int HACKBUCKET12345678;  /* Horrible hack to work around cache/speed issue */
 
-#define INB(addr) (HACKBUCKET12345678=*(cyberblade_reg_base+addr))
-#define INW(addr) (HACKBUCKET12345678=*(unsigned short *)(cyberblade_reg_base+addr))
-#define OUTB(addr,val) (*(cyberblade_reg_base+addr)=(val))
-#define OUTW(addr,val) (*(unsigned short *)(cyberblade_reg_base+addr)=(val))
+#define INB(addr) (HACKBUCKET12345678=*(cyberblade_reg_base+(addr)))
+#define INW(addr) (HACKBUCKET12345678=*(unsigned short *)(cyberblade_reg_base+(addr)))
+#define OUTB(addr,val) (*(cyberblade_reg_base+(addr))=(val))
+#define OUTW(addr,val) (*(unsigned short *)(cyberblade_reg_base+(addr))=(val))
 
 #define SRINB(reg) (OUTB(0x3c4,reg), INB(0x3c5))
 #define SROUTB(reg,val) (OUTW(0x3c4,((val)<<8)|(reg)))
--- a/vidix/drivers/pm3_regs.h	Wed Jan 15 09:50:44 2003 +0000
+++ b/vidix/drivers/pm3_regs.h	Wed Jan 15 11:16:33 2003 +0000
@@ -1060,10 +1060,10 @@
 extern void *pm3_reg_base;
 
 #define WRITE_REG(offset,val)				\
-    *(volatile unsigned long *)(((unsigned char *)(pm3_reg_base)) + offset) = (val)
+    *(volatile unsigned long *)(((unsigned char *)(pm3_reg_base)) + (offset)) = (val)
 	
 #define READ_REG(offset)					\
-    *(volatile unsigned long *)(((unsigned char *)(pm3_reg_base)) + offset)
+    *(volatile unsigned long *)(((unsigned char *)(pm3_reg_base)) + (offset))
 
 #define UPDATE_SET_REG(offset,val)				\
     {								\
@@ -1094,8 +1094,8 @@
 
 #define RAMDAC_SET_INDEX(index)					\
 {								\
-    SLOW_WRITE_REG (PM3RD_IndexHigh,(index>>8)&0xff);		\
-    SLOW_WRITE_REG (PM3RD_IndexLow,index&0xff);			\
+    SLOW_WRITE_REG (PM3RD_IndexHigh,((index)>>8)&0xff);		\
+    SLOW_WRITE_REG (PM3RD_IndexLow,(index)&0xff);			\
 }
 
 #define RAMDAC_SET_REG(index, data)				\