[MPlayer-dev-eng] [PATCH] fix SAMI parsing

Reimar Döffinger Reimar.Doeffinger at gmx.de
Wed Jun 9 20:02:50 CEST 2010


On Tue, Jun 08, 2010 at 10:55:08PM -0700, Howard Chu wrote:
> >Either way it seems obvious that is a non-productive way of attacking
> >our disagreement.
> >You have seen my proposal.
> >It IMO has at very least the advantage of being future-proof: If other
> >cases are added you don't have to take care to always read as much data
> >from s as you write to d, instead you just have to make sure you never write
> >more that 7 values.
> >This seems to me much easier to ensure.
> >In addition I think the check itself is more obvious than the memchr for '-'.
> >That it eliminates the need to assuming things about strtoul is also a bonus.
> >Do you disagree with those? Or do you have some other reason why you prefer
> >to do it the way you proposed?
> 
> +	    else if (!strncmp (s, "&#", 2)) {
> +		uint32_t c;
> +		uint8_t tmp;
> +		q = s+2;
> +		c = strtoul(q, &s, 0);
> +		if (c <= 0x7fffffff) PUT_UTF8(c, tmp, *p++ = tmp;)
> +		if (*s == ';') s++; }

So be pedantic, this assumes long is >= 32 bit and two's complement
(admittedly only few of the codecs will work out-of-the-box
if these are not given).
And certainly doesn't answer my question as to the "why".



More information about the MPlayer-dev-eng mailing list