[FFmpeg-devel] [PATCH] parseutils: add av_parse_number() function and children, and use them in the ff* tools

Michael Niedermayer michaelni at gmx.at
Fri May 27 15:04:04 CEST 2011


On Tue, May 24, 2011 at 08:19:37PM +0200, Stefano Sabatini wrote:
[...]
> +int av_parse_int64(int64_t *res, const char *numstr, int64_t min, int64_t max, int log_offset, void *log_ctx)
> +{
> +    double d;
> +    int ret = av_parse_number(&d, numstr, AV_PARSE_NUM_TYPE_INT64, min, max, log_offset, log_ctx);
> +    if (ret < 0)
> +        return ret;
> +    *res = d;
> +    return 0;
> +}

well, as you ask, i can only think of the minor compactification below,
but that can as well be ignored, the code is fine as it is

int av_parse_int64(int64_t *res, const char *numstr, int64_t min, int64_t max, int log_offset, void *log_ctx)
{
    double d;
    int ret = av_parse_number(&d, numstr, AV_PARSE_NUM_TYPE_INT64, min, max, log_offset, log_ctx);
    if (ret >= 0)
        *res = d;
    return ret;
}
 or
int av_parse_int64(int64_t *res, const char *numstr, int64_t min, int64_t max, int log_offset, void *log_ctx)
{
    double d = NAN;
    int ret = av_parse_number(&d, numstr, AV_PARSE_NUM_TYPE_INT64, min, max, log_offset, log_ctx);
    *res = d;
    return ret;
}


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

In a rich man's house there is no place to spit but his face.
-- Diogenes of Sinope
-------------- 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/20110527/1576b799/attachment.asc>


More information about the ffmpeg-devel mailing list