[FFmpeg-devel] [PATCH 1/2] lavu: add locale-independent sscanf implementation
Carl Eugen Hoyos
ceffmpeg at gmail.com
Mon Nov 12 13:42:25 EET 2018
2018-11-11 17:41 GMT+01:00, Paul B Mahol <onemda at gmail.com>:
> +static long long scanexp(FFFILE *f, int pok)
> +{
> + int c;
> + int x;
> + long long y;
> + int neg = 0;
> +
> + c = shgetc(f);
> + if (c=='+' || c=='-') {
> + neg = (c=='-');
> + c = shgetc(f);
> + if (c-'0'>=10U && pok) shunget(f);
> + }
> + if (c-'0'>=10U) {
> + shunget(f);
> + return LLONG_MIN;
> + }
> + for (x=0; c-'0'<10U && x<INT_MAX/10; c = shgetc(f))
> + x = 10*x + c-'0';
> + for (y=x; c-'0'<10U && y<LLONG_MAX/100; c = shgetc(f))
> + y = 10*y + c-'0';
> + for (; c-'0'<10U; c = shgetc(f));
> + shunget(f);
> + return neg ? -y : y;
> +}
Did you write this function?
The style looks a little unusual for FFmpeg...
Carl Eugen
More information about the ffmpeg-devel
mailing list