From 1601a39b098652ee6354e735ee9259082892f282 Mon Sep 17 00:00:00 2001 From: James Zern Date: Wed, 8 Feb 2012 12:30:30 -0800 Subject: [PATCH] silence some type size related warnings size_t/ptrdiff_t -> uint32_t Change-Id: Ic4d889b9239752311b9ed906c83076829d850874 --- src/dec/webp.c | 4 +++- src/enc/syntax.c | 6 ++++-- src/mux/muxedit.c | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/dec/webp.c b/src/dec/webp.c index d54ccbf6..b9024969 100644 --- a/src/dec/webp.c +++ b/src/dec/webp.c @@ -13,6 +13,7 @@ #include "./vp8i.h" #include "./webpi.h" +#include "../mux/muxi.h" // For MAX_CHUNK_PAYLOAD. #include "../webp/mux.h" // For 'ALPHA_FLAG'. #if defined(__cplusplus) || defined(c_plusplus) @@ -257,7 +258,8 @@ VP8StatusCode WebPParseHeaders(const uint8_t** data, uint32_t* data_size, *vp8_size = vp8_size_tmp; } - *bytes_skipped = buf - *data; + *bytes_skipped = (uint32_t)(buf - *data); + assert(buf - *data < MAX_CHUNK_PAYLOAD); assert(*bytes_skipped == *data_size - buf_size); *data = buf; *data_size = buf_size; diff --git a/src/enc/syntax.c b/src/enc/syntax.c index 3c9f729d..43a283a1 100644 --- a/src/enc/syntax.c +++ b/src/enc/syntax.c @@ -54,7 +54,8 @@ static WebPEncodingError PutRIFFHeader(const VP8Encoder* const enc, uint8_t riff[RIFF_HEADER_SIZE] = { 'R', 'I', 'F', 'F', 0, 0, 0, 0, 'W', 'E', 'B', 'P' }; - PutLE32(riff + TAG_SIZE, riff_size); + assert(riff_size == (uint32_t)riff_size); + PutLE32(riff + TAG_SIZE, (uint32_t)riff_size); if (!pic->writer(riff, sizeof(riff), pic)) { return VP8_ENC_ERROR_BAD_WRITE; } @@ -115,7 +116,8 @@ static WebPEncodingError PutVP8Header(const WebPPicture* const pic, uint8_t vp8_chunk_hdr[CHUNK_HEADER_SIZE] = { 'V', 'P', '8', ' ' }; - PutLE32(vp8_chunk_hdr + TAG_SIZE, vp8_size); + assert(vp8_size == (uint32_t)vp8_size); + PutLE32(vp8_chunk_hdr + TAG_SIZE, (uint32_t)vp8_size); if (!pic->writer(vp8_chunk_hdr, sizeof(vp8_chunk_hdr), pic)) { return VP8_ENC_ERROR_BAD_WRITE; } diff --git a/src/mux/muxedit.c b/src/mux/muxedit.c index 4befc292..203c034d 100644 --- a/src/mux/muxedit.c +++ b/src/mux/muxedit.c @@ -548,7 +548,7 @@ static WebPMuxError CreateVP8XChunk(WebPMux* const mux) { uint32_t width = 0; uint32_t height = 0; uint8_t data[VP8X_CHUNK_SIZE]; - const size_t data_size = VP8X_CHUNK_SIZE; + const uint32_t data_size = VP8X_CHUNK_SIZE; const WebPMuxImage* images = NULL; images = mux->images_; // First image.