1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avoid "0xFF << 24" as it is considered a integer overflow in C99

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2012-10-14 03:17:13 +02:00
parent d3d715ff13
commit b12d92efd6
24 changed files with 29 additions and 29 deletions

View File

@ -87,7 +87,7 @@ avs_decode_frame(AVCodecContext * avctx,
buf += 4;
for (i=first; i<last; i++, buf+=3) {
pal[i] = (buf[0] << 18) | (buf[1] << 10) | (buf[2] << 2);
pal[i] |= 0xFF << 24 | (pal[i] >> 6) & 0x30303;
pal[i] |= 0xFFU << 24 | (pal[i] >> 6) & 0x30303;
}
sub_type = buf[0];

View File

@ -82,7 +82,7 @@ static int bfi_decode_frame(AVCodecContext *avctx, void *data,
pal = (uint32_t *)bfi->frame.data[1];
for (i = 0; i < avctx->extradata_size / 3; i++) {
int shift = 16;
*pal = 0xFF << 24;
*pal = 0xFFU << 24;
for (j = 0; j < 3; j++, shift -= 8)
*pal += ((avctx->extradata[i * 3 + j] << 2) |
(avctx->extradata[i * 3 + j] >> 4)) << shift;

View File

@ -227,7 +227,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
return AVERROR_INVALIDDATA;
}
for (i = 0; i < 256; i++)
c->pal[i] = 0xFF << 24 | bytestream_get_be24(&c->stream);
c->pal[i] = 0xFFU << 24 | bytestream_get_be24(&c->stream);
}
if (type & BMV_SCROLL) {
if (c->stream - pkt->data > pkt->size - 2) {

View File

@ -126,7 +126,7 @@ static void cdg_load_palette(CDGraphicsContext *cc, uint8_t *data, int low)
r = ((color >> 8) & 0x000F) * 17;
g = ((color >> 4) & 0x000F) * 17;
b = ((color ) & 0x000F) * 17;
palette[i + array_offset] = 0xFF << 24 | r << 16 | g << 8 | b;
palette[i + array_offset] = 0xFFU << 24 | r << 16 | g << 8 | b;
}
cc->frame.palette_has_changed = 1;
}

View File

@ -345,7 +345,7 @@ static int dfa_decode_frame(AVCodecContext *avctx,
pal_elems = FFMIN(chunk_size / 3, 256);
for (i = 0; i < pal_elems; i++) {
s->pal[i] = bytestream2_get_be24(&gb) << 2;
s->pal[i] |= 0xFF << 24 | (s->pal[i] >> 6) & 0x30303;
s->pal[i] |= 0xFFU << 24 | (s->pal[i] >> 6) & 0x30303;
}
s->pic.palette_has_changed = 1;
} else if (chunk_type <= 9) {

View File

@ -209,7 +209,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
r = *buf++;
g = *buf++;
b = *buf++;
c->pal[i] = 0xFF << 24 | r << 16 | g << 8 | b;
c->pal[i] = 0xFFU << 24 | r << 16 | g << 8 | b;
}
pc = 1;
buf_size -= 768+4;

View File

@ -142,7 +142,7 @@ static void cmv_process_header(CmvContext *s, const uint8_t *buf, const uint8_t
buf += 16;
for (i=pal_start; i<pal_start+pal_count && i<AVPALETTE_COUNT && buf_end - buf >= 3; i++) {
s->palette[i] = 0xFF << 24 | AV_RB24(buf);
s->palette[i] = 0xFFU << 24 | AV_RB24(buf);
buf += 3;
}
}

View File

@ -286,7 +286,7 @@ static int tgv_decode_frame(AVCodecContext *avctx,
pal_count = AV_RL16(&buf[6]);
buf += 12;
for(i=0; i<pal_count && i<AVPALETTE_COUNT && buf_end - buf >= 3; i++) {
s->palette[i] = 0xFF << 24 | AV_RB24(buf);
s->palette[i] = 0xFFU << 24 | AV_RB24(buf);
buf += 3;
}
}

View File

@ -256,7 +256,7 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx,
r = bytestream2_get_byte(&g2) << color_shift;
g = bytestream2_get_byte(&g2) << color_shift;
b = bytestream2_get_byte(&g2) << color_shift;
entry = 0xFF << 24 | r << 16 | g << 8 | b;
entry = 0xFFU << 24 | r << 16 | g << 8 | b;
if (color_shift == 2)
entry |= entry >> 6 & 0x30303;
if (s->palette[palette_ptr] != entry)

View File

@ -177,7 +177,7 @@ static int decode_frame(AVCodecContext *avctx,
if (buf_end - buf >= AVPALETTE_COUNT * 3) {
for (i = 0; i < AVPALETTE_COUNT; i++) {
uint32_t pal = AV_RB24(buf);
s->palette[i] = 0xFF << 24 | pal << 2 | ((pal >> 4) & 0x30303);
s->palette[i] = 0xFFU << 24 | pal << 2 | ((pal >> 4) & 0x30303);
buf += 3;
}
s->palette_has_changed = 1;

View File

@ -389,7 +389,7 @@ static av_cold int decode_init(AVCodecContext * avctx)
c->prev = c->frm1;
for (i = 0; i < 256; i++) {
c->pal[i] = 0xFF << 24 | i * 0x10101;
c->pal[i] = 0xFFU << 24 | i * 0x10101;
}
if (avctx->extradata_size < 12) {

View File

@ -72,7 +72,7 @@ static int mm_decode_pal(MmContext *s)
bytestream2_skip(&s->gb, 4);
for (i = 0; i < 128; i++) {
s->palette[i] = 0xFF << 24 | bytestream2_get_be24(&s->gb);
s->palette[i] = 0xFFU << 24 | bytestream2_get_be24(&s->gb);
s->palette[i+128] = s->palette[i]<<2;
}

View File

@ -129,7 +129,7 @@ static int decode_pal(MSS12Context *ctx, ArithCoder *acoder)
r = arith_get_bits(acoder, 8);
g = arith_get_bits(acoder, 8);
b = arith_get_bits(acoder, 8);
*pal++ = (0xFF << 24) | (r << 16) | (g << 8) | b;
*pal++ = (0xFFU << 24) | (r << 16) | (g << 8) | b;
}
return !!ncol;

View File

@ -645,7 +645,7 @@ av_cold int ff_mss12_decode_init(MSS12Context *c, int version,
}
for (i = 0; i < 256; i++)
c->pal[i] = 0xFF << 24 | AV_RB24(avctx->extradata + 52 +
c->pal[i] = 0xFFU << 24 | AV_RB24(avctx->extradata + 52 +
(version ? 8 : 0) + i * 3);
c->mask_stride = FFALIGN(avctx->width, 16);

View File

@ -592,10 +592,10 @@ static int decode_frame(AVCodecContext *avctx,
r = bytestream2_get_byte(&s->gb);
g = bytestream2_get_byte(&s->gb);
b = bytestream2_get_byte(&s->gb);
s->palette[i] = (0xff << 24) | (r << 16) | (g << 8) | b;
s->palette[i] = (0xFFU << 24) | (r << 16) | (g << 8) | b;
}
for(;i<256;i++) {
s->palette[i] = (0xff << 24);
s->palette[i] = (0xFFU << 24);
}
s->state |= PNG_PLTE;
bytestream2_skip(&s->gb, 4); /* crc */

View File

@ -91,7 +91,7 @@ static int decode_frame(AVCodecContext *avctx,
buf++;
b = *buf++;
buf++;
pal[idx] = 0xFF << 24 | r << 16 | g << 8 | b;
pal[idx] = 0xFFU << 24 | r << 16 | g << 8 | b;
}
p->palette_has_changed = 1;

View File

@ -154,7 +154,7 @@ static av_cold int rl2_decode_init(AVCodecContext *avctx)
/** initialize palette */
for(i=0;i<AVPALETTE_COUNT;i++)
s->palette[i] = 0xFF << 24 | AV_RB24(&avctx->extradata[6 + i * 3]);
s->palette[i] = 0xFFU << 24 | AV_RB24(&avctx->extradata[6 + i * 3]);
/** decode background frame if present */
back_size = avctx->extradata_size - EXTRADATA1_SIZE;

View File

@ -284,7 +284,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
ctx->subversion = AV_RL16(avctx->extradata);
for (i = 0; i < 256; i++)
ctx->pal[i] = 0xFF << 24 | AV_RL32(avctx->extradata + 2 + i * 4);
ctx->pal[i] = 0xFFU << 24 | AV_RL32(avctx->extradata + 2 + i * 4);
}
return 0;
@ -1172,7 +1172,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
return AVERROR_INVALIDDATA;
}
for (i = 0; i < 256; i++)
ctx->pal[i] = 0xFF << 24 | bytestream2_get_be24u(&ctx->gb);
ctx->pal[i] = 0xFFU << 24 | bytestream2_get_be24u(&ctx->gb);
break;
case MKBETAG('F', 'O', 'B', 'J'):
if (size < 16)
@ -1190,7 +1190,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
int t = (ctx->pal[i] >> (16 - j * 8)) & 0xFF;
tmp[j] = av_clip_uint8((t * 129 + ctx->delta_pal[i * 3 + j]) >> 7);
}
ctx->pal[i] = 0xFF << 24 | AV_RB24(tmp);
ctx->pal[i] = 0xFFU << 24 | AV_RB24(tmp);
}
} else {
if (size < 768 * 2 + 4) {
@ -1203,7 +1203,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
ctx->delta_pal[i] = bytestream2_get_le16u(&ctx->gb);
if (size >= 768 * 5 + 4) {
for (i = 0; i < 256; i++)
ctx->pal[i] = 0xFF << 24 | bytestream2_get_be24u(&ctx->gb);
ctx->pal[i] = 0xFFU << 24 | bytestream2_get_be24u(&ctx->gb);
} else {
memset(ctx->pal, 0, sizeof(ctx->pal));
}

View File

@ -388,7 +388,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
smk->pic.pict_type = AV_PICTURE_TYPE_P;
for(i = 0; i < 256; i++)
*pal++ = 0xFF << 24 | bytestream2_get_be24u(&gb2);
*pal++ = 0xFFU << 24 | bytestream2_get_be24u(&gb2);
last_reset(smk->mmap_tbl, smk->mmap_last);
last_reset(smk->mclr_tbl, smk->mclr_last);

View File

@ -178,7 +178,7 @@ static int seqvideo_decode(SeqVideoContext *seq, const unsigned char *data, int
for (i = 0; i < 256; i++) {
for (j = 0; j < 3; j++, data++)
c[j] = (*data << 2) | (*data >> 4);
palette[i] = 0xFF << 24 | AV_RB24(c);
palette[i] = 0xFFU << 24 | AV_RB24(c);
}
seq->frame.palette_has_changed = 1;
}

View File

@ -607,7 +607,7 @@ static int init_image(TiffContext *s)
/* make default grayscale pal */
pal = (uint32_t *) s->picture.data[1];
for (i = 0; i < 1<<s->bpp; i++)
pal[i] = 0xFF << 24 | i * 255 / ((1<<s->bpp) - 1) * 0x010101;
pal[i] = 0xFFU << 24 | i * 255 / ((1<<s->bpp) - 1) * 0x010101;
}
}
return 0;
@ -824,7 +824,7 @@ static int tiff_decode_tag(TiffContext *s)
for (k = 2; k >= 0; k--) {
for (i = 0; i < count / 3; i++) {
if (k == 2)
pal[i] = 0xff << 24;
pal[i] = 0xFFU << 24;
j = (tget(&s->gb, type, s->le) >> off) << (k * 8);
pal[i] |= j;
}

View File

@ -265,7 +265,7 @@ static void vmd_decode(VmdVideoContext *s)
r = *p++ * 4;
g = *p++ * 4;
b = *p++ * 4;
palette32[i] = 0xFF << 24 | r << 16 | g << 8 | b;
palette32[i] = 0xFFU << 24 | r << 16 | g << 8 | b;
palette32[i] |= palette32[i] >> 6 & 0x30303;
}
}

View File

@ -416,7 +416,7 @@ static int vqa_decode_chunk(VqaContext *s)
r = bytestream2_get_byteu(&s->gb) * 4;
g = bytestream2_get_byteu(&s->gb) * 4;
b = bytestream2_get_byteu(&s->gb) * 4;
s->palette[i] = 0xFF << 24 | r << 16 | g << 8 | b;
s->palette[i] = 0xFFU << 24 | r << 16 | g << 8 | b;
s->palette[i] |= s->palette[i] >> 6 & 0x30303;
}
}

View File

@ -235,7 +235,7 @@ static int yop_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
palette[i + firstcolor] = (s->srcptr[0] << 18) |
(s->srcptr[1] << 10) |
(s->srcptr[2] << 2);
palette[i + firstcolor] |= 0xFF << 24 |
palette[i + firstcolor] |= 0xFFU << 24 |
(palette[i + firstcolor] >> 6) & 0x30303;
}