diff options
author | Tor Andersson <tor@ghostscript.com> | 2005-05-26 09:34:56 +0200 |
---|---|---|
committer | Tor Andersson <tor@ghostscript.com> | 2005-05-26 09:34:56 +0200 |
commit | 987d58dfaf4030f43b2a8854e2d246f75465cc57 (patch) | |
tree | 430eeedbebfdc278a9fc88afa134c96dacc073b4 /apps/pdfdebug.c | |
parent | 4bb1d274f49678af1612179d632ebcca7666f235 (diff) | |
download | mupdf-987d58dfaf4030f43b2a8854e2d246f75465cc57.tar.xz |
new stream api
Diffstat (limited to 'apps/pdfdebug.c')
-rw-r--r-- | apps/pdfdebug.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/apps/pdfdebug.c b/apps/pdfdebug.c index bb2d57e2..1ae84d7c 100644 --- a/apps/pdfdebug.c +++ b/apps/pdfdebug.c @@ -43,47 +43,49 @@ void printsafe(unsigned char *buf, int n) void decodestream(pdf_xref *xref, int oid, int gid) { fz_error *error; + fz_stream *stm; unsigned char buf[512]; safecol = 0; - error = pdf_openstream(xref, oid, gid); + error = pdf_openstream(&stm, xref, oid, gid); if (error) fz_abort(error); while (1) { - int n = fz_read(xref->stream, buf, sizeof buf); + int n = fz_read(stm, buf, sizeof buf); if (n == 0) break; if (n < 0) - fz_abort(fz_ferror(xref->stream)); + fz_abort(fz_throw("ioerror: read failed")); printsafe(buf, n); } - pdf_closestream(xref); + fz_dropstream(stm); } void copystream(pdf_xref *xref, int oid, int gid) { fz_error *error; + fz_stream *stm; unsigned char buf[512]; safecol = 0; - error = pdf_openrawstream(xref, oid, gid); + error = pdf_openrawstream(&stm, xref, oid, gid); if (error) fz_abort(error); while (1) { - int n = fz_read(xref->stream, buf, sizeof buf); + int n = fz_read(stm, buf, sizeof buf); if (n == 0) break; if (n < 0) - fz_abort(fz_ferror(xref->stream)); + fz_abort(fz_throw("ioerror: read failed")); printsafe(buf, n); } - pdf_closestream(xref); + fz_dropstream(stm); } void printobject(pdf_xref *xref, int oid, int gid) |