[MPlayer-dev-eng] [PATCH] silence a warning in stream_dvd.c

Diego Biurrun diego at biurrun.de
Sat Jul 31 23:53:07 CEST 2010


On Sat, Jul 31, 2010 at 06:59:25PM +0200, Reimar Döffinger wrote:
> On Sat, Jul 31, 2010 at 06:53:20PM +0200, Diego Biurrun wrote:
> > This patch casts a strtol argument to silence the warning:
> > 
> > stream/stream_dvd.c:98: warning: passing argument 2 of 'strtol' from incompatible pointer type
> > 
> > Nico wants me to send a patch first - any objections or better
> > suggestions?
> 
> Not sure about better, it is a bit far on the obfuscation side, but
> below is possible:
> --- stream/stream_dvd.c (revision 31876)
> +++ stream/stream_dvd.c (working copy)
> @@ -93,7 +93,9 @@
>    dvd_chapter = 1;
>    dvd_last_chapter = 0;
>    if(*range && isdigit(*range)) {
> -    dvd_chapter = strtol(range, &s, 10);
> +    char *end;
> +    dvd_chapter = strtol(range, &end, 10);
> +    s += end - s;

OK, I understand what this does now, but I agree it's a tad bit
obfuscated.  I prefer the cast or keeping the warning.  With the
cast the intention of working around the warning is quite clear.
With your assignment I would keep wondering why it's done that
way...

Diego


More information about the MPlayer-dev-eng mailing list