diff options
Diffstat (limited to 'xps/xps_tiff.c')
-rw-r--r-- | xps/xps_tiff.c | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/xps/xps_tiff.c b/xps/xps_tiff.c index 8c58b4d1..22137259 100644 --- a/xps/xps_tiff.c +++ b/xps/xps_tiff.c @@ -139,7 +139,7 @@ xps_decode_tiff_uncompressed(struct tiff *tiff, fz_stream *stm, byte *wp, int wl int n = fz_read(stm, wp, wlen); fz_close(stm); if (n < 0) - return fz_rethrow(n, "cannot read uncompressed strip"); + return fz_error_note(n, "cannot read uncompressed strip"); return fz_okay; } @@ -150,7 +150,7 @@ xps_decode_tiff_packbits(struct tiff *tiff, fz_stream *chain, byte *wp, int wlen int n = fz_read(stm, wp, wlen); fz_close(stm); if (n < 0) - return fz_rethrow(n, "cannot read packbits strip"); + return fz_error_note(n, "cannot read packbits strip"); return fz_okay; } @@ -161,7 +161,7 @@ xps_decode_tiff_lzw(struct tiff *tiff, fz_stream *chain, byte *wp, int wlen) int n = fz_read(stm, wp, wlen); fz_close(stm); if (n < 0) - return fz_rethrow(n, "cannot read lzw strip"); + return fz_error_note(n, "cannot read lzw strip"); return fz_okay; } static int @@ -171,7 +171,7 @@ xps_decode_tiff_flate(struct tiff *tiff, fz_stream *chain, byte *wp, int wlen) int n = fz_read(stm, wp, wlen); fz_close(stm); if (n < 0) - return fz_rethrow(n, "cannot read flate strip"); + return fz_error_note(n, "cannot read flate strip"); return fz_okay; } @@ -208,7 +208,7 @@ xps_decode_tiff_fax(struct tiff *tiff, int comp, fz_stream *chain, byte *wp, int fz_drop_obj(params); if (n < 0) - return fz_rethrow(n, "cannot read fax strip"); + return fz_error_note(n, "cannot read fax strip"); return fz_okay; } @@ -219,7 +219,7 @@ xps_decode_tiff_jpeg(struct tiff *tiff, fz_stream *chain, byte *wp, int wlen) int n = fz_read(stm, wp, wlen); fz_close(stm); if (n < 0) - return fz_rethrow(n, "cannot read jpeg strip"); + return fz_error_note(n, "cannot read jpeg strip"); return fz_okay; } @@ -311,10 +311,10 @@ xps_expand_tiff_colormap(struct tiff *tiff) /* image can be with or without extrasamples: comps is 1 or 2 */ if (tiff->samplesperpixel != 1 && tiff->samplesperpixel != 2) - return fz_throw("invalid number of samples for RGBPal"); + return fz_error_make("invalid number of samples for RGBPal"); if (tiff->bitspersample != 4 && tiff->bitspersample != 8) - return fz_throw("invalid number of bits for RGBPal"); + return fz_error_make("invalid number of bits for RGBPal"); stride = tiff->imagewidth * (tiff->samplesperpixel + 2); @@ -374,10 +374,10 @@ xps_decode_tiff_strips(struct tiff *tiff) unsigned i; if (!tiff->rowsperstrip || !tiff->stripoffsets || !tiff->rowsperstrip) - return fz_throw("no image data in tiff; maybe it is tiled"); + return fz_error_make("no image data in tiff; maybe it is tiled"); if (tiff->planar != 1) - return fz_throw("image data is not in chunky format"); + return fz_error_make("image data is not in chunky format"); tiff->stride = (tiff->imagewidth * tiff->samplesperpixel * tiff->bitspersample + 7) / 8; @@ -403,7 +403,7 @@ xps_decode_tiff_strips(struct tiff *tiff) tiff->colorspace = fz_device_rgb; break; default: - return fz_throw("unknown photometric: %d", tiff->photometric); + return fz_error_make("unknown photometric: %d", tiff->photometric); } switch (tiff->resolutionunit) @@ -444,7 +444,7 @@ xps_decode_tiff_strips(struct tiff *tiff) wlen = tiff->samples + tiff->stride * tiff->imagelength - wp; if (rp + rlen > tiff->ep) - return fz_throw("strip extends beyond the end of the file"); + return fz_error_make("strip extends beyond the end of the file"); /* the bits are in un-natural order */ if (tiff->fillorder == 2) @@ -472,7 +472,7 @@ xps_decode_tiff_strips(struct tiff *tiff) error = xps_decode_tiff_lzw(tiff, stm, wp, wlen); break; case 6: - error = fz_throw("deprecated JPEG in TIFF compression not supported"); + error = fz_error_make("deprecated JPEG in TIFF compression not supported"); break; case 7: error = xps_decode_tiff_jpeg(tiff, stm, wp, wlen); @@ -484,11 +484,11 @@ xps_decode_tiff_strips(struct tiff *tiff) error = xps_decode_tiff_packbits(tiff, stm, wp, wlen); break; default: - error = fz_throw("unknown TIFF compression: %d", tiff->compression); + error = fz_error_make("unknown TIFF compression: %d", tiff->compression); } if (error) - return fz_rethrow(error, "cannot decode strip %d", row / tiff->rowsperstrip); + return fz_error_note(error, "cannot decode strip %d", row / tiff->rowsperstrip); /* scramble the bits back into original order */ if (tiff->fillorder == 2) @@ -515,7 +515,7 @@ xps_decode_tiff_strips(struct tiff *tiff) { error = xps_expand_tiff_colormap(tiff); if (error) - return fz_rethrow(error, "cannot expand colormap"); + return fz_error_note(error, "cannot expand colormap"); } /* WhiteIsZero .. invert */ @@ -705,7 +705,7 @@ xps_read_tiff_tag(struct tiff *tiff, unsigned offset) case TileLength: case TileOffsets: case TileByteCounts: - return fz_throw("tiled tiffs not supported"); + return fz_error_make("tiled tiffs not supported"); default: /* printf("unknown tag: %d t=%d n=%d\n", tag, type, count); */ @@ -763,12 +763,12 @@ xps_decode_tiff_header(struct tiff *tiff, byte *buf, int len) tiff->order = TII; tiff->order = readshort(tiff); if (tiff->order != TII && tiff->order != TMM) - return fz_throw("not a TIFF file, wrong magic marker"); + return fz_error_make("not a TIFF file, wrong magic marker"); /* check version */ version = readshort(tiff); if (version != 42) - return fz_throw("not a TIFF file, wrong version marker"); + return fz_error_make("not a TIFF file, wrong version marker"); /* get offset of IFD */ offset = readlong(tiff); @@ -786,7 +786,7 @@ xps_decode_tiff_header(struct tiff *tiff, byte *buf, int len) { error = xps_read_tiff_tag(tiff, offset); if (error) - return fz_rethrow(error, "cannot read TIFF header tag"); + return fz_error_note(error, "cannot read TIFF header tag"); offset += 12; } @@ -802,7 +802,7 @@ xps_decode_tiff(fz_pixmap **imagep, byte *buf, int len) error = xps_decode_tiff_header(&tiff, buf, len); if (error) - return fz_rethrow(error, "cannot decode tiff header"); + return fz_error_note(error, "cannot decode tiff header"); /* Decode the image strips */ @@ -811,7 +811,7 @@ xps_decode_tiff(fz_pixmap **imagep, byte *buf, int len) error = xps_decode_tiff_strips(&tiff); if (error) - return fz_rethrow(error, "cannot decode image data"); + return fz_error_note(error, "cannot decode image data"); /* Byte swap 16-bit images to big endian if necessary */ if (tiff.bitspersample == 16) @@ -829,7 +829,7 @@ xps_decode_tiff(fz_pixmap **imagep, byte *buf, int len) if (tiff.stripoffsets) fz_free(tiff.stripoffsets); if (tiff.stripbytecounts) fz_free(tiff.stripbytecounts); if (tiff.samples) fz_free(tiff.samples); - return fz_throw("out of memory"); + return fz_error_make("out of memory"); } image->xres = tiff.xresolution; |