summaryrefslogtreecommitdiff
path: root/apps/pdfshow.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/pdfshow.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/pdfshow.c')
-rw-r--r--apps/pdfshow.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/apps/pdfshow.c b/apps/pdfshow.c
index 5e74042b..daf31298 100644
--- a/apps/pdfshow.c
+++ b/apps/pdfshow.c
@@ -12,7 +12,7 @@ static int showcolumn;
void die(fz_error error)
{
- fz_catch(error, "aborting");
+ fz_error_handle(error, "aborting");
if (xref)
pdf_free_xref(xref);
exit(1);
@@ -30,7 +30,7 @@ static void usage(void)
static void showtrailer(void)
{
if (!xref)
- die(fz_throw("no file specified"));
+ die(fz_error_make("no file specified"));
printf("trailer\n");
fz_debug_obj(xref->trailer);
printf("\n");
@@ -39,7 +39,7 @@ static void showtrailer(void)
static void showxref(void)
{
if (!xref)
- die(fz_throw("no file specified"));
+ die(fz_error_make("no file specified"));
pdf_debug_xref(xref);
printf("\n");
}
@@ -52,13 +52,13 @@ static void showpagetree(void)
int i;
if (!xref)
- die(fz_throw("no file specified"));
+ die(fz_error_make("no file specified"));
if (!xref->page_len)
{
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"));
}
count = pdf_count_pages(xref);
@@ -131,7 +131,7 @@ static void showobject(int num, int gen)
fz_obj *obj;
if (!xref)
- die(fz_throw("no file specified"));
+ die(fz_error_make("no file specified"));
error = pdf_load_object(&obj, xref, num, gen);
if (error)
@@ -214,7 +214,7 @@ int main(int argc, char **argv)
filename = argv[fz_optind++];
error = pdf_open_xref(&xref, filename, password);
if (error)
- die(fz_rethrow(error, "cannot open document: %s", filename));
+ die(fz_error_note(error, "cannot open document: %s", filename));
if (fz_optind == argc)
showtrailer();