On 16/02/12 16:45, Andrey Utkin wrote:
> ---
>  libavutil/dict.c |   35 +++++++++++++++++++++++++++++++++++
>  libavutil/dict.h |    7 +++++++
>  2 files changed, 42 insertions(+), 0 deletions(-)
> 
> diff --git a/libavutil/dict.c b/libavutil/dict.c
> index cb5f7b1..35c3229 100644
> --- a/libavutil/dict.c
> +++ b/libavutil/dict.c
> @@ -118,3 +118,38 @@ void av_dict_copy(AVDictionary **dst, AVDictionary *src, 
> int flags)
>      while ((t = av_dict_get(src, "", t, AV_DICT_IGNORE_SUFFIX)))
>          av_dict_set(dst, t->key, t->value, flags);
>  }
> +
> +int av_dict_from_string(const char *arg, AVDictionary **dict)

the destination should be first. (AVDictionary **dict, const char *arg)

> +{
> +    int ret = 0;
> +    char *opts;
> +    char *token_begin;
> +    char *token_end;
> +    char *value_ptr;
> +    if (!arg || !(*arg)) // empty string
> +        return 0;
> +    if (strlen(arg) < 3) // no room for at least 'a=b'
> +        return AVERROR(EINVAL);
> +    opts = av_strdup(arg);
> +    if (!opts)
> +        return AVERROR(ENOMEM);
> +    token_begin = opts;
> +    while ((token_end = strchr(token_begin + 3, ','))) {

why + 3 ? What happens when you feed  a=b,b=c vs a=b

lu

-- 

Luca Barbato
Gentoo/linux
http://dev.gentoo.org/~lu_zero

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to