From 46129b40446a802b0b5da4797709f552b68b48f5 Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Mon, 2 Apr 2018 22:09:59 +0200 Subject: avformat/rmdec: make use of avio_get_str() Also do not set empty metadata. Signed-off-by: Paul B Mahol --- libavformat/rmdec.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'libavformat') diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c index fea71a2fc9..ac61723c66 100644 --- a/libavformat/rmdec.c +++ b/libavformat/rmdec.c @@ -70,16 +70,10 @@ static int rm_read_close(AVFormatContext *s); static inline void get_strl(AVIOContext *pb, char *buf, int buf_size, int len) { - int i; - char *q, r; + int read = avio_get_str(pb, len, buf, buf_size); - q = buf; - for(i=0;i 0) *q = '\0'; + if (read > 0) + avio_skip(pb, len - read); } static void get_str8(AVIOContext *pb, char *buf, int buf_size) @@ -105,8 +99,10 @@ static void rm_read_metadata(AVFormatContext *s, AVIOContext *pb, int wide) for (i=0; imetadata, ff_rm_metadata[i], buf, 0); + if (len > 0) { + get_strl(pb, buf, sizeof(buf), len); + av_dict_set(&s->metadata, ff_rm_metadata[i], buf, 0); + } } } -- cgit v1.2.3