diff --git a/libavcodec/utils.c b/libavcodec/utils.c index d2c09ca93eba9409263071091c205bf30c8a708b..3e41bd296204be45e9b7b67722a7292a58b5bec8 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -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 diff --git a/libavformat/utils.c b/libavformat/utils.c index b0171c0fb329b735758c8855adee75fb14f5ca36..6df8bfd7ed2add2e79d4412e1eec2e33668527bc 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -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