mirror of
https://github.com/claunia/flac.git
synced 2025-12-16 18:54:26 +00:00
fix bug in FLAC__metadata_object_vorbiscomment_replace_comment()
This commit is contained in:
@@ -1265,16 +1265,21 @@ FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_replace_comment(FLAC__St
|
|||||||
|
|
||||||
field_name_length = eq-entry.entry;
|
field_name_length = eq-entry.entry;
|
||||||
|
|
||||||
if((i = vorbiscomment_find_entry_from_(object, 0, (const char *)entry.entry, field_name_length)) >= 0) {
|
i = vorbiscomment_find_entry_from_(object, 0, (const char *)entry.entry, field_name_length);
|
||||||
|
if(i >= 0) {
|
||||||
unsigned index = (unsigned)i;
|
unsigned index = (unsigned)i;
|
||||||
if(!FLAC__metadata_object_vorbiscomment_set_comment(object, index, entry, copy))
|
if(!FLAC__metadata_object_vorbiscomment_set_comment(object, index, entry, copy))
|
||||||
return false;
|
return false;
|
||||||
if(all && (index+1 < object->data.vorbis_comment.num_comments)) {
|
entry = object->data.vorbis_comment.comments[index];
|
||||||
for(i = vorbiscomment_find_entry_from_(object, index+1, (const char *)entry.entry, field_name_length); i >= 0; ) {
|
index++; /* skip over replaced comment */
|
||||||
if(!FLAC__metadata_object_vorbiscomment_delete_comment(object, (unsigned)i))
|
if(all && index < object->data.vorbis_comment.num_comments) {
|
||||||
|
i = vorbiscomment_find_entry_from_(object, index, (const char *)entry.entry, field_name_length);
|
||||||
|
while(i >= 0) {
|
||||||
|
index = (unsigned)i;
|
||||||
|
if(!FLAC__metadata_object_vorbiscomment_delete_comment(object, index))
|
||||||
return false;
|
return false;
|
||||||
if((unsigned)i < object->data.vorbis_comment.num_comments)
|
if(index < object->data.vorbis_comment.num_comments)
|
||||||
i = vorbiscomment_find_entry_from_(object, (unsigned)i, (const char *)entry.entry, field_name_length);
|
i = vorbiscomment_find_entry_from_(object, index, (const char *)entry.entry, field_name_length);
|
||||||
else
|
else
|
||||||
i = -1;
|
i = -1;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user