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

Rich Felker dalias
Thu Sep 14 18:06:19 CEST 2006


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.

Rich





More information about the ffmpeg-cvslog mailing list