sanm: Change type of array pitch parameters to ptrdiff_t

ptrdiff_t is the correct type for array pitches and similar.
This commit is contained in:
Diego Biurrun 2016-08-26 12:44:37 +02:00
parent 73f5e17a20
commit 5b5ed92d92

View File

@ -217,7 +217,7 @@ typedef struct SANMVideoContext {
uint32_t pal[PALETTE_SIZE]; uint32_t pal[PALETTE_SIZE];
int16_t delta_pal[PALETTE_DELTA]; int16_t delta_pal[PALETTE_DELTA];
int pitch; ptrdiff_t pitch;
int width, height; int width, height;
int aligned_width, aligned_height; int aligned_width, aligned_height;
int prev_seq; int prev_seq;
@ -571,7 +571,7 @@ static inline void codec37_mv(uint8_t *dst, const uint8_t *src,
static int old_codec37(SANMVideoContext *ctx, int top, static int old_codec37(SANMVideoContext *ctx, int top,
int left, int width, int height) int left, int width, int height)
{ {
int stride = ctx->pitch; ptrdiff_t stride = ctx->pitch;
int i, j, k, t; int i, j, k, t;
uint8_t *dst, *prev; uint8_t *dst, *prev;
int skip_run = 0; int skip_run = 0;
@ -809,7 +809,7 @@ static int old_codec47(SANMVideoContext *ctx, int top,
{ {
uint32_t decoded_size; uint32_t decoded_size;
int i, j; int i, j;
int stride = ctx->pitch; ptrdiff_t stride = ctx->pitch;
uint8_t *dst = (uint8_t *)ctx->frm0 + left + top * stride; uint8_t *dst = (uint8_t *)ctx->frm0 + left + top * stride;
uint8_t *prev1 = (uint8_t *)ctx->frm1; uint8_t *prev1 = (uint8_t *)ctx->frm1;
uint8_t *prev2 = (uint8_t *)ctx->frm2; uint8_t *prev2 = (uint8_t *)ctx->frm2;
@ -962,11 +962,11 @@ static int decode_nop(SANMVideoContext *ctx)
return AVERROR_PATCHWELCOME; return AVERROR_PATCHWELCOME;
} }
static void copy_block(uint16_t *pdest, uint16_t *psrc, int block_size, int pitch) static void copy_block(uint16_t *pdest, uint16_t *psrc, int block_size, ptrdiff_t pitch)
{ {
uint8_t *dst = (uint8_t *)pdest; uint8_t *dst = (uint8_t *)pdest;
uint8_t *src = (uint8_t *)psrc; uint8_t *src = (uint8_t *)psrc;
int stride = pitch * 2; ptrdiff_t stride = pitch * 2;
switch (block_size) { switch (block_size) {
case 2: case 2:
@ -981,7 +981,7 @@ static void copy_block(uint16_t *pdest, uint16_t *psrc, int block_size, int pitc
} }
} }
static void fill_block(uint16_t *pdest, uint16_t color, int block_size, int pitch) static void fill_block(uint16_t *pdest, uint16_t color, int block_size, ptrdiff_t pitch)
{ {
int x, y; int x, y;
@ -993,7 +993,7 @@ static void fill_block(uint16_t *pdest, uint16_t color, int block_size, int pitc
static int draw_glyph(SANMVideoContext *ctx, uint16_t *dst, int index, static int draw_glyph(SANMVideoContext *ctx, uint16_t *dst, int index,
uint16_t fg_color, uint16_t bg_color, int block_size, uint16_t fg_color, uint16_t bg_color, int block_size,
int pitch) ptrdiff_t pitch)
{ {
int8_t *pglyph; int8_t *pglyph;
uint16_t colors[2] = { fg_color, bg_color }; uint16_t colors[2] = { fg_color, bg_color };
@ -1013,7 +1013,7 @@ static int draw_glyph(SANMVideoContext *ctx, uint16_t *dst, int index,
return 0; return 0;
} }
static int opcode_0xf7(SANMVideoContext *ctx, int cx, int cy, int block_size, int pitch) static int opcode_0xf7(SANMVideoContext *ctx, int cx, int cy, int block_size, ptrdiff_t pitch)
{ {
uint16_t *dst = ctx->frm0 + cx + cy * ctx->pitch; uint16_t *dst = ctx->frm0 + cx + cy * ctx->pitch;
@ -1047,7 +1047,7 @@ static int opcode_0xf7(SANMVideoContext *ctx, int cx, int cy, int block_size, in
return 0; return 0;
} }
static int opcode_0xf8(SANMVideoContext *ctx, int cx, int cy, int block_size, int pitch) static int opcode_0xf8(SANMVideoContext *ctx, int cx, int cy, int block_size, ptrdiff_t pitch)
{ {
uint16_t *dst = ctx->frm0 + cx + cy * ctx->pitch; uint16_t *dst = ctx->frm0 + cx + cy * ctx->pitch;
@ -1317,8 +1317,8 @@ static int copy_output(SANMVideoContext *ctx, SANMFrameHeader *hdr)
{ {
uint8_t *dst; uint8_t *dst;
const uint8_t *src = (uint8_t*) ctx->frm0; const uint8_t *src = (uint8_t*) ctx->frm0;
int ret, dstpitch, height = ctx->height; int ret, height = ctx->height;
int srcpitch = ctx->pitch * (hdr ? sizeof(ctx->frm0[0]) : 1); ptrdiff_t dstpitch, srcpitch = ctx->pitch * (hdr ? sizeof(ctx->frm0[0]) : 1);
if ((ret = ff_get_buffer(ctx->avctx, ctx->frame, 0)) < 0) if ((ret = ff_get_buffer(ctx->avctx, ctx->frame, 0)) < 0)
return ret; return ret;