mkxp-z/subprojects/packagefiles/flac-int32.patch
刘皓 b339eea1a7
Downgrade FLAC in libretro builds to 1.4.3
Some of the Android builds broke in the 1.5.0 update.
2025-06-04 11:38:25 -04:00

23 lines
1.6 KiB
Diff

# Fixes a compilation error when using the devkitARM toolchain or Vita SDK toolchain to compile FLAC.
# For some reason, there's no implicit casting between `int` and `int32_t` and between `unsigned int` and `uint32_t` in devkitARM or Vita SDK even though they're the same size, so we have to do this whole song and dance to appease the compiler.
--- a/src/libFLAC/stream_decoder.c
+++ b/src/libFLAC/stream_decoder.c
@@ -2973,7 +2973,7 @@ FLAC__bool read_residual_partitioned_rice_(FLAC__StreamDecoder *decoder, uint32_
if(rice_parameter < pesc) {
partitioned_rice_contents->raw_bits[partition] = 0;
u = (partition == 0) ? partition_samples - predictor_order : partition_samples;
- if(!decoder->private_->local_bitreader_read_rice_signed_block(decoder->private_->input, residual + sample, u, rice_parameter)){
+ if(!decoder->private_->local_bitreader_read_rice_signed_block(decoder->private_->input, (int *)(residual + sample), u, rice_parameter)){
if(decoder->protected_->state == FLAC__STREAM_DECODER_READ_FRAME) {
/* no error was set, read_callback_ didn't set it, so
* invalid rice symbol was found */
@@ -2996,7 +2996,7 @@ FLAC__bool read_residual_partitioned_rice_(FLAC__StreamDecoder *decoder, uint32_
}
else{
for(u = (partition == 0)? predictor_order : 0; u < partition_samples; u++, sample++) {
- if(!FLAC__bitreader_read_raw_int32(decoder->private_->input, &i, rice_parameter))
+ if(!FLAC__bitreader_read_raw_int32(decoder->private_->input, (FLAC__int32 *)&i, rice_parameter))
return false; /* read_callback_ sets the state for us */
residual[sample] = i;
}