summaryrefslogtreecommitdiff
path: root/apps/pdfclean.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 /apps/pdfclean.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 'apps/pdfclean.c')
-rw-r--r--apps/pdfclean.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/apps/pdfclean.c b/apps/pdfclean.c
index dd85b1a4..99a00845 100644
--- a/apps/pdfclean.c
+++ b/apps/pdfclean.c
@@ -27,7 +27,7 @@ static pdf_xref *xref = NULL;
void die(fz_error error)
{
- fz_catch(error, "aborting");
+ fz_error_handle(error, "aborting");
if (xref)
pdf_free_xref(xref);
exit(1);
@@ -283,7 +283,7 @@ static void retainpages(int argc, char **argv)
/* Load the old page tree */
error = pdf_load_page_tree(xref);
if (error)
- die(fz_rethrow(error, "cannot load page tree"));
+ die(fz_error_note(error, "cannot load page tree"));
/* Keep only pages/type entry to avoid references to unretained pages */
oldroot = fz_dict_gets(xref->trailer, "Root");
@@ -712,11 +712,11 @@ int main(int argc, char **argv)
error = pdf_open_xref(&xref, infile, password);
if (error)
- die(fz_rethrow(error, "cannot open input file '%s'", infile));
+ die(fz_error_note(error, "cannot open input file '%s'", infile));
out = fopen(outfile, "wb");
if (!out)
- die(fz_throw("cannot open output file '%s'", outfile));
+ die(fz_error_make("cannot open output file '%s'", outfile));
fprintf(out, "%%PDF-%d.%d\n", xref->version / 10, xref->version % 10);
fprintf(out, "%%\316\274\341\277\246\n\n");
@@ -760,7 +760,7 @@ int main(int argc, char **argv)
writepdf();
if (fclose(out))
- die(fz_throw("cannot close output file '%s'", outfile));
+ die(fz_error_make("cannot close output file '%s'", outfile));
fz_free(uselist);
fz_free(ofslist);