[FFmpeg-devel] [PATCH] tools: add ffeval tool

Michael Niedermayer michaelni at gmx.at
Mon Jan 16 00:26:56 CET 2012


On Sun, Jan 15, 2012 at 11:12:02PM +0100, Stefano Sabatini wrote:
> The tool is useful for testing the internal arithmetic evaluation engine
> (indeed I plan to use it in FATE), and provides an handy calculator when
> you can't rely on bc ;-).

[...]

> +    while ((c = fgetc(infile)) != EOF) {
> +        if (c == '\n') {
> +            double d;
> +
> +            buf[count] = 0;
> +            if (buf[0] != '#') {
> +                av_expr_parse_and_eval(&d, buf,
> +                                       NULL, NULL,
> +                                       NULL, NULL, NULL, NULL, NULL, 0, NULL);
> +                if (echo)
> +                    fprintf(outfile, "%s ", buf);
> +                fprintf(outfile, "%s%f\n", prompt, d);
> +            }
> +            count = 0;
> +        } else {
> +            if (count >= buf_size-1) {
> +                buf = av_realloc_f(buf, buf_size, 2);
> +                if (!buf) {
> +                    av_log(NULL, AV_LOG_ERROR, "Memory allocation problem occurred\n");
> +                    return 1;
> +                }

this seems to be missing code to update buf_size and the 2 looks a bit
odd

LGTM otherwise


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

During times of universal deceit, telling the truth becomes a
revolutionary act. -- George Orwell
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120116/bed1aae0/attachment.asc>


More information about the ffmpeg-devel mailing list