max the largest metadata type code be 126, reserving 127 to avoid confusion with a frame sync code

This commit is contained in:
Josh Coalson
2004-07-22 01:32:00 +00:00
parent 5bf54f0a93
commit 1cb2341298
5 changed files with 19 additions and 7 deletions

View File

@@ -402,9 +402,9 @@ FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond(FLAC__StreamDecode
FLAC__ASSERT(0 != decoder);
FLAC__ASSERT(0 != decoder->private_);
FLAC__ASSERT(0 != decoder->protected_);
FLAC__ASSERT((unsigned)type < (1u << FLAC__STREAM_METADATA_TYPE_LEN));
FLAC__ASSERT((unsigned)type <= FLAC__MAX_METADATA_TYPE_CODE);
/* double protection */
if((unsigned)type >= (1u << FLAC__STREAM_METADATA_TYPE_LEN))
if((unsigned)type > FLAC__MAX_METADATA_TYPE_CODE)
return false;
if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED)
return false;
@@ -459,9 +459,9 @@ FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_ignore(FLAC__StreamDecoder
FLAC__ASSERT(0 != decoder);
FLAC__ASSERT(0 != decoder->private_);
FLAC__ASSERT(0 != decoder->protected_);
FLAC__ASSERT((unsigned)type < (1u << FLAC__STREAM_METADATA_TYPE_LEN));
FLAC__ASSERT((unsigned)type <= FLAC__MAX_METADATA_TYPE_CODE);
/* double protection */
if((unsigned)type >= (1u << FLAC__STREAM_METADATA_TYPE_LEN))
if((unsigned)type > FLAC__MAX_METADATA_TYPE_CODE)
return false;
if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED)
return false;