diff options
author | Tor Andersson <tor@ghostscript.com> | 2010-05-14 01:49:22 +0200 |
---|---|---|
committer | Tor Andersson <tor@ghostscript.com> | 2010-05-14 01:49:22 +0200 |
commit | 08e7bb2f11ff940998daf8dbadfaaef3eaec7496 (patch) | |
tree | 260154b98a32d7b94f4ffb93e1ece9db1fa92d18 /apps/pdftool.c | |
parent | 92c591efc27373c0ae876ca55eb1f34da81ca9ec (diff) | |
download | mupdf-08e7bb2f11ff940998daf8dbadfaaef3eaec7496.tar.xz |
Change pdf_openxref to take a fz_stream instead of a filename so that windows can open files with unicode names.
Diffstat (limited to 'apps/pdftool.c')
-rw-r--r-- | apps/pdftool.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/apps/pdftool.c b/apps/pdftool.c index 44532f3d..e4034714 100644 --- a/apps/pdftool.c +++ b/apps/pdftool.c @@ -23,7 +23,9 @@ void setcleanup(void (*func)(void)) void openxref(char *filename, char *password, int dieonbadpass) { + fz_stream *file; int okay; + int fd; basename = strrchr(filename, '/'); if (!basename) @@ -31,9 +33,15 @@ void openxref(char *filename, char *password, int dieonbadpass) else basename++; - xref = pdf_openxref(filename); + fd = open(filename, O_BINARY | O_RDONLY, 0666); + if (fd < 0) + die(fz_throw("cannot open file")); + + file = fz_openfile(fd); + xref = pdf_openxref(file); if (!xref) die(-1); + fz_dropstream(file); if (pdf_needspassword(xref)) { |