block_number = 0;
while(ok && FLAC__metadata_iterator_next(iterator)) {
block_number++;
- if(passes_filter(options, FLAC__metadata_iterator_get_block(iterator), block_number))
+ if(passes_filter(options, FLAC__metadata_iterator_get_block(iterator), block_number)) {
ok &= FLAC__metadata_iterator_delete_block(iterator, options->use_padding);
+ if(options->use_padding)
+ ok &= FLAC__metadata_iterator_next(iterator);
+ }
}
FLAC__metadata_iterator_delete(iterator);
FLAC__metadata_iterator_init(iterator, chain);
- while(ok && FLAC__metadata_iterator_next(iterator))
+ while(ok && FLAC__metadata_iterator_next(iterator)) {
ok &= FLAC__metadata_iterator_delete_block(iterator, options->use_padding);
+ if(options->use_padding)
+ ok &= FLAC__metadata_iterator_next(iterator);
+ }
FLAC__metadata_iterator_delete(iterator);
FLAC__ASSERT(0 != needs_write);
if(0 != block->data.vorbis_comment.comments) {
- FLAC__ASSERT(block->data.vorbis_comment.num_comments == 0);
+ FLAC__ASSERT(block->data.vorbis_comment.num_comments > 0);
if(!FLAC__metadata_object_vorbiscomment_resize_comments(block, 0))
return false;
*needs_write = true;
}
else {
- FLAC__ASSERT(block->data.vorbis_comment.num_comments > 0);
+ FLAC__ASSERT(block->data.vorbis_comment.num_comments == 0);
}
return true;