X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=pdf%2Fxpdf%2FCatalog.cc;h=ad0821bc5c872c67972d253af4f9124e8d111e7d;hb=884f739665dc56e66f51e104350f2affd33f2dd8;hp=1212e2eb3469ab4afe628fddfc21c0fb913b66ad;hpb=2a393c134fe3fe8eb85bf818cb7ad6ae4396322a;p=evince.git diff --git a/pdf/xpdf/Catalog.cc b/pdf/xpdf/Catalog.cc index 1212e2eb..ad0821bc 100644 --- a/pdf/xpdf/Catalog.cc +++ b/pdf/xpdf/Catalog.cc @@ -2,15 +2,16 @@ // // Catalog.cc // -// Copyright 1996-2002 Glyph & Cog, LLC +// Copyright 1996-2003 Glyph & Cog, LLC // //======================================================================== -#ifdef __GNUC__ +#include + +#ifdef USE_GCC_PRAGMAS #pragma implementation #endif -#include #include #include "gmem.h" #include "Object.h" @@ -26,7 +27,7 @@ // Catalog //------------------------------------------------------------------------ -Catalog::Catalog(XRef *xrefA, GBool printCommands) { +Catalog::Catalog(XRef *xrefA) { Object catDict, pagesDict; Object obj, obj2; int numPages0; @@ -69,7 +70,7 @@ Catalog::Catalog(XRef *xrefA, GBool printCommands) { pageRefs[i].num = -1; pageRefs[i].gen = -1; } - numPages = readPageTree(pagesDict.getDict(), NULL, 0, printCommands); + numPages = readPageTree(pagesDict.getDict(), NULL, 0); if (numPages != numPages0) { error(-1, "Page count in top-level pages object is incorrect"); } @@ -100,6 +101,9 @@ Catalog::Catalog(XRef *xrefA, GBool printCommands) { // get the structure tree root catDict.dictLookup("StructTreeRoot", &structTreeRoot); + // get the outline dictionary + catDict.dictLookup("Outlines", &outline); + catDict.free(); return; @@ -133,6 +137,7 @@ Catalog::~Catalog() { } metadata.free(); structTreeRoot.free(); + outline.free(); } GString *Catalog::readMetadata() { @@ -159,8 +164,7 @@ GString *Catalog::readMetadata() { return s; } -int Catalog::readPageTree(Dict *pagesDict, PageAttrs *attrs, int start, - GBool printCommands) { +int Catalog::readPageTree(Dict *pagesDict, PageAttrs *attrs, int start) { Object kids; Object kid; Object kidRef; @@ -179,7 +183,7 @@ int Catalog::readPageTree(Dict *pagesDict, PageAttrs *attrs, int start, kids.arrayGet(i, &kid); if (kid.isDict("Page")) { attrs2 = new PageAttrs(attrs1, kid.getDict()); - page = new Page(xref, start+1, kid.getDict(), attrs2, printCommands); + page = new Page(xref, start+1, kid.getDict(), attrs2); if (!page->isOk()) { ++start; goto err3; @@ -205,7 +209,7 @@ int Catalog::readPageTree(Dict *pagesDict, PageAttrs *attrs, int start, // This should really be isDict("Pages"), but I've seen at least one // PDF file where the /Type entry is missing. } else if (kid.isDict()) { - if ((start = readPageTree(kid.getDict(), attrs1, start, printCommands)) + if ((start = readPageTree(kid.getDict(), attrs1, start)) < 0) goto err2; } else { @@ -276,6 +280,10 @@ LinkDest *Catalog::findDest(GString *name) { error(-1, "Bad named destination value"); } obj1.free(); + if (dest && !dest->isOk()) { + delete dest; + dest = NULL; + } return dest; }