summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorTor Andersson <tor@ghostscript.com>2010-07-15 15:51:11 +0000
committerTor Andersson <tor@ghostscript.com>2010-07-15 15:51:11 +0000
commite76d240baef3ac18f5bb422ecd8ed3a5bc095e1a (patch)
treef106ea0806bb79b6b988e07bec00cb036c26f5be /apps
parentfb70c376624f1d2b921b8b0d31cac3d10db94ece (diff)
downloadmupdf-e76d240baef3ac18f5bb422ecd8ed3a5bc095e1a.tar.xz
Return explicit error code from pdf_openxref.
Diffstat (limited to 'apps')
-rw-r--r--apps/pdfapp.c6
-rw-r--r--apps/pdftool.c8
2 files changed, 7 insertions, 7 deletions
diff --git a/apps/pdfapp.c b/apps/pdfapp.c
index 4ec65148..145f49db 100644
--- a/apps/pdfapp.c
+++ b/apps/pdfapp.c
@@ -103,9 +103,9 @@ void pdfapp_open(pdfapp_t *app, char *filename, int fd)
*/
file = fz_openfile(fd);
- app->xref = pdf_openxref(file);
- if (!app->xref)
- pdfapp_error(app, fz_rethrow(-1, "cannot open PDF file '%s'", filename));
+ error = pdf_openxref(&app->xref, file);
+ if (error)
+ pdfapp_error(app, fz_rethrow(error, "cannot open document '%s'", filename));
fz_dropstream(file);
/*
diff --git a/apps/pdftool.c b/apps/pdftool.c
index 5724e022..094eeaa5 100644
--- a/apps/pdftool.c
+++ b/apps/pdftool.c
@@ -36,12 +36,12 @@ void openxref(char *filename, char *password, int dieonbadpass, int loadpages)
fd = open(filename, O_BINARY | O_RDONLY, 0666);
if (fd < 0)
- die(fz_throw("cannot open file '%s'", filename));
+ die(fz_throw("cannot open file '%s': %s", filename, strerror(errno)));
file = fz_openfile(fd);
- xref = pdf_openxref(file);
- if (!xref)
- die(fz_throw("cannot open PDF file '%s'", basename));
+ error = pdf_openxref(&xref, file);
+ if (error)
+ die(fz_rethrow(error, "cannot open document '%s'", basename));
fz_dropstream(file);
if (pdf_needspassword(xref))