diff options
author | Robin Watts <robin.watts@artifex.com> | 2011-09-11 19:29:42 -0500 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2011-09-14 17:44:13 +0100 |
commit | 89ae81f651bfa112b8e07317eb6983beaf7cb212 (patch) | |
tree | 3f99dad1253b795629e66d45b915c1d72043242b /xps/xps_image.c | |
parent | cefb81f1886685580a40b17b5e495a8a8a1ebeaf (diff) | |
download | mupdf-89ae81f651bfa112b8e07317eb6983beaf7cb212.tar.xz |
Initial import of exception handling code
Import exception handling code from WSS, modified to fit into the
fitz world.
With this code we have 'real' fz_try/fz_catch/fz_rethrow functions,
handling a fz_except type. We therefore rename the existing fz_throw/
fz_catch/fz_rethrow to be fz_error_make/fz_error_handle/fz_error_note.
We don't actually use fz_try/fz_catch/fz_rethrow yet...
Diffstat (limited to 'xps/xps_image.c')
-rw-r--r-- | xps/xps_image.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/xps/xps_image.c b/xps/xps_image.c index 4a347435..5a9d7b13 100644 --- a/xps/xps_image.c +++ b/xps/xps_image.c @@ -7,32 +7,32 @@ xps_decode_image(fz_pixmap **imagep, byte *buf, int len) int error; if (len < 8) - return fz_throw("unknown image file format"); + return fz_error_make("unknown image file format"); if (buf[0] == 0xff && buf[1] == 0xd8) { error = xps_decode_jpeg(imagep, buf, len); if (error) - return fz_rethrow(error, "cannot decode jpeg image"); + return fz_error_note(error, "cannot decode jpeg image"); } else if (memcmp(buf, "\211PNG\r\n\032\n", 8) == 0) { error = xps_decode_png(imagep, buf, len); if (error) - return fz_rethrow(error, "cannot decode png image"); + return fz_error_note(error, "cannot decode png image"); } else if (memcmp(buf, "II", 2) == 0 && buf[2] == 0xBC) { - return fz_throw("JPEG-XR codec is not available"); + return fz_error_make("JPEG-XR codec is not available"); } else if (memcmp(buf, "MM", 2) == 0 || memcmp(buf, "II", 2) == 0) { error = xps_decode_tiff(imagep, buf, len); if (error) - return fz_rethrow(error, "cannot decode TIFF image"); + return fz_error_note(error, "cannot decode TIFF image"); } else - return fz_throw("unknown image file format"); + return fz_error_make("unknown image file format"); return fz_okay; } @@ -117,7 +117,7 @@ xps_parse_image_brush(xps_context *ctx, fz_matrix ctm, fz_rect area, code = xps_decode_image(&image, part->data, part->size); if (code < 0) { xps_free_part(ctx, part); - fz_catch(-1, "cannot decode image resource"); + fz_error_handle(-1, "cannot decode image resource"); return; } |