Web lists-archives.com

[MPlayer-dev-eng] [patch] change long to intptr_t




The attached patch gets rid of a slew of warnings when compiling for Windows 64-bit, where a long is only 4 bytes.

In file included from m_option.c:1425:0:
m_option.c: In function 'find_obj_desc':
m_struct.h:65:36: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     ((void *)((char *)(struct_p) + (unsigned long)(struct_offset)))
                                    ^
m_struct.h:74:22: note: in expansion of macro 'M_ST_MB_P'
     (*(member_type*) M_ST_MB_P ((struct_p), (struct_offset)))
                      ^
m_option.c:1435:9: note: in expansion of macro 'M_ST_MB'
     n = M_ST_MB(char*,l->list[i],l->name_off);
         ^
m_struct.h:65:36: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     ((void *)((char *)(struct_p) + (unsigned long)(struct_offset)))
                                    ^
m_struct.h:74:22: note: in expansion of macro 'M_ST_MB_P'
     (*(member_type*) M_ST_MB_P ((struct_p), (struct_offset)))
                      ^

Index: m_struct.h
===================================================================
--- m_struct.h	(revision 37278)
+++ m_struct.h	(working copy)
@@ -62,7 +62,7 @@
  *  \return Pointer to the struct field.
  */
 #define M_ST_MB_P(struct_p, struct_offset)   \
-    ((void *)((char *)(struct_p) + (unsigned long)(struct_offset)))
+    ((void *)((char *)(struct_p) + (intptr_t)(struct_offset)))
 
 /// Access a struct field at a given offset.
 /** \param member_type Type of the field.
_______________________________________________
MPlayer-dev-eng mailing list
MPlayer-dev-eng@xxxxxxxxxxxx
https://lists.mplayerhq.hu/mailman/listinfo/mplayer-dev-eng