Fix -Wshadow warnings when compiling with mingw-gcc.

This commit is contained in:
Erik de Castro Lopo 2013-04-21 19:31:54 +10:00
parent f9d33d96e5
commit ef40d9d4ca
2 changed files with 47 additions and 41 deletions

View File

@ -963,7 +963,7 @@ FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder
decoder_session->format == FORMAT_WAVE || decoder_session->format == FORMAT_WAVE64 || decoder_session->format == FORMAT_RF64 ? bps<=8 : decoder_session->format == FORMAT_WAVE || decoder_session->format == FORMAT_WAVE64 || decoder_session->format == FORMAT_RF64 ? bps<=8 :
decoder_session->is_unsigned_samples decoder_session->is_unsigned_samples
)); ));
unsigned wide_samples = frame->header.blocksize, wide_sample, sample, channel, byte; unsigned wide_samples = frame->header.blocksize, wide_sample, sample, channel;
unsigned frame_bytes = 0; unsigned frame_bytes = 0;
static FLAC__int8 s8buffer[FLAC__MAX_BLOCK_SIZE * FLAC__MAX_CHANNELS * sizeof(FLAC__int32)]; /* WATCHOUT: can be up to 2 megs */ static FLAC__int8 s8buffer[FLAC__MAX_BLOCK_SIZE * FLAC__MAX_CHANNELS * sizeof(FLAC__int32)]; /* WATCHOUT: can be up to 2 megs */
FLAC__uint8 *u8buffer = (FLAC__uint8 *)s8buffer; FLAC__uint8 *u8buffer = (FLAC__uint8 *)s8buffer;
@ -1161,10 +1161,11 @@ FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder
if(is_big_endian != is_big_endian_host_) { if(is_big_endian != is_big_endian_host_) {
unsigned char tmp; unsigned char tmp;
const unsigned bytes = sample * 2; const unsigned bytes = sample * 2;
for(byte = 0; byte < bytes; byte += 2) { unsigned b;
tmp = u8buffer[byte]; for(b = 0; b < bytes; b += 2) {
u8buffer[byte] = u8buffer[byte+1]; tmp = u8buffer[b];
u8buffer[byte+1] = tmp; u8buffer[b] = u8buffer[b+1];
u8buffer[b+1] = tmp;
} }
} }
bytes_to_write = 2 * sample; bytes_to_write = 2 * sample;
@ -1183,33 +1184,34 @@ FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder
if(is_big_endian != is_big_endian_host_) { if(is_big_endian != is_big_endian_host_) {
unsigned char tmp; unsigned char tmp;
const unsigned bytes = sample * 4; const unsigned bytes = sample * 4;
for(byte = 0; byte < bytes; byte += 4) { unsigned b;
tmp = u8buffer[byte]; for(b = 0; b < bytes; b += 4) {
u8buffer[byte] = u8buffer[byte+3]; tmp = u8buffer[b];
u8buffer[byte+3] = tmp; u8buffer[b] = u8buffer[b+3];
tmp = u8buffer[byte+1]; u8buffer[b+3] = tmp;
u8buffer[byte+1] = u8buffer[byte+2]; tmp = u8buffer[b+1];
u8buffer[byte+2] = tmp; u8buffer[b+1] = u8buffer[b+2];
u8buffer[b+2] = tmp;
} }
} }
if(is_big_endian) { if(is_big_endian) {
unsigned lbyte; unsigned b, lbyte;
const unsigned bytes = sample * 4; const unsigned bytes = sample * 4;
for(lbyte = byte = 0; byte < bytes; ) { for(lbyte = b = 0; b < bytes; ) {
byte++; b++;
u8buffer[lbyte++] = u8buffer[byte++]; u8buffer[lbyte++] = u8buffer[b++];
u8buffer[lbyte++] = u8buffer[byte++]; u8buffer[lbyte++] = u8buffer[b++];
u8buffer[lbyte++] = u8buffer[byte++]; u8buffer[lbyte++] = u8buffer[b++];
} }
} }
else { else {
unsigned lbyte; unsigned b, lbyte;
const unsigned bytes = sample * 4; const unsigned bytes = sample * 4;
for(lbyte = byte = 0; byte < bytes; ) { for(lbyte = b = 0; b < bytes; ) {
u8buffer[lbyte++] = u8buffer[byte++]; u8buffer[lbyte++] = u8buffer[b++];
u8buffer[lbyte++] = u8buffer[byte++]; u8buffer[lbyte++] = u8buffer[b++];
u8buffer[lbyte++] = u8buffer[byte++]; u8buffer[lbyte++] = u8buffer[b++];
byte++; b++;
} }
} }
bytes_to_write = 3 * sample; bytes_to_write = 3 * sample;

