summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2011-12-09 16:45:23 +0000
committerRobin Watts <robin.watts@artifex.com>2011-12-09 16:45:23 +0000
commitfc0912d1c9a5327191fc0328b364bfd2068d3470 (patch)
tree61144cb180cb08d094824ec431dd5ac388398a7f
parent145087f15002b65666ca21e57f17e46528318ea0 (diff)
downloadmupdf-fc0912d1c9a5327191fc0328b364bfd2068d3470.tar.xz
Fix pdfdraw "repairing" every document.
When adding the exception handling in, I'd mis-indented some code. This caused all the file to be read.
-rw-r--r--pdf/pdf_xref.c70
1 files changed, 35 insertions, 35 deletions
diff --git a/pdf/pdf_xref.c b/pdf/pdf_xref.c
index 87a71aaf..d781f0c9 100644
--- a/pdf/pdf_xref.c
+++ b/pdf/pdf_xref.c
@@ -705,51 +705,51 @@ pdf_open_xref_with_stream(fz_stream *file, char *password)
if (repaired)
{
pdf_repair_obj_stms(xref);
- }
-
- hasroot = (fz_dict_gets(xref->trailer, "Root") != NULL);
- hasinfo = (fz_dict_gets(xref->trailer, "Info") != NULL);
- for (i = 1; i < xref->len; i++)
- {
- if (xref->table[i].type == 0 || xref->table[i].type == 'f')
- continue;
+ hasroot = (fz_dict_gets(xref->trailer, "Root") != NULL);
+ hasinfo = (fz_dict_gets(xref->trailer, "Info") != NULL);
- fz_try(ctx)
+ for (i = 1; i < xref->len; i++)
{
- dict = pdf_load_object(xref, i, 0);
- }
- fz_catch(ctx)
- {
- fz_warn(ctx, "ignoring broken object (%d 0 R)", i);
- continue;
- }
+ if (xref->table[i].type == 0 || xref->table[i].type == 'f')
+ continue;
- if (!hasroot)
- {
- obj = fz_dict_gets(dict, "Type");
- if (fz_is_name(obj) && !strcmp(fz_to_name(obj), "Catalog"))
+ fz_try(ctx)
{
- nobj = fz_new_indirect(ctx, i, 0, xref);
- fz_dict_puts(xref->trailer, "Root", nobj);
- fz_drop_obj(nobj);
- nobj = NULL;
+ dict = pdf_load_object(xref, i, 0);
+ }
+ fz_catch(ctx)
+ {
+ fz_warn(ctx, "ignoring broken object (%d 0 R)", i);
+ continue;
}
- }
- if (!hasinfo)
- {
- if (fz_dict_gets(dict, "Creator") || fz_dict_gets(dict, "Producer"))
+ if (!hasroot)
{
- nobj = fz_new_indirect(ctx, i, 0, xref);
- fz_dict_puts(xref->trailer, "Info", nobj);
- fz_drop_obj(nobj);
- nobj = NULL;
+ obj = fz_dict_gets(dict, "Type");
+ if (fz_is_name(obj) && !strcmp(fz_to_name(obj), "Catalog"))
+ {
+ nobj = fz_new_indirect(ctx, i, 0, xref);
+ fz_dict_puts(xref->trailer, "Root", nobj);
+ fz_drop_obj(nobj);
+ nobj = NULL;
+ }
}
- }
- fz_drop_obj(dict);
- dict = NULL;
+ if (!hasinfo)
+ {
+ if (fz_dict_gets(dict, "Creator") || fz_dict_gets(dict, "Producer"))
+ {
+ nobj = fz_new_indirect(ctx, i, 0, xref);
+ fz_dict_puts(xref->trailer, "Info", nobj);
+ fz_drop_obj(nobj);
+ nobj = NULL;
+ }
+ }
+
+ fz_drop_obj(dict);
+ dict = NULL;
+ }
}
}
fz_catch(ctx)