Skip to content
  • Erik de Castro Lopo's avatar
    libFLAC: More metadata_iterators fixes · fdc1ccf2
    Erik de Castro Lopo authored
    The previous fixes for metadata_iterators didn't completely fix the problem.
    
    The behavior of chain_prepare_for_write_() must always be the same as the
    behavior of FLAC__metadata_chain_check_if_tempfile_needed(). Before this
    fix, one check was missing in FLAC__metadata_chain_check_if_tempfile_needed(),
    and also chain_prepare_for_write_() checked the sizes of the metadata blocks
    *after* making the changes to the chain, while
    FLAC__metadata_chain_check_if_tempfile_needed() does it *before* the changes.
    
    This patch changes FLAC__metadata_chain_check_if_tempfile_needed() so that it
    keeps some info (lbs_state, lbs_size) about estimated changes and then uses
    it to check the block sizes.
    
    It also simplifies FLAC__metadata_chain_check_if_tempfile_needed() a little.
    
    Patch-from: lvqcl <lvqcl.mail@gmail.com>
    fdc1ccf2