summaryrefslogtreecommitdiff
path: root/fitz/res_pixmap.c
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2011-09-11 19:29:42 -0500
committerRobin Watts <robin.watts@artifex.com>2011-09-14 17:44:13 +0100
commit89ae81f651bfa112b8e07317eb6983beaf7cb212 (patch)
tree3f99dad1253b795629e66d45b915c1d72043242b /fitz/res_pixmap.c
parentcefb81f1886685580a40b17b5e495a8a8a1ebeaf (diff)
downloadmupdf-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 'fitz/res_pixmap.c')
-rw-r--r--fitz/res_pixmap.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/fitz/res_pixmap.c b/fitz/res_pixmap.c
index 83f46526..dccc62e3 100644
--- a/fitz/res_pixmap.c
+++ b/fitz/res_pixmap.c
@@ -301,11 +301,11 @@ fz_write_pnm(fz_pixmap *pixmap, char *filename)
int len;
if (pixmap->n != 1 && pixmap->n != 2 && pixmap->n != 4)
- return fz_throw("pixmap must be grayscale or rgb to write as pnm");
+ return fz_error_make("pixmap must be grayscale or rgb to write as pnm");
fp = fopen(filename, "wb");
if (!fp)
- return fz_throw("cannot open file '%s': %s", filename, strerror(errno));
+ return fz_error_make("cannot open file '%s': %s", filename, strerror(errno));
if (pixmap->n == 1 || pixmap->n == 2)
fprintf(fp, "P5\n");
@@ -361,7 +361,7 @@ fz_write_pam(fz_pixmap *pixmap, char *filename, int savealpha)
fp = fopen(filename, "wb");
if (!fp)
- return fz_throw("cannot open file '%s': %s", filename, strerror(errno));
+ return fz_error_make("cannot open file '%s': %s", filename, strerror(errno));
fprintf(fp, "P7\n");
fprintf(fp, "WIDTH %d\n", pixmap->w);
@@ -443,7 +443,7 @@ fz_write_png(fz_pixmap *pixmap, char *filename, int savealpha)
int err;
if (pixmap->n != 1 && pixmap->n != 2 && pixmap->n != 4)
- return fz_throw("pixmap must be grayscale or rgb to write as png");
+ return fz_error_make("pixmap must be grayscale or rgb to write as png");
sn = pixmap->n;
dn = pixmap->n;
@@ -488,7 +488,7 @@ fz_write_png(fz_pixmap *pixmap, char *filename, int savealpha)
{
fz_free(udata);
fz_free(cdata);
- return fz_throw("cannot compress image data");
+ return fz_error_make("cannot compress image data");
}
fp = fopen(filename, "wb");
@@ -496,7 +496,7 @@ fz_write_png(fz_pixmap *pixmap, char *filename, int savealpha)
{
fz_free(udata);
fz_free(cdata);
- return fz_throw("cannot open file '%s': %s", filename, strerror(errno));
+ return fz_error_make("cannot open file '%s': %s", filename, strerror(errno));
}
big32(head+0, pixmap->w);