[Ffmpeg-cvslog] r6251 - in trunk: libavcodec/utils.c libavformat/utils.c

Måns Rullgård mru
Thu Sep 14 18:40:04 CEST 2006


Rich Felker said:
> On Thu, Sep 14, 2006 at 04:48:48PM +0100, M?ns Rullg?rd wrote:
>>
>> Rich Felker said:
>> > On Thu, Sep 14, 2006 at 03:51:55PM +0200, takis wrote:
>> >> Author: takis
>> >> Date: Thu Sep 14 15:51:54 2006
>> >> New Revision: 6251
>> >>
>> >> Modified:
>> >>    trunk/libavcodec/utils.c
>> >>    trunk/libavformat/utils.c
>> >>
>> >> Log:
>> >> Make OFFSET() reuse offsetof
>> >>
>> >>
>> >> Modified: trunk/libavcodec/utils.c
>> >> ========================================================================
>> >> --- trunk/libavcodec/utils.c	(original)
>> >> +++ trunk/libavcodec/utils.c	Thu Sep 14 15:51:54 2006
>> >> @@ -438,7 +438,7 @@
>> >>          return "NULL";
>> >>  }
>> >>
>> >> -#define OFFSET(x) (int)&((AVCodecContext*)0)->x
>> >> +#define OFFSET(x) offsetof(AVCodecContext,x)
>> >
>> > Just so you know, offsetof returns size_t which is _unsigned_. It's
>> > somewhat unlikely this will break any code using the OFFSET macro, but
>> > not entirely impossible...
>>
>> That cast to int was wrong in the first place.  The offset of a struct
>> member from the start of a struct has to be non-negative.
>
> Yes but when used in expressions, an unsigned int will force the
> result of the whole expression to be unsigned... That was my point.

That macro is only used to fill in some AVOption fields.  It can't possibly
matter if it's signed or not.  Point taken though.

-- 
M?ns Rullg?rd
mru at inprovide.com




More information about the ffmpeg-cvslog mailing list