OSDN Git Service

Make OFFSET() reuse offsetof
authorPanagiotis Issaris <takis.issaris@uhasselt.be>
Thu, 14 Sep 2006 13:51:54 +0000 (13:51 +0000)
committerPanagiotis Issaris <takis.issaris@uhasselt.be>
Thu, 14 Sep 2006 13:51:54 +0000 (13:51 +0000)
Originally committed as revision 6251 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/utils.c
libavformat/utils.c

index d2c09ca..3e41bd2 100644 (file)
@@ -438,7 +438,7 @@ static const char* context_to_name(void* ptr) {
         return "NULL";
 }
 
-#define OFFSET(x) (int)&((AVCodecContext*)0)->x
+#define OFFSET(x) offsetof(AVCodecContext,x)
 #define DEFAULT 0 //should be NAN but it doesnt work as its not a constant in glibc as required by ANSI/ISO C
 //these names are too long to be readable
 #define V AV_OPT_FLAG_VIDEO_PARAM
index b0171c0..6df8bfd 100644 (file)
@@ -458,7 +458,7 @@ static const char* format_to_name(void* ptr)
     else return "NULL";
 }
 
-#define OFFSET(x) (int)&((AVFormatContext*)0)->x
+#define OFFSET(x) offsetof(AVFormatContext,x)
 #define DEFAULT 0 //should be NAN but it doesnt work as its not a constant in glibc as required by ANSI/ISO C
 //these names are too long to be readable
 #define E AV_OPT_FLAG_ENCODING_PARAM