diff options
author | Robin Watts <robin.watts@artifex.com> | 2016-11-02 20:02:40 +0000 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2016-11-03 18:10:50 +0000 |
commit | 6e2a71d0b743c105c71f88a7ed1de0851cdd90ca (patch) | |
tree | 8bd6d452d6b4686f509e6478edf13f267621d6f3 /source/fitz | |
parent | 0289421f68b810cee600a5a047507091ff4731df (diff) | |
download | mupdf-6e2a71d0b743c105c71f88a7ed1de0851cdd90ca.tar.xz |
Fix signed/unsigned and size_t/int/fz_off_t warnings.
All seen in MSVC, mostly in 64bit builds.
Diffstat (limited to 'source/fitz')
-rw-r--r-- | source/fitz/filter-basic.c | 8 | ||||
-rw-r--r-- | source/fitz/load-pnm.c | 6 | ||||
-rw-r--r-- | source/fitz/load-tiff.c | 10 | ||||
-rw-r--r-- | source/fitz/output.c | 2 | ||||
-rw-r--r-- | source/fitz/stream-open.c | 6 | ||||
-rw-r--r-- | source/fitz/stream-prog.c | 2 | ||||
-rw-r--r-- | source/fitz/unzip.c | 2 |
7 files changed, 18 insertions, 18 deletions
diff --git a/source/fitz/filter-basic.c b/source/fitz/filter-basic.c index 0211442c..0bc5525a 100644 --- a/source/fitz/filter-basic.c +++ b/source/fitz/filter-basic.c @@ -39,8 +39,8 @@ next_null(fz_context *ctx, fz_stream *stm, size_t max) return EOF; state->chain->rp += n; state->remain -= n; - state->offset += n; - stm->pos += n; + state->offset += (fz_off_t)n; + stm->pos += (fz_off_t)n; return *stm->rp++; } @@ -104,7 +104,7 @@ next_concat(fz_context *ctx, fz_stream *stm, size_t max) { stm->rp = state->chain[state->current]->rp; stm->wp = state->chain[state->current]->wp; - stm->pos += n; + stm->pos += (fz_off_t)n; return *stm->rp++; } else @@ -576,7 +576,7 @@ next_arc4(fz_context *ctx, fz_stream *stm, size_t max) stm->wp = state->buffer + n; fz_arc4_encrypt(&state->arc4, stm->rp, state->chain->rp, n); state->chain->rp += n; - stm->pos += n; + stm->pos += (fz_off_t)n; return *stm->rp++; } diff --git a/source/fitz/load-pnm.c b/source/fitz/load-pnm.c index 1bb5098b..4c827e43 100644 --- a/source/fitz/load-pnm.c +++ b/source/fitz/load-pnm.c @@ -253,7 +253,7 @@ pnm_ascii_read_image(fz_context *ctx, struct info *pnm, unsigned char *p, unsign fz_throw(ctx, FZ_ERROR_GENERIC, "image height must be > 0"); if (pnm->width <= 0) fz_throw(ctx, FZ_ERROR_GENERIC, "image width must be > 0"); - if (pnm->height > UINT_MAX / pnm->width / fz_colorspace_n(ctx, pnm->cs) / (pnm->bitdepth / 8 + 1)) + if ((unsigned int)pnm->height > UINT_MAX / pnm->width / fz_colorspace_n(ctx, pnm->cs) / (pnm->bitdepth / 8 + 1)) fz_throw(ctx, FZ_ERROR_GENERIC, "image too large"); if (!onlymeta) @@ -332,7 +332,7 @@ pnm_binary_read_image(fz_context *ctx, struct info *pnm, unsigned char *p, unsig fz_throw(ctx, FZ_ERROR_GENERIC, "image height must be > 0"); if (pnm->width <= 0) fz_throw(ctx, FZ_ERROR_GENERIC, "image width must be > 0"); - if (pnm->height > UINT_MAX / pnm->width / fz_colorspace_n(ctx, pnm->cs) / (pnm->bitdepth / 8 + 1)) + if ((unsigned int)pnm->height > UINT_MAX / pnm->width / fz_colorspace_n(ctx, pnm->cs) / (pnm->bitdepth / 8 + 1)) fz_throw(ctx, FZ_ERROR_GENERIC, "image too large"); if (!onlymeta) @@ -494,7 +494,7 @@ pam_binary_read_image(fz_context *ctx, struct info *pnm, unsigned char *p, unsig fz_throw(ctx, FZ_ERROR_GENERIC, "image height must be > 0"); if (pnm->width <= 0) fz_throw(ctx, FZ_ERROR_GENERIC, "image width must be > 0"); - if (pnm->height > UINT_MAX / pnm->width / fz_colorspace_n(ctx, pnm->cs) / (pnm->bitdepth / 8 + 1)) + if ((unsigned int)pnm->height > UINT_MAX / pnm->width / fz_colorspace_n(ctx, pnm->cs) / (pnm->bitdepth / 8 + 1)) fz_throw(ctx, FZ_ERROR_GENERIC, "image too large"); if (!onlymeta) diff --git a/source/fitz/load-tiff.c b/source/fitz/load-tiff.c index a2c081ca..60b0e8a6 100644 --- a/source/fitz/load-tiff.c +++ b/source/fitz/load-tiff.c @@ -377,7 +377,7 @@ tiff_decode_data(fz_context *ctx, struct tiff *tiff, unsigned char *rp, unsigned fz_throw(ctx, FZ_ERROR_GENERIC, "unknown TIFF compression: %d", tiff->compression); } - size = fz_read(ctx, stm, wp, wlen); + size = (unsigned)fz_read(ctx, stm, wp, wlen); } fz_always(ctx) { @@ -471,8 +471,8 @@ tiff_paste_subsampled_tile(fz_context *ctx, struct tiff *tiff, unsigned char *ti unsigned char *src = tile; unsigned char *dst; - int x, y, w, h; /* coordinates and dimensions of entire image */ - int sx, sy, sw, sh; /* coordinates and dimensions of a single subsample region, i.e. max 4 x 4 samples */ + unsigned x, y, w, h; /* coordinates and dimensions of entire image */ + unsigned sx, sy, sw, sh; /* coordinates and dimensions of a single subsample region, i.e. max 4 x 4 samples */ int k; int offsets[4 * 4 * 3]; /* for a pixel position, these point to all pixel components in a subsample region */ int *offset = offsets; @@ -583,7 +583,7 @@ tiff_decode_tiles(fz_context *ctx, struct tiff *tiff) unsigned int offset = tiff->tileoffsets[tile]; unsigned int rlen = tiff->tilebytecounts[tile]; unsigned char *rp = tiff->bp + offset; - int decoded; + unsigned decoded; if (offset > (unsigned)(tiff->ep - tiff->bp)) fz_throw(ctx, FZ_ERROR_GENERIC, "invalid tile offset %u", offset); @@ -1035,7 +1035,7 @@ tiff_read_ifd(fz_context *ctx, struct tiff *tiff) static void tiff_ycc_to_rgb(fz_context *ctx, struct tiff *tiff) { - int x, y; + unsigned x, y; for (y = 0; y < tiff->imagelength; y++) { diff --git a/source/fitz/output.c b/source/fitz/output.c index ee3f5b6f..3133116c 100644 --- a/source/fitz/output.c +++ b/source/fitz/output.c @@ -193,7 +193,7 @@ static fz_off_t buffer_tell(fz_context *ctx, void *opaque) { fz_buffer *buffer = opaque; - return buffer->len; + return (fz_off_t)buffer->len; } static void diff --git a/source/fitz/stream-open.c b/source/fitz/stream-open.c index cb80b4f3..e70fc0e9 100644 --- a/source/fitz/stream-open.c +++ b/source/fitz/stream-open.c @@ -78,7 +78,7 @@ static int next_file(fz_context *ctx, fz_stream *stm, size_t n) fz_throw(ctx, FZ_ERROR_GENERIC, "read error: %s", strerror(errno)); stm->rp = state->buffer; stm->wp = state->buffer + n; - stm->pos += n; + stm->pos += (fz_off_t)n; if (n == 0) return EOF; @@ -206,7 +206,7 @@ fz_open_buffer(fz_context *ctx, fz_buffer *buf) stm->rp = buf->data; stm->wp = buf->data + buf->len; - stm->pos = buf->len; + stm->pos = (fz_off_t)buf->len; return stm; } @@ -222,7 +222,7 @@ fz_open_memory(fz_context *ctx, unsigned char *data, size_t len) stm->rp = data; stm->wp = data + len; - stm->pos = len; + stm->pos = (fz_off_t)len; return stm; } diff --git a/source/fitz/stream-prog.c b/source/fitz/stream-prog.c index 042df96f..7aa4b339 100644 --- a/source/fitz/stream-prog.c +++ b/source/fitz/stream-prog.c @@ -43,7 +43,7 @@ static int next_prog(fz_context *ctx, fz_stream *stm, size_t len) fz_throw(ctx, FZ_ERROR_GENERIC, "read error: %s", strerror(errno)); stm->rp = ps->buffer + stm->pos; stm->wp = ps->buffer + stm->pos + n; - stm->pos += n; + stm->pos += (fz_off_t)n; if (n == 0) return EOF; return *stm->rp++; diff --git a/source/fitz/unzip.c b/source/fitz/unzip.c index cb9ccc40..491322fd 100644 --- a/source/fitz/unzip.c +++ b/source/fitz/unzip.c @@ -232,7 +232,7 @@ static void ensure_zip_entries(fz_context *ctx, fz_zip_archive *zip) while (back < maxback) { - fz_seek(ctx, file, size - back, 0); + fz_seek(ctx, file, (fz_off_t)(size - back), 0); n = fz_read(ctx, file, buf, sizeof buf); if (n < 4) break; |