diff options
author | Tor Andersson <tor@ghostscript.com> | 2004-10-06 11:36:25 +0200 |
---|---|---|
committer | Tor Andersson <tor@ghostscript.com> | 2004-10-06 11:36:25 +0200 |
commit | 59bd2f5bfc486b107c4bd689bd65ea7d23e2fad0 (patch) | |
tree | 2331c04f638f4144eb26163d7585f54dd5542876 /test/pdfdebug.c | |
parent | 57575cabd50c4fdadb7de8ed5dec5702be7c3954 (diff) | |
download | mupdf-59bd2f5bfc486b107c4bd689bd65ea7d23e2fad0.tar.xz |
hashtable and object store memory bugs
Diffstat (limited to 'test/pdfdebug.c')
-rw-r--r-- | test/pdfdebug.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/test/pdfdebug.c b/test/pdfdebug.c index ddc10dff..1009849f 100644 --- a/test/pdfdebug.c +++ b/test/pdfdebug.c @@ -5,10 +5,11 @@ static char *password = ""; static int dodecode = 0; static int dorepair = 0; static int doprintxref = 0; +static int dosave = 0; void usage() { - fprintf(stderr, "usage: pdfdebug [-drx] [-u password] file.pdf [oid ...]\n"); + fprintf(stderr, "usage: pdfdebug [-drxs] [-u password] file.pdf [oid ...]\n"); exit(1); } @@ -43,9 +44,13 @@ void printsafe(unsigned char *buf, int n) void decodestream(pdf_xref *xref, fz_obj *stream, int oid, int gid, int ofs) { + FILE *copy; fz_error *error; unsigned char buf[512]; + if (dosave) + copy = fopen("/tmp/dump.stm", "wb"); + safecol = 0; error = pdf_openstream0(xref, stream, oid, gid, ofs); @@ -59,8 +64,14 @@ void decodestream(pdf_xref *xref, fz_obj *stream, int oid, int gid, int ofs) if (n < 0) fz_abort(fz_ferror(xref->file)); printsafe(buf, n); + + if (dosave) + fwrite(buf, 1, n, copy); } + if (dosave) + fclose(copy); + pdf_closestream(xref); } @@ -133,10 +144,13 @@ int main(int argc, char **argv) pdf_xref *xref; int c; - while ((c = getopt(argc, argv, "drxopu:")) != -1) + while ((c = getopt(argc, argv, "drxsopu:")) != -1) { switch (c) { + case 's': + dodecode ++; + dosave ++; case 'd': dodecode ++; break; |