mirror of
https://github.com/claunia/flac.git
synced 2025-12-16 18:54:26 +00:00
fix compiler warnings
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user