[FFmpeg-cvslog] r11803 - in trunk: ffmpeg.c ffserver.c

Reimar Döffinger Reimar.Doeffinger
Sun Feb 3 00:04:56 CET 2008


Hello,
On Sat, Feb 02, 2008 at 11:41:56PM +0100, Michael Niedermayer wrote:
> On Sat, Feb 02, 2008 at 09:07:05AM +0100, Reimar D?ffinger wrote:
> > On Sat, Feb 02, 2008 at 01:54:37AM +0100, aurel wrote:
> > > Author: aurel
> > > Date: Sat Feb  2 01:54:37 2008
> > > New Revision: 11803
> > > 
> > > Log:
> > > non-const 2nd parameter for strtol/strtod
> > > 
> > > Modified:
> > >    trunk/ffmpeg.c
> > >    trunk/ffserver.c
> > > 
> > > Modified: trunk/ffmpeg.c
> > > ==============================================================================
> > > --- trunk/ffmpeg.c	(original)
> > > +++ trunk/ffmpeg.c	Sat Feb  2 01:54:37 2008
> > > @@ -2396,16 +2396,17 @@ static void opt_frame_aspect_ratio(const
> > >      int x = 0, y = 0;
> > >      double ar = 0;
> > >      const char *p;
> > > +    char *end;
> > >  
> > >      p = strchr(arg, ':');
> > >      if (p) {
> > > -        x = strtol(arg, (char **)&arg, 10);
> > > -        if (arg == p)
> > > -            y = strtol(arg+1, (char **)&arg, 10);
> > > +        x = strtol(arg, &end, 10);
> > > +        if (end == p)
> > > +            y = strtol(end+1, &end, 10);
> > 
> > While this maybe avoids a warning, I do not really like it, since the
> > thing that "end" points to is supposed to be constant.
> 
> How do you suggest to fix it?

Hmm.. Well, ignoring the warning is a possibility.
Then also possible is
> x = strtol(arg, &end, 10);
> arg = end;
> if (arg == p)

etc. at least reducing the risk.
Then we could also add a av_const_strtol or some such that uses the
right arguments.
Given the number of places where this is an issue this might actually
make sense...

Greetings,
Reimar D?ffinger




More information about the ffmpeg-cvslog mailing list