Fix minor shadowing issues

This commit is contained in:
bnnm 2019-02-23 03:15:49 +01:00
parent 111c4dd97c
commit e5480f4bb0
7 changed files with 23 additions and 27 deletions

View File

@ -296,7 +296,7 @@ ffmpeg_codec_data * init_ffmpeg_ue4_opus(STREAMFILE *streamFile, off_t start_off
ffmpeg_codec_data * init_ffmpeg_ea_opus(STREAMFILE *streamFile, off_t start_offset, size_t data_size, int channels, int skip, int sample_rate); ffmpeg_codec_data * init_ffmpeg_ea_opus(STREAMFILE *streamFile, off_t start_offset, size_t data_size, int channels, int skip, int sample_rate);
ffmpeg_codec_data * init_ffmpeg_x_opus(STREAMFILE *streamFile, off_t start_offset, size_t data_size, int channels, int skip, int sample_rate); ffmpeg_codec_data * init_ffmpeg_x_opus(STREAMFILE *streamFile, off_t start_offset, size_t data_size, int channels, int skip, int sample_rate);
size_t switch_opus_get_samples(off_t offset, size_t data_size, STREAMFILE *streamFile); size_t switch_opus_get_samples(off_t offset, size_t stream_size, STREAMFILE *streamFile);
size_t switch_opus_get_encoder_delay(off_t offset, STREAMFILE *streamFile); size_t switch_opus_get_encoder_delay(off_t offset, STREAMFILE *streamFile);
size_t ue4_opus_get_encoder_delay(off_t offset, STREAMFILE *streamFile); size_t ue4_opus_get_encoder_delay(off_t offset, STREAMFILE *streamFile);

View File

@ -523,9 +523,9 @@ static size_t get_xopus_packet_size(int packet, STREAMFILE * streamfile) {
#ifdef VGM_USE_FFMPEG #ifdef VGM_USE_FFMPEG
static size_t custom_opus_get_samples(off_t offset, size_t data_size, STREAMFILE *streamFile, opus_type_t type) { static size_t custom_opus_get_samples(off_t offset, size_t stream_size, STREAMFILE *streamFile, opus_type_t type) {
size_t num_samples = 0; size_t num_samples = 0;
off_t end_offset = offset + data_size; off_t end_offset = offset + stream_size;
int packet = 0; int packet = 0;
if (end_offset > get_streamfile_size(streamFile)) { if (end_offset > get_streamfile_size(streamFile)) {
@ -569,8 +569,8 @@ static size_t custom_opus_get_samples(off_t offset, size_t data_size, STREAMFILE
return num_samples; return num_samples;
} }
size_t switch_opus_get_samples(off_t offset, size_t data_size, STREAMFILE *streamFile) { size_t switch_opus_get_samples(off_t offset, size_t stream_size, STREAMFILE *streamFile) {
return custom_opus_get_samples(offset, data_size, streamFile, OPUS_SWITCH); return custom_opus_get_samples(offset, stream_size, streamFile, OPUS_SWITCH);
} }

View File

@ -506,7 +506,6 @@ static int ealayer3_rebuild_mpeg_frame(vgm_bitstream* is_0, ealayer3_frame_info*
is_0->b_off = eaf_0->data_offset_b; is_0->b_off = eaf_0->data_offset_b;
for (i = 0; i < eaf_0->channels; i++) { /* granule0 */ for (i = 0; i < eaf_0->channels; i++) { /* granule0 */
for (j = 0; j < eaf_0->main_data_size[i]; j++) { for (j = 0; j < eaf_0->main_data_size[i]; j++) {
uint32_t c = 0;
r_bits(is_0, 1, &c); r_bits(is_0, 1, &c);
w_bits(os, 1, c); w_bits(os, 1, c);
} }

View File

@ -6,7 +6,6 @@ void block_update_wsi(off_t block_offset, VGMSTREAM * vgmstream) {
STREAMFILE* streamFile = vgmstream->ch[0].streamfile; STREAMFILE* streamFile = vgmstream->ch[0].streamfile;
int i; int i;
off_t channel_block_size; off_t channel_block_size;
//int is_first_offset =
/* assume that all channels have the same size for this block */ /* assume that all channels have the same size for this block */
@ -22,8 +21,6 @@ void block_update_wsi(off_t block_offset, VGMSTREAM * vgmstream) {
/* first block has DSP header, remove */ /* first block has DSP header, remove */
if (block_offset == vgmstream->ch[0].channel_start_offset) { if (block_offset == vgmstream->ch[0].channel_start_offset) {
int i;
vgmstream->current_block_size -= 0x60; vgmstream->current_block_size -= 0x60;
for (i = 0; i < vgmstream->channels; i++) { for (i = 0; i < vgmstream->channels; i++) {
vgmstream->ch[i].offset += 0x60; vgmstream->ch[i].offset += 0x60;

View File

@ -189,9 +189,9 @@ VGMSTREAM * init_vgmstream_genh(STREAMFILE *streamFile) {
/* setup adpcm */ /* setup adpcm */
if (coding == coding_AICA || coding == coding_AICA_int) { if (coding == coding_AICA || coding == coding_AICA_int) {
int i; int ch;
for (i=0;i<vgmstream->channels;i++) { for (ch = 0; ch < vgmstream->channels; ch++) {
vgmstream->ch[i].adpcm_step_index = 0x7f; vgmstream->ch[ch].adpcm_step_index = 0x7f;
} }
} }

View File

@ -39,7 +39,7 @@ VGMSTREAM * init_vgmstream_scd_sscf(STREAMFILE *streamFile) {
total_subsongs = 0; total_subsongs = 0;
for (i = 0; i < entries; i++) { for (i = 0; i < entries; i++) {
off_t entry_offset = 0x20 + (0x20*i); off_t entry_offset = 0x20 + (0x20*i);
off_t stream_offset; off_t entry_stream_offset;
/* skip dummies */ /* skip dummies */
if (read_32bitLE(entry_offset+0x08,streamFile) == 0) /* size 0 */ if (read_32bitLE(entry_offset+0x08,streamFile) == 0) /* size 0 */
@ -49,16 +49,16 @@ VGMSTREAM * init_vgmstream_scd_sscf(STREAMFILE *streamFile) {
/* skip repeated sounds */ /* skip repeated sounds */
is_dupe = 0; is_dupe = 0;
stream_offset = read_32bitLE(entry_offset+0x04,streamFile); entry_stream_offset = read_32bitLE(entry_offset+0x04,streamFile);
for (j = 0; j < total_subsongs; j++) { for (j = 0; j < total_subsongs; j++) {
if (stream_offset == stream_offsets[j]) { if (entry_stream_offset == stream_offsets[j]) {
is_dupe = 1; is_dupe = 1;
break; break;
} }
} }
if (is_dupe) if (is_dupe)
continue; continue;
stream_offsets[total_subsongs] = stream_offset; stream_offsets[total_subsongs] = entry_stream_offset;
/* ok */ /* ok */
total_subsongs++; total_subsongs++;

View File

@ -6,7 +6,7 @@ VGMSTREAM * init_vgmstream_xnb(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL; VGMSTREAM * vgmstream = NULL;
off_t start_offset, xma_chunk_offset = 0; off_t start_offset, xma_chunk_offset = 0;
int loop_flag = 0, channel_count, num_samples = 0, loop_start = 0, loop_end = 0; int loop_flag = 0, channel_count, num_samples = 0, loop_start = 0, loop_end = 0;
int big_endian, flags, codec, sample_rate, block_size, bps; int big_endian, flags, codec, sample_rate, block_align, bps;
size_t data_size; size_t data_size;
char platform; char platform;
@ -76,7 +76,7 @@ VGMSTREAM * init_vgmstream_xnb(STREAMFILE *streamFile) {
channel_count = read_16bit(current_offset+0x02, streamFile); channel_count = read_16bit(current_offset+0x02, streamFile);
sample_rate = read_32bit(current_offset+0x04, streamFile); sample_rate = read_32bit(current_offset+0x04, streamFile);
/* 0x08: byte rate */ /* 0x08: byte rate */
block_size = read_16bit(current_offset+0x0c, streamFile); block_align = read_16bit(current_offset+0x0c, streamFile);
bps = read_16bit(current_offset+0x0e, streamFile); bps = read_16bit(current_offset+0x0e, streamFile);
if (codec == 0x166) { if (codec == 0x166) {
@ -104,29 +104,29 @@ VGMSTREAM * init_vgmstream_xnb(STREAMFILE *streamFile) {
switch (codec) { switch (codec) {
case 0x01: /* Dragon's Blade (Android) */ case 0x01: /* Dragon's Blade (Android) */
/* null in Metagalactic Blitz (PC) */ /* null in Metagalactic Blitz (PC) */
if (!block_size) if (!block_align)
block_size = (bps == 8 ? 0x01 : 0x02) * channel_count; block_align = (bps == 8 ? 0x01 : 0x02) * channel_count;
vgmstream->coding_type = bps == 8 ? coding_PCM8_U_int : coding_PCM16LE; vgmstream->coding_type = bps == 8 ? coding_PCM8_U_int : coding_PCM16LE;
vgmstream->layout_type = layout_interleave; vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = block_size / channel_count; vgmstream->interleave_block_size = block_align / channel_count;
vgmstream->num_samples = pcm_bytes_to_samples(data_size, channel_count, bps); vgmstream->num_samples = pcm_bytes_to_samples(data_size, channel_count, bps);
break; break;
case 0x02: /* White Noise Online (PC) */ case 0x02: /* White Noise Online (PC) */
if (!block_size) goto fail; if (!block_align) goto fail;
vgmstream->coding_type = coding_MSADPCM; vgmstream->coding_type = coding_MSADPCM;
vgmstream->layout_type = layout_none; vgmstream->layout_type = layout_none;
vgmstream->interleave_block_size = block_size; vgmstream->interleave_block_size = block_align;
vgmstream->num_samples = msadpcm_bytes_to_samples(data_size, block_size, channel_count); vgmstream->num_samples = msadpcm_bytes_to_samples(data_size, block_align, channel_count);
break; break;
case 0x11: case 0x11:
if (!block_size) goto fail; if (!block_align) goto fail;
vgmstream->coding_type = coding_MS_IMA; vgmstream->coding_type = coding_MS_IMA;
vgmstream->layout_type = layout_none; vgmstream->layout_type = layout_none;
vgmstream->interleave_block_size = block_size; vgmstream->interleave_block_size = block_align;
vgmstream->num_samples = ms_ima_bytes_to_samples(data_size, block_size, channel_count); vgmstream->num_samples = ms_ima_bytes_to_samples(data_size, block_align, channel_count);
break; break;
#ifdef VGM_USE_FFMPEG #ifdef VGM_USE_FFMPEG