From e5480f4bb02a0483faea960350c4f507dca86154 Mon Sep 17 00:00:00 2001 From: bnnm Date: Sat, 23 Feb 2019 03:15:49 +0100 Subject: [PATCH] Fix minor shadowing issues --- src/coding/coding.h | 2 +- src/coding/ffmpeg_decoder_custom_opus.c | 8 ++++---- src/coding/mpeg_custom_utils_ealayer3.c | 1 - src/layout/blocked_wsi.c | 3 --- src/meta/genh.c | 6 +++--- src/meta/sqex_scd_sscf.c | 8 ++++---- src/meta/xnb.c | 22 +++++++++++----------- 7 files changed, 23 insertions(+), 27 deletions(-) diff --git a/src/coding/coding.h b/src/coding/coding.h index 239c0756..809f6b59 100644 --- a/src/coding/coding.h +++ b/src/coding/coding.h @@ -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_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 ue4_opus_get_encoder_delay(off_t offset, STREAMFILE *streamFile); diff --git a/src/coding/ffmpeg_decoder_custom_opus.c b/src/coding/ffmpeg_decoder_custom_opus.c index 92e0513d..8f992b86 100644 --- a/src/coding/ffmpeg_decoder_custom_opus.c +++ b/src/coding/ffmpeg_decoder_custom_opus.c @@ -523,9 +523,9 @@ static size_t get_xopus_packet_size(int packet, STREAMFILE * streamfile) { #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; - off_t end_offset = offset + data_size; + off_t end_offset = offset + stream_size; int packet = 0; 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; } -size_t switch_opus_get_samples(off_t offset, size_t data_size, STREAMFILE *streamFile) { - return custom_opus_get_samples(offset, data_size, streamFile, OPUS_SWITCH); +size_t switch_opus_get_samples(off_t offset, size_t stream_size, STREAMFILE *streamFile) { + return custom_opus_get_samples(offset, stream_size, streamFile, OPUS_SWITCH); } diff --git a/src/coding/mpeg_custom_utils_ealayer3.c b/src/coding/mpeg_custom_utils_ealayer3.c index fa1f92da..399497c7 100644 --- a/src/coding/mpeg_custom_utils_ealayer3.c +++ b/src/coding/mpeg_custom_utils_ealayer3.c @@ -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; for (i = 0; i < eaf_0->channels; i++) { /* granule0 */ for (j = 0; j < eaf_0->main_data_size[i]; j++) { - uint32_t c = 0; r_bits(is_0, 1, &c); w_bits(os, 1, c); } diff --git a/src/layout/blocked_wsi.c b/src/layout/blocked_wsi.c index 6be576fb..c493f1f3 100644 --- a/src/layout/blocked_wsi.c +++ b/src/layout/blocked_wsi.c @@ -6,7 +6,6 @@ void block_update_wsi(off_t block_offset, VGMSTREAM * vgmstream) { STREAMFILE* streamFile = vgmstream->ch[0].streamfile; int i; off_t channel_block_size; - //int is_first_offset = /* 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 */ if (block_offset == vgmstream->ch[0].channel_start_offset) { - int i; - vgmstream->current_block_size -= 0x60; for (i = 0; i < vgmstream->channels; i++) { vgmstream->ch[i].offset += 0x60; diff --git a/src/meta/genh.c b/src/meta/genh.c index c3bdfad9..ac4d7b82 100644 --- a/src/meta/genh.c +++ b/src/meta/genh.c @@ -189,9 +189,9 @@ VGMSTREAM * init_vgmstream_genh(STREAMFILE *streamFile) { /* setup adpcm */ if (coding == coding_AICA || coding == coding_AICA_int) { - int i; - for (i=0;ichannels;i++) { - vgmstream->ch[i].adpcm_step_index = 0x7f; + int ch; + for (ch = 0; ch < vgmstream->channels; ch++) { + vgmstream->ch[ch].adpcm_step_index = 0x7f; } } diff --git a/src/meta/sqex_scd_sscf.c b/src/meta/sqex_scd_sscf.c index 56b4377e..2bcb4178 100644 --- a/src/meta/sqex_scd_sscf.c +++ b/src/meta/sqex_scd_sscf.c @@ -39,7 +39,7 @@ VGMSTREAM * init_vgmstream_scd_sscf(STREAMFILE *streamFile) { total_subsongs = 0; for (i = 0; i < entries; i++) { off_t entry_offset = 0x20 + (0x20*i); - off_t stream_offset; + off_t entry_stream_offset; /* skip dummies */ if (read_32bitLE(entry_offset+0x08,streamFile) == 0) /* size 0 */ @@ -49,16 +49,16 @@ VGMSTREAM * init_vgmstream_scd_sscf(STREAMFILE *streamFile) { /* skip repeated sounds */ 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++) { - if (stream_offset == stream_offsets[j]) { + if (entry_stream_offset == stream_offsets[j]) { is_dupe = 1; break; } } if (is_dupe) continue; - stream_offsets[total_subsongs] = stream_offset; + stream_offsets[total_subsongs] = entry_stream_offset; /* ok */ total_subsongs++; diff --git a/src/meta/xnb.c b/src/meta/xnb.c index 2ca78366..384a17f8 100644 --- a/src/meta/xnb.c +++ b/src/meta/xnb.c @@ -6,7 +6,7 @@ VGMSTREAM * init_vgmstream_xnb(STREAMFILE *streamFile) { VGMSTREAM * vgmstream = NULL; off_t start_offset, xma_chunk_offset = 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; char platform; @@ -76,7 +76,7 @@ VGMSTREAM * init_vgmstream_xnb(STREAMFILE *streamFile) { channel_count = read_16bit(current_offset+0x02, streamFile); sample_rate = read_32bit(current_offset+0x04, streamFile); /* 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); if (codec == 0x166) { @@ -104,29 +104,29 @@ VGMSTREAM * init_vgmstream_xnb(STREAMFILE *streamFile) { switch (codec) { case 0x01: /* Dragon's Blade (Android) */ /* null in Metagalactic Blitz (PC) */ - if (!block_size) - block_size = (bps == 8 ? 0x01 : 0x02) * channel_count; + if (!block_align) + block_align = (bps == 8 ? 0x01 : 0x02) * channel_count; vgmstream->coding_type = bps == 8 ? coding_PCM8_U_int : coding_PCM16LE; 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); break; case 0x02: /* White Noise Online (PC) */ - if (!block_size) goto fail; + if (!block_align) goto fail; vgmstream->coding_type = coding_MSADPCM; vgmstream->layout_type = layout_none; - vgmstream->interleave_block_size = block_size; - vgmstream->num_samples = msadpcm_bytes_to_samples(data_size, block_size, channel_count); + vgmstream->interleave_block_size = block_align; + vgmstream->num_samples = msadpcm_bytes_to_samples(data_size, block_align, channel_count); break; case 0x11: - if (!block_size) goto fail; + if (!block_align) goto fail; vgmstream->coding_type = coding_MS_IMA; vgmstream->layout_type = layout_none; - vgmstream->interleave_block_size = block_size; - vgmstream->num_samples = ms_ima_bytes_to_samples(data_size, block_size, channel_count); + vgmstream->interleave_block_size = block_align; + vgmstream->num_samples = ms_ima_bytes_to_samples(data_size, block_align, channel_count); break; #ifdef VGM_USE_FFMPEG