[FFmpeg-cvslog] sanm: Change type of array pitch parameters to ptrdiff_t

Diego Biurrun git at videolan.org
Mon Mar 20 10:44:51 EET 2017


ffmpeg | branch: master | Diego Biurrun <diego at biurrun.de> | Fri Aug 26 12:44:37 2016 +0200| [5b5ed92d92252a685e891a5d636870e223b63228] | committer: Diego Biurrun

sanm: Change type of array pitch parameters to ptrdiff_t

ptrdiff_t is the correct type for array pitches and similar.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5b5ed92d92252a685e891a5d636870e223b63228
---

 libavcodec/sanm.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/libavcodec/sanm.c b/libavcodec/sanm.c
index 6436f84..3d23195 100644
--- a/libavcodec/sanm.c
+++ b/libavcodec/sanm.c
@@ -217,7 +217,7 @@ typedef struct SANMVideoContext {
     uint32_t pal[PALETTE_SIZE];
     int16_t delta_pal[PALETTE_DELTA];
 
-    int pitch;
+    ptrdiff_t pitch;
     int width, height;
     int aligned_width, aligned_height;
     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,
                        int left, int width, int height)
 {
-    int stride = ctx->pitch;
+    ptrdiff_t stride = ctx->pitch;
     int i, j, k, t;
     uint8_t *dst, *prev;
     int skip_run = 0;
@@ -809,7 +809,7 @@ static int old_codec47(SANMVideoContext *ctx, int top,
 {
     uint32_t decoded_size;
     int i, j;
-    int stride     = ctx->pitch;
+    ptrdiff_t stride = ctx->pitch;
     uint8_t *dst   = (uint8_t *)ctx->frm0 + left + top * stride;
     uint8_t *prev1 = (uint8_t *)ctx->frm1;
     uint8_t *prev2 = (uint8_t *)ctx->frm2;
@@ -962,11 +962,11 @@ static int decode_nop(SANMVideoContext *ctx)
     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 *src = (uint8_t *)psrc;
-    int stride = pitch * 2;
+    ptrdiff_t stride = pitch * 2;
 
     switch (block_size) {
     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;
 
@@ -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,
                       uint16_t fg_color, uint16_t bg_color, int block_size,
-                      int pitch)
+                      ptrdiff_t pitch)
 {
     int8_t *pglyph;
     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;
 }
 
-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;
 
@@ -1047,7 +1047,7 @@ static int opcode_0xf7(SANMVideoContext *ctx, int cx, int cy, int block_size, in
     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;
 
@@ -1317,8 +1317,8 @@ static int copy_output(SANMVideoContext *ctx, SANMFrameHeader *hdr)
 {
     uint8_t *dst;
     const uint8_t *src = (uint8_t*) ctx->frm0;
-    int ret, dstpitch, height = ctx->height;
-    int srcpitch = ctx->pitch * (hdr ? sizeof(ctx->frm0[0]) : 1);
+    int ret, height = ctx->height;
+    ptrdiff_t dstpitch, srcpitch = ctx->pitch * (hdr ? sizeof(ctx->frm0[0]) : 1);
 
     if ((ret = ff_get_buffer(ctx->avctx, ctx->frame, 0)) < 0)
         return ret;



More information about the ffmpeg-cvslog mailing list