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

Måns Rullgård mru
Thu Sep 14 17:48:48 CEST 2006


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.

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




More information about the ffmpeg-cvslog mailing list