____________________________________________________________________________________________
Yahoo! Mail innove : interface hyper pratique, messenger intégré, couleurs -
http://mail.yahoo.fr>From ab3d8883e8d597bf3a8396066a6eefb428caebac Mon Sep 17 00:00:00 2001
From: Lionel Debroux <[EMAIL PROTECTED]>
Date: Wed, 28 Nov 2007 10:28:19 +0100
Subject: Fix some of the warnings with increased warning settings (signed/unsigned comparisons, shadows).
---
trunk/libmpeg2/header.c | 34 ++++++++++++++++------------------
trunk/src/corrupt_mpeg2.c | 12 ++++++------
trunk/src/mpeg2dec.c | 10 +++++-----
3 files changed, 27 insertions(+), 29 deletions(-)
diff --git a/trunk/libmpeg2/header.c b/trunk/libmpeg2/header.c
index ee874e5..3985295 100644
--- a/trunk/libmpeg2/header.c
+++ b/trunk/libmpeg2/header.c
@@ -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;
}
}
@@ -809,14 +809,12 @@ void mpeg2_header_picture_finalize (mpeg2dec_t * mpeg2dec, uint32_t accels)
info_user_data (mpeg2dec);
}
-static int copyright_ext (mpeg2dec_t * mpeg2dec)
-{
- return 0;
-}
-
+/**
+ * Helper function that handles the Quantizer Matrix extension.
+ */
static int quant_matrix_ext (mpeg2dec_t * mpeg2dec)
{
- uint8_t * buffer = mpeg2dec->chunk_start;
+ const uint8_t * buffer = mpeg2dec->chunk_start;
int i, j;
for (i = 0; i < 4; i++)
@@ -856,9 +854,9 @@ 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 [] = {
+ static const int non_linear_scale [] = {
0, 1, 2, 3, 4, 5, 6, 7,
8, 10, 12, 14, 16, 18, 20, 22,
24, 28, 32, 36, 40, 44, 48, 52,
@@ -867,13 +865,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];
}
}
}
diff --git a/trunk/src/corrupt_mpeg2.c b/trunk/src/corrupt_mpeg2.c
index 950813d..78210fb 100644
--- a/trunk/src/corrupt_mpeg2.c
+++ b/trunk/src/corrupt_mpeg2.c
@@ -258,7 +258,7 @@ static void update_corrupt_list (void)
static void corrupt (uint8_t * ptr)
{
- corrupt_t * corrupt;
+ corrupt_t * pCorrupt;
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 (pCorrupt = corrupt_head; pCorrupt; pCorrupt = pCorrupt->next)
+ switch (pCorrupt->type) {
case CORRUPT_RANDOM:
- *ptr ^= randbyte (&corrupt->u.prob) & corrupt->mask;
+ *ptr ^= randbyte (&pCorrupt->u.prob) & pCorrupt->mask;
break;
case CORRUPT_VALUE:
- *ptr = ((*ptr & ~corrupt->mask) |
- (randbyte (&corrupt->u.prob) & corrupt->mask));
+ *ptr = ((*ptr & ~pCorrupt->mask) |
+ (randbyte (&pCorrupt->u.prob) & pCorrupt->mask));
break;
}
}
diff --git a/trunk/src/mpeg2dec.c b/trunk/src/mpeg2dec.c
index 66be762..5ab12e5 100644
--- a/trunk/src/mpeg2dec.c
+++ b/trunk/src/mpeg2dec.c
@@ -516,11 +516,11 @@ static int demux (uint8_t * buf, uint8_t * end, int flags)
pts = (((header[9] >> 1) << 30) |
(header[10] << 22) | ((header[11] >> 1) << 15) |
(header[12] << 7) | (header[13] >> 1));
- dts = (!(header[7] & 0x40) ? pts :
- (((header[14] >> 1) << 30) |
+ dts = ((!(header[7] & 0x40) ? pts :
+ (uint32_t)((((header[14] >> 1) << 30) |
(header[15] << 22) |
((header[16] >> 1) << 15) |
- (header[17] << 7) | (header[18] >> 1)));
+ (header[17] << 7) | (header[18] >> 1)))));
mpeg2_tag_picture (mpeg2dec, pts, dts);
}
} else { /* mpeg1 */
@@ -552,9 +552,9 @@ static int demux (uint8_t * buf, uint8_t * end, int flags)
(ptsbuf[0] << 22) | ((ptsbuf[1] >> 1) << 15) |
(ptsbuf[2] << 7) | (ptsbuf[3] >> 1));
dts = (((ptsbuf[-1] & 0xf0) != 0x30) ? pts :
- (((ptsbuf[4] >> 1) << 30) |
+ (uint32_t)((((ptsbuf[4] >> 1) << 30) |
(ptsbuf[5] << 22) | ((ptsbuf[6] >> 1) << 15) |
- (ptsbuf[7] << 7) | (ptsbuf[18] >> 1)));
+ (ptsbuf[7] << 7) | (ptsbuf[18] >> 1))));
mpeg2_tag_picture (mpeg2dec, pts, dts);
}
}
--
1.5.3.4
-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell. From the desktop to the data center, Linux is going
mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Libmpeg2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmpeg2-devel