ref: 1f169e7f213754baab2ec46564a190a0a8852eca
parent: fc3e5de1a1d68b686f6369aeedcfa0be45e2a294
author: Timothy B. Terriberry <tterribe@xiph.org>
date: Mon Mar 3 04:06:58 EST 2014
Fix opus_tags_add() and opus_tags_add_comment(). It helps to increment the comment count. Thanks to lithopsian for the report.
--- a/src/info.c
+++ b/src/info.c
@@ -261,10 +261,11 @@
_tags->user_comments[ncomments]=comment=
(char *)_ogg_malloc(sizeof(*comment)*(tag_len+value_len+2));
if(OP_UNLIKELY(comment==NULL))return OP_EFAULT;
- _tags->comment_lengths[ncomments]=tag_len+value_len+1;
memcpy(comment,_tag,sizeof(*comment)*tag_len);
comment[tag_len]='=';
memcpy(comment+tag_len+1,_value,sizeof(*comment)*(value_len+1));
+ _tags->comment_lengths[ncomments]=tag_len+value_len+1;
+ _tags->comments=ncomments+1;
return 0;
}
@@ -280,6 +281,7 @@
_tags->user_comments[ncomments]=op_strdup_with_len(_comment,comment_len);
if(OP_UNLIKELY(_tags->user_comments[ncomments]==NULL))return OP_EFAULT;
_tags->comment_lengths[ncomments]=comment_len;
+ _tags->comments=ncomments+1;
return 0;
}