From d8ab3468fadc514a7cf66e41713fabdc0b07b95e Mon Sep 17 00:00:00 2001 From: Josh Coalson Date: Thu, 11 Jul 2002 05:54:05 +0000 Subject: [PATCH] add some asserts --- src/libFLAC/metadata_iterators.c | 2 ++ src/libFLAC/metadata_object.c | 9 ++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/libFLAC/metadata_iterators.c b/src/libFLAC/metadata_iterators.c index b7485111..fd0626a2 100644 --- a/src/libFLAC/metadata_iterators.c +++ b/src/libFLAC/metadata_iterators.c @@ -487,6 +487,7 @@ FLAC__bool FLAC__metadata_simple_iterator_set_block(FLAC__Metadata_SimpleIterato FLAC__ASSERT(0 != iterator); FLAC__ASSERT(0 != iterator->file); + FLAC__ASSERT(0 != block); if(!iterator->is_writable) { iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_NOT_WRITABLE; @@ -587,6 +588,7 @@ FLAC__bool FLAC__metadata_simple_iterator_insert_block_after(FLAC__Metadata_Simp FLAC__ASSERT(0 != iterator); FLAC__ASSERT(0 != iterator->file); + FLAC__ASSERT(0 != block); if(!iterator->is_writable) return false; diff --git a/src/libFLAC/metadata_object.c b/src/libFLAC/metadata_object.c index 4801920c..8076f539 100644 --- a/src/libFLAC/metadata_object.c +++ b/src/libFLAC/metadata_object.c @@ -432,6 +432,9 @@ static FLAC__bool compare_block_data_vorbiscomment_(const FLAC__StreamMetadata_V FLAC__bool FLAC__metadata_object_is_equal(const FLAC__StreamMetadata *block1, const FLAC__StreamMetadata *block2) { + FLAC__ASSERT(0 != block1); + FLAC__ASSERT(0 != block2); + if(block1->type != block2->type) { return false; } @@ -458,15 +461,11 @@ FLAC__bool FLAC__metadata_object_is_equal(const FLAC__StreamMetadata *block1, co } } -/*@@@move -sets the application data to 'data'. if 'copy' is true, makes, copy, else takes ownership of pointer. returns false if copy==true and malloc fails. - FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_APPLICATION); - FLAC__ASSERT((0 != data && length > 0) || (0 == data && length == 0 && copy == false)); -*/ FLAC__bool FLAC__metadata_object_application_set_data(FLAC__StreamMetadata *object, FLAC__byte *data, unsigned length, FLAC__bool copy) { FLAC__byte *save; + FLAC__ASSERT(0 != object); FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_APPLICATION); FLAC__ASSERT((0 != data && length > 0) || (0 == data && length == 0 && copy == false));