Fix compiler whining

This commit is contained in:
bnnm 2020-04-19 00:40:31 +02:00
parent 42610bdac6
commit 3f679d8f2d
2 changed files with 17 additions and 12 deletions

View File

@ -431,11 +431,11 @@ static void ms_audio_parse_header(STREAMFILE *streamFile, int xma_version, int64
/* full packet skip, no new frames start in this packet (prev frames can end here) /* full packet skip, no new frames start in this packet (prev frames can end here)
* standardized to some value */ * standardized to some value */
if (*packet_skip_count == 0x7FF) { /* XMA1, 11b */ if (*packet_skip_count == 0x7FF) { /* XMA1, 11b */
VGM_LOG("MS_SAMPLES: XMA1 full packet_skip at %"PRIx64"\n", offset_b/8); VGM_LOG("MS_SAMPLES: XMA1 full packet_skip\n");// at %"PRIx64"\n", offset_b/8);
*packet_skip_count = 0x800; *packet_skip_count = 0x800;
} }
else if (*packet_skip_count == 0xFF) { /* XMA2, 8b*/ else if (*packet_skip_count == 0xFF) { /* XMA2, 8b*/
VGM_LOG("MS_SAMPLES: XMA2 full packet_skip at %"PRIx64"\n", offset_b/8); VGM_LOG("MS_SAMPLES: XMA2 full packet_skip\n");// at %"PRIx64"\n", offset_b/8);
*packet_skip_count = 0x800; *packet_skip_count = 0x800;
} }

View File

@ -292,11 +292,16 @@ static uint32_t read_ubits(uint8_t bits, uint32_t offset, uint8_t *buf) {
} }
static int read_sbits(uint8_t bits, uint32_t offset, uint8_t *buf) { static int read_sbits(uint8_t bits, uint32_t offset, uint8_t *buf) {
uint32_t val = read_ubits(bits, offset, buf); uint32_t val = read_ubits(bits, offset, buf);
int outval;
if (val >> (bits - 1) == 1) { /* upper bit = sign */ if (val >> (bits - 1) == 1) { /* upper bit = sign */
uint32_t mask = (1 << (bits - 1)) - 1; uint32_t mask = (1 << (bits - 1)) - 1;
return -(val & mask); outval = (int)(val & mask);
outval = -outval;
} }
return val; else {
outval = (int)val;
}
return outval;
} }
static void init_dequantization(float* scales) { static void init_dequantization(float* scales) {
@ -339,7 +344,7 @@ static void unpack_frame(uint8_t *buf, int buf_size, float *freq1, float *freq2,
if (cb_bits > 0 && ev_bits > 0) { if (cb_bits > 0 && ev_bits > 0) {
pos = 0; pos = 0;
for (i = 0; i < RELIC_CRITICAL_BAND_COUNT - 1; i++) { for (i = 0; i < RELIC_CRITICAL_BAND_COUNT - 1; i++) {
if (bit_offset >= 8*buf_size) if (bit_offset >= 8u*buf_size)
break; break;
move = read_ubits(cb_bits, bit_offset, buf); move = read_ubits(cb_bits, bit_offset, buf);
@ -361,7 +366,7 @@ static void unpack_frame(uint8_t *buf, int buf_size, float *freq1, float *freq2,
/* read first part */ /* read first part */
pos = 0; pos = 0;
for (i = 0; i < RELIC_MAX_FREQ; i++) { for (i = 0; i < RELIC_MAX_FREQ; i++) {
if (bit_offset >= 8*buf_size) if (bit_offset >= 8u*buf_size)
break; break;
move = read_ubits(ei_bits, bit_offset, buf); move = read_ubits(ei_bits, bit_offset, buf);
@ -385,7 +390,7 @@ static void unpack_frame(uint8_t *buf, int buf_size, float *freq1, float *freq2,
else { else {
pos = 0; pos = 0;
for (i = 0; i < RELIC_MAX_FREQ; i++) { for (i = 0; i < RELIC_MAX_FREQ; i++) {
if (bit_offset >= 8*buf_size) if (bit_offset >= 8u*buf_size)
break; break;
move = read_ubits(ei_bits, bit_offset, buf); move = read_ubits(ei_bits, bit_offset, buf);
@ -437,7 +442,7 @@ static void copy_samples(relic_codec_data* data, sample_t* outbuf, int32_t sampl
for (ch = 0; ch < ichs; ch++) { for (ch = 0; ch < ichs; ch++) {
for (s = 0; s < samples; s++) { for (s = 0; s < samples; s++) {
double d64_sample = data->wave_cur[ch][skip + s]; double d64_sample = data->wave_cur[ch][skip + s];
int pcm_sample = clamp16(d64_sample); int pcm_sample = clamp16((int32_t)d64_sample);
/* f32 in PCM 32767.0 .. -32768.0 format, original code /* f32 in PCM 32767.0 .. -32768.0 format, original code
* does some custom double-to-int rint() though */ * does some custom double-to-int rint() though */