diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2017-04-26 14:30:32 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2017-04-27 15:12:03 +0200 |
commit | cabf4489896a2a978361eb6e1df4b4aef81193f4 (patch) | |
tree | 42c304158abc24dcec776b1a38f14f4db6eaa95f /source | |
parent | 2208034206c6085fa07063bcc6fdc834d6472912 (diff) | |
download | mupdf-cabf4489896a2a978361eb6e1df4b4aef81193f4.tar.xz |
Move fz_outline and pdf_xref debug printing to pdfshow.c
That's where it's actually being used.
Diffstat (limited to 'source')
-rw-r--r-- | source/fitz/outline.c | 47 | ||||
-rw-r--r-- | source/pdf/pdf-xref.c | 18 | ||||
-rw-r--r-- | source/tools/pdfshow.c | 35 |
3 files changed, 34 insertions, 66 deletions
diff --git a/source/fitz/outline.c b/source/fitz/outline.c index 4948110c..ba894ab0 100644 --- a/source/fitz/outline.c +++ b/source/fitz/outline.c @@ -27,50 +27,3 @@ fz_drop_outline(fz_context *ctx, fz_outline *outline) outline = next; } } - -static void -fz_debug_outline_xml_imp(fz_context *ctx, fz_output *out, fz_outline *outline, int level) -{ - while (outline) - { - fz_write_printf(ctx, out, "<outline title=%q uri=\"%s\"", outline->title, outline->uri); - if (outline->down) - { - fz_write_printf(ctx, out, ">\n"); - fz_debug_outline_xml_imp(ctx, out, outline->down, level + 1); - fz_write_printf(ctx, out, "</outline>\n"); - } - else - { - fz_write_printf(ctx, out, " />\n"); - } - outline = outline->next; - } -} - -void -fz_print_outline_xml(fz_context *ctx, fz_output *out, fz_outline *outline) -{ - fz_debug_outline_xml_imp(ctx, out, outline, 0); -} - -static void -fz_print_outline_imp(fz_context *ctx, fz_output *out, fz_outline *outline, int level) -{ - int i; - while (outline) - { - for (i = 0; i < level; i++) - fz_write_printf(ctx, out, "\t"); - fz_write_printf(ctx, out, "%s\t%s\n", outline->title, outline->uri); - if (outline->down) - fz_print_outline_imp(ctx, out, outline->down, level + 1); - outline = outline->next; - } -} - -void -fz_print_outline(fz_context *ctx, fz_output *out, fz_outline *outline) -{ - fz_print_outline_imp(ctx, out, outline, 0); -} diff --git a/source/pdf/pdf-xref.c b/source/pdf/pdf-xref.c index 2fa6ffc9..2b1513fe 100644 --- a/source/pdf/pdf-xref.c +++ b/source/pdf/pdf-xref.c @@ -1550,24 +1550,6 @@ pdf_drop_document(fz_context *ctx, pdf_document *doc) fz_drop_document(ctx, &doc->super); } -void -pdf_print_xref(fz_context *ctx, pdf_document *doc) -{ - int i; - int xref_len = pdf_xref_len(ctx, doc); - printf("xref\n0 %d\n", xref_len); - for (i = 0; i < xref_len; i++) - { - pdf_xref_entry *entry = pdf_get_xref_entry(ctx, doc, i); - printf("%05d: %010d %05d %c (stm_ofs=%d; stm_buf=%p)\n", i, - (int)entry->ofs, - entry->gen, - entry->type ? entry->type : '-', - (int)entry->stm_ofs, - entry->stm_buf); - } -} - /* * compressed object streams */ diff --git a/source/tools/pdfshow.c b/source/tools/pdfshow.c index 71d2b4ca..0ae0fce7 100644 --- a/source/tools/pdfshow.c +++ b/source/tools/pdfshow.c @@ -48,6 +48,24 @@ static void showencrypt(void) fz_write_printf(ctx, out, "\n"); } +void +pdf_print_xref(fz_context *ctx, pdf_document *doc) +{ + int i; + int xref_len = pdf_xref_len(ctx, doc); + printf("xref\n0 %d\n", xref_len); + for (i = 0; i < xref_len; i++) + { + pdf_xref_entry *entry = pdf_get_xref_entry(ctx, doc, i); + printf("%05d: %010d %05d %c (stm_ofs=%d; stm_buf=%p)\n", i, + (int)entry->ofs, + entry->gen, + entry->type ? entry->type : '-', + (int)entry->stm_ofs, + entry->stm_buf); + } +} + static void showxref(void) { if (!doc) @@ -195,6 +213,21 @@ static void showgrep(char *filename) fz_write_printf(ctx, out, "\n"); } +static void +fz_print_outline(fz_context *ctx, fz_output *out, fz_outline *outline, int level) +{ + int i; + while (outline) + { + for (i = 0; i < level; i++) + fz_write_printf(ctx, out, "\t"); + fz_write_printf(ctx, out, "%s\t%s\n", outline->title, outline->uri); + if (outline->down) + fz_print_outline(ctx, out, outline->down, level + 1); + outline = outline->next; + } +} + static void showoutline(void) { fz_outline *outline = fz_load_outline(ctx, (fz_document*)doc); @@ -204,7 +237,7 @@ static void showoutline(void) fz_try(ctx) { out = fz_stdout(ctx); - fz_print_outline(ctx, out, outline); + fz_print_outline(ctx, out, outline, 0); } fz_always(ctx) { |