[MPlayer-cvslog] r29492 - trunk/codec-cfg.c

Uoti Urpala uoti.urpala at pp1.inet.fi
Tue Aug 11 21:04:40 CEST 2009

On Tue, 2009-08-11 at 20:21 +0200, reimar wrote:
> Explain how formats must be ordered in fmt_list so the parser can handle
> names where one matches the beginning of another.

> +		// note: due to parser deficiencies/simplicity, if one format
> +		// name matches the beginning of another, the longer one _must_
> +		// come first in this list.

I think that's rather cumbersome. Wouldn't fixing the parser be better?
Something like
            for (j = 0; fmt_table[j].name != NULL; j++) {
                int fmtlen = strlen(fmt_table[j].name);
                if (!strncmp(sfmt, fmt_table[j].name, fmtlen)
                    && sfmt[fmtlen] == 0 || sfmt[fmtlen] == ',')

should work if I understood the expected logic correctly. It's somewhat
more complex than the original but if you need a comment explaining the
limitations otherwise then I think it's better.

More information about the MPlayer-cvslog mailing list