View File

@ -2319,7 +2319,7 @@ FLAC__bool verify_metadata(const EncoderSession *e, FLAC__StreamMetadata **metad
FLAC__bool format_input(FLAC__int32 *dest[], unsigned wide_samples, FLAC__bool is_big_endian, FLAC__bool is_unsigned_samples, unsigned channels, unsigned bps, unsigned shift, size_t *channel_map) FLAC__bool format_input(FLAC__int32 *dest[], unsigned wide_samples, FLAC__bool is_big_endian, FLAC__bool is_unsigned_samples, unsigned channels, unsigned bps, unsigned shift, size_t *channel_map)
{ {
unsigned wide_sample, sample, channel, byte; unsigned wide_sample, sample, channel;
FLAC__int32 *out[FLAC__MAX_CHANNELS]; FLAC__int32 *out[FLAC__MAX_CHANNELS];
if(0 == channel_map) { if(0 == channel_map) {
@ -2347,10 +2347,11 @@ FLAC__bool format_input(FLAC__int32 *dest[], unsigned wide_samples, FLAC__bool i
if(is_big_endian != is_big_endian_host_) { if(is_big_endian != is_big_endian_host_) {
unsigned char tmp; unsigned char tmp;
const unsigned bytes = wide_samples * channels * (bps >> 3); const unsigned bytes = wide_samples * channels * (bps >> 3);
for(byte = 0; byte < bytes; byte += 2) { unsigned b;
tmp = ucbuffer_[byte]; for(b = 0; b < bytes; b += 2) {
ucbuffer_[byte] = ucbuffer_[byte+1]; tmp = ucbuffer_[b];
ucbuffer_[byte+1] = tmp; ucbuffer_[b] = ucbuffer_[b+1];
ucbuffer_[b+1] = tmp;
} }
} }
if(is_unsigned_samples) { if(is_unsigned_samples) {
@ -2368,27 +2369,30 @@ FLAC__bool format_input(FLAC__int32 *dest[], unsigned wide_samples, FLAC__bool i
if(!is_big_endian) { if(!is_big_endian) {
unsigned char tmp; unsigned char tmp;
const unsigned bytes = wide_samples * channels * (bps >> 3); const unsigned bytes = wide_samples * channels * (bps >> 3);
for(byte = 0; byte < bytes; byte += 3) { unsigned b;
tmp = ucbuffer_[byte]; for(b = 0; b < bytes; b += 3) {
ucbuffer_[byte] = ucbuffer_[byte+2]; tmp = ucbuffer_[b];
ucbuffer_[byte+2] = tmp; ucbuffer_[b] = ucbuffer_[b+2];
ucbuffer_[b+2] = tmp;
} }
} }
if(is_unsigned_samples) { if(is_unsigned_samples) {
for(byte = sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++) unsigned b;
for(b = sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++)
for(channel = 0; channel < channels; channel++, sample++) { for(channel = 0; channel < channels; channel++, sample++) {
out[channel][wide_sample] = ucbuffer_[byte++]; out[channel][wide_sample] <<= 8; out[channel][wide_sample] = ucbuffer_[b++]; out[channel][wide_sample] <<= 8;
out[channel][wide_sample] |= ucbuffer_[byte++]; out[channel][wide_sample] <<= 8; out[channel][wide_sample] |= ucbuffer_[b++]; out[channel][wide_sample] <<= 8;
out[channel][wide_sample] |= ucbuffer_[byte++]; out[channel][wide_sample] |= ucbuffer_[b++];
out[channel][wide_sample] -= 0x800000; out[channel][wide_sample] -= 0x800000;
} }
} }
else { else {
for(byte = sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++) unsigned b;
for(b = sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++)
for(channel = 0; channel < channels; channel++, sample++) { for(channel = 0; channel < channels; channel++, sample++) {
out[channel][wide_sample] = scbuffer_[byte++]; out[channel][wide_sample] <<= 8; out[channel][wide_sample] = scbuffer_[b++]; out[channel][wide_sample] <<= 8;
out[channel][wide_sample] |= ucbuffer_[byte++]; out[channel][wide_sample] <<= 8; out[channel][wide_sample] |= ucbuffer_[b++]; out[channel][wide_sample] <<= 8;
out[channel][wide_sample] |= ucbuffer_[byte++]; out[channel][wide_sample] |= ucbuffer_[b++];
} }
} }
} }