[gs-commits] mupdf 1.16.1.59 Avoid signedness issues in list device.
[email protected] (Sebastian Rasmussen) Tue, 1 Oct 2019 14:55:50 +0000 (UTC)
| Newsgroups | gmane.comp.printing.ghostscript.cvs |
|---|---|
| Message-ID | <[email protected]> |
commit 805d42eee07a429a21024e1672425a1445fffc2e Author: Sebastian Rasmussen <[email protected]> Date: Fri Sep 27 17:52:17 2019 +0200 Avoid signedness issues in list device. diff --git a/include/mupdf/fitz/path.h b/include/mupdf/fitz/path.h index 68b1aeb..5ad498e 100644 --- a/include/mupdf/fitz/path.h +++ b/include/mupdf/fitz/path.h @@ -70,7 +70,7 @@ void fz_trim_path(fz_context *ctx, fz_path *path); int fz_packed_path_size(const fz_path *path); -int fz_pack_path(fz_context *ctx, uint8_t *pack, int max, const fz_path *path); +int fz_pack_path(fz_context *ctx, uint8_t *pack, size_t max, const fz_path *path); fz_path *fz_clone_path(fz_context *ctx, fz_path *path); diff --git a/source/fitz/list-device.c b/source/fitz/list-device.c index 4e4f384..5d52e75 100644 --- a/source/fitz/list-device.c +++ b/source/fitz/list-device.c @@ -120,8 +120,8 @@ struct fz_display_list_s fz_storable storable; fz_display_node *list; fz_rect mediabox; - int max; - int len; + size_t max; + size_t len; }; struct fz_list_device_s @@ -453,7 +453,7 @@ fz_append_display_node( } if (path && (writer->path == NULL || path != writer->path)) { - int max = SIZE_IN_NODES(MAX_NODE_SIZE) - size - SIZE_IN_NODES(private_data_len); + size_t max = SIZE_IN_NODES(MAX_NODE_SIZE) - size - SIZE_IN_NODES(private_data_len); path_size = SIZE_IN_NODES(fz_pack_path(ctx, NULL, max, path)); node.path = 1; path_off = size; @@ -462,7 +462,7 @@ fz_append_display_node( } if (private_data != NULL) { - int max = SIZE_IN_NODES(MAX_NODE_SIZE) - size; + size_t max = SIZE_IN_NODES(MAX_NODE_SIZE) - size; if (SIZE_IN_NODES(private_data_len) > max) fz_throw(ctx, FZ_ERROR_GENERIC, "Private data too large to pack into display list node"); private_off = size; @@ -471,7 +471,7 @@ fz_append_display_node( while (list->len + size > list->max) { - int newsize = list->max * 2; + size_t newsize = list->max * 2; fz_display_node *old = list->list; ptrdiff_t diff; int i, n; diff --git a/source/fitz/path.c b/source/fitz/path.c index 07712c9..8347875 100644 --- a/source/fitz/path.c +++ b/source/fitz/path.c @@ -187,10 +187,10 @@ int fz_packed_path_size(const fz_path *path) forget about the details. */ int -fz_pack_path(fz_context *ctx, uint8_t *pack_, int max, const fz_path *path) +fz_pack_path(fz_context *ctx, uint8_t *pack_, size_t max, const fz_path *path) { uint8_t *ptr; - int size; + size_t size; if (path->packed) fz_throw(ctx, FZ_ERROR_GENERIC, "Can't repack a packed path"); http://git.ghostscript.com/?p=mupdf.git;a=commit;h=805d42eee07a429a21024e1672425a1445fffc2e -- MuPDF library Artifex Software, Inc.