summaryrefslogtreecommitdiff
path: root/xps
diff options
context:
space:
mode:
Diffstat (limited to 'xps')
-rw-r--r--xps/xps_jpeg.c7
-rw-r--r--xps/xps_png.c7
-rw-r--r--xps/xps_tiff.c7
3 files changed, 15 insertions, 6 deletions
diff --git a/xps/xps_jpeg.c b/xps/xps_jpeg.c
index 381baffd..4e937a31 100644
--- a/xps/xps_jpeg.c
+++ b/xps/xps_jpeg.c
@@ -94,8 +94,11 @@ xps_decode_jpeg(fz_context *ctx, byte *rbuf, int rlen)
else
fz_throw(ctx, "bad number of components in jpeg: %d", cinfo.output_components);
- image = fz_new_pixmap_with_limit(ctx, colorspace, cinfo.output_width, cinfo.output_height);
- if (!image)
+ fz_try(ctx)
+ {
+ image = fz_new_pixmap(ctx, colorspace, cinfo.output_width, cinfo.output_height);
+ }
+ fz_catch(ctx)
{
jpeg_finish_decompress(&cinfo);
jpeg_destroy_decompress(&cinfo);
diff --git a/xps/xps_png.c b/xps/xps_png.c
index a396b433..719e522f 100644
--- a/xps/xps_png.c
+++ b/xps/xps_png.c
@@ -516,8 +516,11 @@ xps_decode_png(fz_context *ctx, byte *p, int total)
stride = (png.width * png.n * png.depth + 7) / 8;
- image = fz_new_pixmap_with_limit(ctx, colorspace, png.width, png.height);
- if (!image)
+ fz_try(ctx)
+ {
+ image = fz_new_pixmap(ctx, colorspace, png.width, png.height);
+ }
+ fz_catch(ctx)
{
fz_free(png.ctx, png.samples);
fz_throw(ctx, "out of memory");
diff --git a/xps/xps_tiff.c b/xps/xps_tiff.c
index 38430710..01e5be9b 100644
--- a/xps/xps_tiff.c
+++ b/xps/xps_tiff.c
@@ -782,8 +782,11 @@ xps_decode_tiff(fz_context *ctx, byte *buf, int len)
/* Expand into fz_pixmap struct */
- image = fz_new_pixmap_with_limit(tiff.ctx, tiff.colorspace, tiff.imagewidth, tiff.imagelength);
- if (!image)
+ fz_try(ctx)
+ {
+ image = fz_new_pixmap(tiff.ctx, tiff.colorspace, tiff.imagewidth, tiff.imagelength);
+ }
+ fz_catch(ctx)
{
if (tiff.colormap) fz_free(ctx, tiff.colormap);
if (tiff.stripoffsets) fz_free(ctx, tiff.stripoffsets);