Commit 6fe437a4 authored by Christophe Massiot's avatar Christophe Massiot

* ALL: Fix warnings triggered by -Wshadow, patch by Lionel Debroux.

parent 91833f34
......@@ -62,9 +62,9 @@ void mpeg2_free (void * buf)
free (*(((void **)buf) - 1));
}
void mpeg2_malloc_hooks (void * malloc (unsigned, mpeg2_alloc_t),
int free (void *))
void mpeg2_malloc_hooks (void * alloc_func (unsigned, mpeg2_alloc_t),
int free_func (void *))
{
malloc_hook = malloc;
free_hook = free;
malloc_hook = alloc_func;
free_hook = free_func;
}
......@@ -408,13 +408,13 @@ int mpeg2_guess_aspect (const mpeg2_sequence_t * sequence,
return (height == 576) ? 1 : 2;
}
static void copy_matrix (mpeg2dec_t * mpeg2dec, int index)
static void copy_matrix (mpeg2dec_t * mpeg2dec, int idx)
{
if (memcmp (mpeg2dec->quantizer_matrix[index],
mpeg2dec->new_quantizer_matrix[index], 64)) {
memcpy (mpeg2dec->quantizer_matrix[index],
mpeg2dec->new_quantizer_matrix[index], 64);
mpeg2dec->scaled[index] = -1;
if (memcmp (mpeg2dec->quantizer_matrix[idx],
mpeg2dec->new_quantizer_matrix[idx], 64)) {
memcpy (mpeg2dec->quantizer_matrix[idx],
mpeg2dec->new_quantizer_matrix[idx], 64);
mpeg2dec->scaled[idx] = -1;
}
}
......@@ -857,7 +857,7 @@ int mpeg2_header_user_data (mpeg2dec_t * mpeg2dec)
return 0;
}
static void prescale (mpeg2dec_t * mpeg2dec, int index)
static void prescale (mpeg2dec_t * mpeg2dec, int idx)
{
static int non_linear_scale [] = {
0, 1, 2, 3, 4, 5, 6, 7,
......@@ -868,13 +868,13 @@ static void prescale (mpeg2dec_t * mpeg2dec, int index)
int i, j, k;
mpeg2_decoder_t * decoder = &(mpeg2dec->decoder);
if (mpeg2dec->scaled[index] != decoder->q_scale_type) {
mpeg2dec->scaled[index] = decoder->q_scale_type;
if (mpeg2dec->scaled[idx] != decoder->q_scale_type) {
mpeg2dec->scaled[idx] = decoder->q_scale_type;
for (i = 0; i < 32; i++) {
k = decoder->q_scale_type ? non_linear_scale[i] : (i << 1);
for (j = 0; j < 64; j++)
decoder->quantizer_prescale[index][i][j] =
k * mpeg2dec->quantizer_matrix[index][j];
decoder->quantizer_prescale[idx][i][j] =
k * mpeg2dec->quantizer_matrix[idx][j];
}
}
}
......
......@@ -77,31 +77,31 @@ static uint32_t clip (double p)
return (p < 0) ? 0 : ((p >= 1) ? 0xffffffff : (uint32_t)(p*4294967296.0));
}
static void randbyte_init (double p, randbyte_t * rand)
static void randbyte_init (double p, randbyte_t * rnd)
{
double q, r;
int i;
rand->p = clip (p);
rnd->p = clip (p);
r = 1;
for (i = 0; i < 8; i++) {
r *= 1 - p;
q = p / (1 - r);
rand->q[i] = clip (q);
rnd->q[i] = clip (q);
}
rand->r = clip (1 - r);
rnd->r = clip (1 - r);
}
static inline uint8_t randbyte (const randbyte_t * const rand)
static inline uint8_t randbyte (const randbyte_t * const rnd)
{
int i, j;
if (fastrand () > rand->r || rand->r == 0)
if (fastrand () > rnd->r || rnd->r == 0)
return 0;
i = 7; j = 0;
do
if (fastrand () <= (j ? rand->p : rand->q[i]))
if (fastrand () <= (j ? rnd->p : rnd->q[i]))
j |= 1 << i;
while (i--);
return j;
......@@ -258,7 +258,7 @@ static void update_corrupt_list (void)
static void corrupt (uint8_t * ptr)
{
corrupt_t * corrupt;
corrupt_t * corrupt_ptr;
if (ptr[0] == 0 && ptr[1] == 0 && ptr[2] == 1) {
current_chunk = (ptr[3] << 4) | (ptr[4] >> 4);
......@@ -269,14 +269,14 @@ static void corrupt (uint8_t * ptr)
current_bit += 8;
for (corrupt = corrupt_head; corrupt; corrupt = corrupt->next)
switch (corrupt->type) {
for (corrupt_ptr = corrupt_head; corrupt_ptr; corrupt_ptr = corrupt_ptr->next)
switch (corrupt_ptr->type) {
case CORRUPT_RANDOM:
*ptr ^= randbyte (&corrupt->u.prob) & corrupt->mask;
*ptr ^= randbyte (&corrupt_ptr->u.prob) & corrupt_ptr->mask;
break;
case CORRUPT_VALUE:
*ptr = ((*ptr & ~corrupt->mask) |
(randbyte (&corrupt->u.prob) & corrupt->mask));
*ptr = ((*ptr & ~corrupt_ptr->mask) |
(randbyte (&corrupt_ptr->u.prob) & corrupt_ptr->mask));
break;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment