diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2011-09-21 15:01:36 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2011-09-21 15:01:36 +0200 |
commit | aa7668835afffd5a2a496a60ed6edb672f5af1a7 (patch) | |
tree | 92bc58eb4ee9d4f3b30f9b9919aa148b1e330471 /xps | |
parent | 69ed4a8f4dbfac7f2f1de925e34807e4fee3b27c (diff) | |
download | mupdf-aa7668835afffd5a2a496a60ed6edb672f5af1a7.tar.xz |
Rename malloc functions for arrays (fz_calloc and fz_realloc).
Diffstat (limited to 'xps')
-rw-r--r-- | xps/xps_gradient.c | 4 | ||||
-rw-r--r-- | xps/xps_path.c | 2 | ||||
-rw-r--r-- | xps/xps_png.c | 4 | ||||
-rw-r--r-- | xps/xps_tiff.c | 8 | ||||
-rw-r--r-- | xps/xps_zip.c | 10 |
5 files changed, 15 insertions, 13 deletions
diff --git a/xps/xps_gradient.c b/xps/xps_gradient.c index 0c73fd65..4dcf1ef8 100644 --- a/xps/xps_gradient.c +++ b/xps/xps_gradient.c @@ -227,7 +227,7 @@ xps_draw_one_radial_gradient(xps_context *ctx, fz_matrix ctm, shade->mesh_len = 6; shade->mesh_cap = 6; - shade->mesh = fz_calloc(ctx->ctx, shade->mesh_cap, sizeof(float)); + shade->mesh = fz_malloc_array(ctx->ctx, shade->mesh_cap, sizeof(float)); shade->mesh[0] = x0; shade->mesh[1] = y0; shade->mesh[2] = r0; @@ -268,7 +268,7 @@ xps_draw_one_linear_gradient(xps_context *ctx, fz_matrix ctm, shade->mesh_len = 6; shade->mesh_cap = 6; - shade->mesh = fz_calloc(ctx->ctx, shade->mesh_cap, sizeof(float)); + shade->mesh = fz_malloc_array(ctx->ctx, shade->mesh_cap, sizeof(float)); shade->mesh[0] = x0; shade->mesh[1] = y0; shade->mesh[2] = 0; diff --git a/xps/xps_path.c b/xps/xps_path.c index 89d88511..28548c56 100644 --- a/xps/xps_path.c +++ b/xps/xps_path.c @@ -234,7 +234,7 @@ xps_parse_abbreviated_geometry(xps_context *ctx, char *geom, int *fill_rule) path = fz_new_path(ctx->ctx); - args = fz_calloc(ctx->ctx, strlen(geom) + 1, sizeof(char*)); + args = fz_malloc_array(ctx->ctx, strlen(geom) + 1, sizeof(char*)); pargs = args; while (*s) diff --git a/xps/xps_png.c b/xps/xps_png.c index 5a866dcc..4c8b5150 100644 --- a/xps/xps_png.c +++ b/xps/xps_png.c @@ -62,7 +62,7 @@ static const unsigned char png_signature[8] = static void *zalloc(void *opaque, unsigned int items, unsigned int size) { - return fz_calloc(opaque, items, size); + return fz_malloc_array(opaque, items, size); } static void zfree(void *opaque, void *address) @@ -189,7 +189,7 @@ png_deinterlace(struct info *info, int *passw, int *passh, int *passofs) unsigned char *output; int p, x, y, k; - output = fz_calloc(info->ctx, info->height, stride); + output = fz_malloc_array(info->ctx, info->height, stride); for (p = 0; p < 7; p++) { diff --git a/xps/xps_tiff.c b/xps/xps_tiff.c index faef1ca7..a777fdaa 100644 --- a/xps/xps_tiff.c +++ b/xps/xps_tiff.c @@ -430,7 +430,7 @@ xps_decode_tiff_strips(struct tiff *tiff) tiff->yresolution = 96; } - tiff->samples = fz_calloc(tiff->ctx, tiff->imagelength, tiff->stride); + tiff->samples = fz_malloc_array(tiff->ctx, tiff->imagelength, tiff->stride); memset(tiff->samples, 0x55, tiff->imagelength * tiff->stride); wp = tiff->samples; @@ -689,17 +689,17 @@ xps_read_tiff_tag(struct tiff *tiff, unsigned offset) break; case StripOffsets: - tiff->stripoffsets = fz_calloc(tiff->ctx, count, sizeof(unsigned)); + tiff->stripoffsets = fz_malloc_array(tiff->ctx, count, sizeof(unsigned)); xps_read_tiff_tag_value(tiff->stripoffsets, tiff, type, value, count); break; case StripByteCounts: - tiff->stripbytecounts = fz_calloc(tiff->ctx, count, sizeof(unsigned)); + tiff->stripbytecounts = fz_malloc_array(tiff->ctx, count, sizeof(unsigned)); xps_read_tiff_tag_value(tiff->stripbytecounts, tiff, type, value, count); break; case ColorMap: - tiff->colormap = fz_calloc(tiff->ctx, count, sizeof(unsigned)); + tiff->colormap = fz_malloc_array(tiff->ctx, count, sizeof(unsigned)); xps_read_tiff_tag_value(tiff->colormap, tiff, type, value, count); break; diff --git a/xps/xps_zip.c b/xps/xps_zip.c index ad1c30b1..880db0d4 100644 --- a/xps/xps_zip.c +++ b/xps/xps_zip.c @@ -44,7 +44,7 @@ static inline int getlong(fz_stream *file) static void * xps_zip_alloc_items(xps_context *ctx, int items, int size) { - return fz_calloc(ctx->ctx, items, size); + return fz_malloc_array(ctx->ctx, items, size); } static void @@ -177,7 +177,7 @@ xps_read_zip_dir(xps_context *ctx, int start_offset) offset = getlong(ctx->file); /* offset to central directory */ ctx->zip_count = count; - ctx->zip_table = fz_calloc(ctx->ctx, count, sizeof(xps_entry)); + ctx->zip_table = fz_malloc_array(ctx->ctx, count, sizeof(xps_entry)); fz_seek(ctx->file, offset, 0); @@ -395,7 +395,8 @@ xps_open_directory(fz_context *fctx, xps_context **ctxp, char *directory) xps_context *ctx; int code; - ctx = fz_calloc(fctx, 1, sizeof(xps_context)); + ctx = fz_malloc(fctx, sizeof(xps_context)); + memset(ctx, 0, sizeof *ctx); ctx->directory = fz_strdup(fctx, directory); ctx->ctx = fctx; @@ -417,7 +418,8 @@ xps_open_stream(xps_context **ctxp, fz_stream *file) xps_context *ctx; int code; - ctx = fz_calloc(file->ctx, 1, sizeof(xps_context)); + ctx = fz_malloc(file->ctx, sizeof(xps_context)); + memset(ctx, 0, sizeof *ctx); ctx->ctx = file->ctx; ctx->file = fz_keep_stream(file); |