fix compiler warnings

This commit is contained in:
Josh Coalson
2007-02-22 01:37:33 +00:00
parent c8c9c9917e
commit 9bedd7827c
7 changed files with 20 additions and 19 deletions

View File

@@ -1834,39 +1834,40 @@ FLAC__bool read_metadata_cuesheet_(FLAC__StreamDecoder *decoder, FLAC__StreamMet
FLAC__bool read_metadata_picture_(FLAC__StreamDecoder *decoder, FLAC__StreamMetadata_Picture *obj)
{
FLAC__uint32 len;
FLAC__uint32 x;
FLAC__ASSERT(FLAC__bitreader_is_consumed_byte_aligned(decoder->private_->input));
/* read type */
if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &obj->type, FLAC__STREAM_METADATA_PICTURE_TYPE_LEN))
if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_PICTURE_TYPE_LEN))
return false; /* read_callback_ sets the state for us */
obj->type = x;
/* read MIME type */
if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &len, FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN))
if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN))
return false; /* read_callback_ sets the state for us */
if(0 == (obj->mime_type = (char*)malloc(len+1))) {
if(0 == (obj->mime_type = (char*)malloc(x+1))) {
decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
return false;
}
if(len > 0) {
if(!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, (FLAC__byte*)obj->mime_type, len))
if(x > 0) {
if(!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, (FLAC__byte*)obj->mime_type, x))
return false; /* read_callback_ sets the state for us */
}
obj->mime_type[len] = '\0';
obj->mime_type[x] = '\0';
/* read description */
if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &len, FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN))
if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN))
return false; /* read_callback_ sets the state for us */
if(0 == (obj->description = (FLAC__byte*)malloc(len+1))) {
if(0 == (obj->description = (FLAC__byte*)malloc(x+1))) {
decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
return false;
}
if(len > 0) {
if(!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, obj->description, len))
if(x > 0) {
if(!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, obj->description, x))
return false; /* read_callback_ sets the state for us */
}
obj->description[len] = '\0';
obj->description[x] = '\0';
/* read width */
if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &obj->width, FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN))