[FFmpeg-devel] [PATCH] XBM decoder

Reimar Döffinger Reimar.Doeffinger at gmx.de
Fri Mar 23 22:17:46 CET 2012


On Fri, Mar 23, 2012 at 08:58:16PM +0000, Paul B Mahol wrote:
> +static uint8_t hex_digits[128];

Please make it const and use designated initializers to set it up.

> +        ptr += strcspn(ptr, "\n") + 1;

Maybe also accept \r ?

> +    if ((ret = avctx->get_buffer(avctx, p)) < 0)

No idea if you are one of those who really prefer this way (if so
ignore), but IMO putting the assignment into the if serves no
purpose beyond making the code harder to read...

> +            if (ptr < end && isxdigit(*ptr)) {

I'd prefer it if the is* functions were never ever used,
who knows what they come up with to make even that depend
on locale settings.
Though I guess since you are already using sscanf it might
not really matter.
Though it might be simpler and faster to just not use
an array at all and instead just write out the cases...
Or alternatively make the array 256 bytes and give everything
that is not valid a special value.


More information about the ffmpeg-devel mailing list