diff options
author | Nicolas George <nicolas.george@normalesup.org> | 2012-11-10 13:03:09 +0100 |
---|---|---|
committer | Nicolas George <nicolas.george@normalesup.org> | 2012-11-16 10:36:45 +0100 |
commit | 926481078b4f930ac9bb9ca2b4ab660cc9190935 (patch) | |
tree | 3e8572aa79c486e7ee9befbbcf8f8569c5846ccf /libavutil | |
parent | 468781f8287b7bca8c560915a6f1ec6f37cfd4bd (diff) | |
download | ffmpeg-926481078b4f930ac9bb9ca2b4ab660cc9190935.tar.gz |
lavu/opt: fix av_opt_get_key_value() API.
Do not skip the end delimiter.
Reserve positive return values.
This is an API break, but the function was introduced less than
two weeks ago.
Diffstat (limited to 'libavutil')
-rw-r--r-- | libavutil/opt.c | 4 | ||||
-rw-r--r-- | libavutil/opt.h | 7 | ||||
-rw-r--r-- | libavutil/version.h | 2 |
3 files changed, 7 insertions, 6 deletions
diff --git a/libavutil/opt.c b/libavutil/opt.c index 05ae8645f3..7a7f8930c8 100644 --- a/libavutil/opt.c +++ b/libavutil/opt.c @@ -870,8 +870,6 @@ int av_opt_get_key_value(const char **ropts, av_free(key); return AVERROR(ENOMEM); } - if (*opts && strchr(pairs_sep, *opts)) - opts++; *ropts = opts; *rkey = key; *rval = val; @@ -904,6 +902,8 @@ int av_opt_set_from_string(void *ctx, const char *opts, av_err2str(ret)); return ret; } + if (*opts) + opts++; if (parsed_key) { key = parsed_key; while (*shorthand) /* discard all remaining shorthand */ diff --git a/libavutil/opt.h b/libavutil/opt.h index 4a3b7f513a..1a8a4a2216 100644 --- a/libavutil/opt.h +++ b/libavutil/opt.h @@ -459,7 +459,8 @@ int av_opt_set_dict(void *obj, struct AVDictionary **options); * Extract a key-value pair from the beginning of a string. * * @param ropts pointer to the options string, will be updated to - * point to the rest of the string + * point to the rest of the string (one of the pairs_sep + * or the final NUL) * @param key_val_sep a 0-terminated list of characters used to separate * key from value, for example '=' * @param pairs_sep a 0-terminated list of characters used to separate @@ -468,8 +469,8 @@ int av_opt_set_dict(void *obj, struct AVDictionary **options); * @param rkey parsed key; must be freed using av_free() * @param rval parsed value; must be freed using av_free() * - * @return 0 for success, or a negative value corresponding to an AVERROR - * code in case of error; in particular: + * @return >=0 for success, or a negative value corresponding to an + * AVERROR code in case of error; in particular: * AVERROR(EINVAL) if no key is present * */ diff --git a/libavutil/version.h b/libavutil/version.h index 691e8ab1fb..67a0b7c783 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -75,7 +75,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 52 -#define LIBAVUTIL_VERSION_MINOR 6 +#define LIBAVUTIL_VERSION_MINOR 7 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ |