mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 12:32:52 +00:00
CXX_BUILD fixes
This commit is contained in:
parent
06047bc958
commit
b6cfd0456c
26
deps/libFLAC/stream_decoder.c
vendored
26
deps/libFLAC/stream_decoder.c
vendored
@ -1291,7 +1291,7 @@ FLAC__bool allocate_output_(FLAC__StreamDecoder *decoder, unsigned size, unsigne
|
|||||||
* (at negative indices) for alignment purposes; we use 4
|
* (at negative indices) for alignment purposes; we use 4
|
||||||
* to keep the data well-aligned.
|
* to keep the data well-aligned.
|
||||||
*/
|
*/
|
||||||
tmp = safe_malloc_muladd2_(sizeof(FLAC__int32), /*times (*/size, /*+*/4/*)*/);
|
tmp = (FLAC__int32*)safe_malloc_muladd2_(sizeof(FLAC__int32), /*times (*/size, /*+*/4/*)*/);
|
||||||
if(tmp == 0) {
|
if(tmp == 0) {
|
||||||
decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
|
decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
|
||||||
return false;
|
return false;
|
||||||
@ -1468,7 +1468,7 @@ FLAC__bool read_metadata_(FLAC__StreamDecoder *decoder)
|
|||||||
case FLAC__METADATA_TYPE_APPLICATION:
|
case FLAC__METADATA_TYPE_APPLICATION:
|
||||||
/* remember, we read the ID already */
|
/* remember, we read the ID already */
|
||||||
if(real_length > 0) {
|
if(real_length > 0) {
|
||||||
if(0 == (block.data.application.data = malloc(real_length))) {
|
if(0 == (block.data.application.data = (FLAC__byte*)malloc(real_length))) {
|
||||||
decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
|
decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
|
||||||
ok = false;
|
ok = false;
|
||||||
}
|
}
|
||||||
@ -1496,7 +1496,7 @@ FLAC__bool read_metadata_(FLAC__StreamDecoder *decoder)
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if(real_length > 0) {
|
if(real_length > 0) {
|
||||||
if(0 == (block.data.unknown.data = malloc(real_length))) {
|
if(0 == (block.data.unknown.data = (FLAC__byte*)malloc(real_length))) {
|
||||||
decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
|
decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
|
||||||
ok = false;
|
ok = false;
|
||||||
}
|
}
|
||||||
@ -1653,7 +1653,7 @@ FLAC__bool read_metadata_seektable_(FLAC__StreamDecoder *decoder, FLAC__bool is_
|
|||||||
decoder->private_->seek_table.data.seek_table.num_points = length / FLAC__STREAM_METADATA_SEEKPOINT_LENGTH;
|
decoder->private_->seek_table.data.seek_table.num_points = length / FLAC__STREAM_METADATA_SEEKPOINT_LENGTH;
|
||||||
|
|
||||||
/* use realloc since we may pass through here several times (e.g. after seeking) */
|
/* use realloc since we may pass through here several times (e.g. after seeking) */
|
||||||
if(0 == (decoder->private_->seek_table.data.seek_table.points = safe_realloc_mul_2op_(decoder->private_->seek_table.data.seek_table.points, decoder->private_->seek_table.data.seek_table.num_points, /*times*/sizeof(FLAC__StreamMetadata_SeekPoint)))) {
|
if(0 == (decoder->private_->seek_table.data.seek_table.points = (FLAC__StreamMetadata_SeekPoint*)safe_realloc_mul_2op_(decoder->private_->seek_table.data.seek_table.points, decoder->private_->seek_table.data.seek_table.num_points, /*times*/sizeof(FLAC__StreamMetadata_SeekPoint)))) {
|
||||||
decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
|
decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1701,7 +1701,7 @@ FLAC__bool read_metadata_vorbiscomment_(FLAC__StreamDecoder *decoder, FLAC__Stre
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
length -= obj->vendor_string.length;
|
length -= obj->vendor_string.length;
|
||||||
if (0 == (obj->vendor_string.entry = safe_malloc_add_2op_(obj->vendor_string.length, /*+*/1))) {
|
if (0 == (obj->vendor_string.entry = (FLAC__byte*)safe_malloc_add_2op_(obj->vendor_string.length, /*+*/1))) {
|
||||||
decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
|
decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1724,7 +1724,7 @@ FLAC__bool read_metadata_vorbiscomment_(FLAC__StreamDecoder *decoder, FLAC__Stre
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (obj->num_comments > 0) {
|
if (obj->num_comments > 0) {
|
||||||
if (0 == (obj->comments = safe_malloc_mul_2op_p(obj->num_comments, /*times*/sizeof(FLAC__StreamMetadata_VorbisComment_Entry)))) {
|
if (0 == (obj->comments = (FLAC__StreamMetadata_VorbisComment_Entry*)safe_malloc_mul_2op_p(obj->num_comments, /*times*/sizeof(FLAC__StreamMetadata_VorbisComment_Entry)))) {
|
||||||
obj->num_comments = 0;
|
obj->num_comments = 0;
|
||||||
decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
|
decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
|
||||||
return false;
|
return false;
|
||||||
@ -1752,7 +1752,7 @@ FLAC__bool read_metadata_vorbiscomment_(FLAC__StreamDecoder *decoder, FLAC__Stre
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
length -= obj->comments[i].length;
|
length -= obj->comments[i].length;
|
||||||
if (0 == (obj->comments[i].entry = safe_malloc_add_2op_(obj->comments[i].length, /*+*/1))) {
|
if (0 == (obj->comments[i].entry = (FLAC__byte*)safe_malloc_add_2op_(obj->comments[i].length, /*+*/1))) {
|
||||||
decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
|
decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
|
||||||
obj->num_comments = i;
|
obj->num_comments = i;
|
||||||
return false;
|
return false;
|
||||||
@ -1811,7 +1811,7 @@ FLAC__bool read_metadata_cuesheet_(FLAC__StreamDecoder *decoder, FLAC__StreamMet
|
|||||||
obj->num_tracks = x;
|
obj->num_tracks = x;
|
||||||
|
|
||||||
if(obj->num_tracks > 0) {
|
if(obj->num_tracks > 0) {
|
||||||
if(0 == (obj->tracks = safe_calloc_(obj->num_tracks, sizeof(FLAC__StreamMetadata_CueSheet_Track)))) {
|
if(0 == (obj->tracks = (FLAC__StreamMetadata_CueSheet_Track*)safe_calloc_(obj->num_tracks, sizeof(FLAC__StreamMetadata_CueSheet_Track)))) {
|
||||||
decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
|
decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1844,7 +1844,7 @@ FLAC__bool read_metadata_cuesheet_(FLAC__StreamDecoder *decoder, FLAC__StreamMet
|
|||||||
track->num_indices = (FLAC__byte)x;
|
track->num_indices = (FLAC__byte)x;
|
||||||
|
|
||||||
if(track->num_indices > 0) {
|
if(track->num_indices > 0) {
|
||||||
if(0 == (track->indices = safe_calloc_(track->num_indices, sizeof(FLAC__StreamMetadata_CueSheet_Index)))) {
|
if(0 == (track->indices = (FLAC__StreamMetadata_CueSheet_Index*)safe_calloc_(track->num_indices, sizeof(FLAC__StreamMetadata_CueSheet_Index)))) {
|
||||||
decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
|
decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1876,12 +1876,12 @@ FLAC__bool read_metadata_picture_(FLAC__StreamDecoder *decoder, FLAC__StreamMeta
|
|||||||
/* read type */
|
/* read type */
|
||||||
if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, 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 */
|
return false; /* read_callback_ sets the state for us */
|
||||||
obj->type = x;
|
obj->type = (FLAC__StreamMetadata_Picture_Type)x;
|
||||||
|
|
||||||
/* read MIME type */
|
/* read MIME type */
|
||||||
if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, 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 */
|
return false; /* read_callback_ sets the state for us */
|
||||||
if(0 == (obj->mime_type = safe_malloc_add_2op_(x, /*+*/1))) {
|
if(0 == (obj->mime_type = (char*)safe_malloc_add_2op_(x, /*+*/1))) {
|
||||||
decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
|
decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1894,7 +1894,7 @@ FLAC__bool read_metadata_picture_(FLAC__StreamDecoder *decoder, FLAC__StreamMeta
|
|||||||
/* read description */
|
/* read description */
|
||||||
if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, 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 */
|
return false; /* read_callback_ sets the state for us */
|
||||||
if(0 == (obj->description = safe_malloc_add_2op_(x, /*+*/1))) {
|
if(0 == (obj->description = (FLAC__byte*)safe_malloc_add_2op_(x, /*+*/1))) {
|
||||||
decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
|
decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1923,7 +1923,7 @@ FLAC__bool read_metadata_picture_(FLAC__StreamDecoder *decoder, FLAC__StreamMeta
|
|||||||
/* read data */
|
/* read data */
|
||||||
if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &(obj->data_length), FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN))
|
if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &(obj->data_length), FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN))
|
||||||
return false; /* read_callback_ sets the state for us */
|
return false; /* read_callback_ sets the state for us */
|
||||||
if(0 == (obj->data = safe_malloc_(obj->data_length))) {
|
if(0 == (obj->data = (FLAC__byte*)safe_malloc_(obj->data_length))) {
|
||||||
decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
|
decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user