summaryrefslogtreecommitdiff
path: root/noncore/unsupported/qpdf/xpdf/Link.cc
Side-by-side diff
Diffstat (limited to 'noncore/unsupported/qpdf/xpdf/Link.cc') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/qpdf/xpdf/Link.cc34
1 files changed, 15 insertions, 19 deletions
diff --git a/noncore/unsupported/qpdf/xpdf/Link.cc b/noncore/unsupported/qpdf/xpdf/Link.cc
index 79a5f6e..c25ec43 100644
--- a/noncore/unsupported/qpdf/xpdf/Link.cc
+++ b/noncore/unsupported/qpdf/xpdf/Link.cc
@@ -4,3 +4,3 @@
//
-// Copyright 1996 Derek B. Noonburg
+// Copyright 1996-2002 Glyph & Cog, LLC
//
@@ -31,3 +31,3 @@ static GString *getFileSpecName(Object *fileSpecObj);
-LinkDest::LinkDest(Array *a, GBool pageIsRefA) {
+LinkDest::LinkDest(Array *a) {
Object obj1, obj2;
@@ -35,3 +35,2 @@ LinkDest::LinkDest(Array *a, GBool pageIsRefA) {
// initialize fields
- pageIsRef = pageIsRefA;
left = bottom = right = top = zoom = 0;
@@ -40,18 +39,15 @@ LinkDest::LinkDest(Array *a, GBool pageIsRefA) {
// get page
- if (pageIsRef) {
- if (!a->getNF(0, &obj1)->isRef()) {
- error(-1, "Bad annotation destination");
- goto err2;
- }
+ a->getNF(0, &obj1);
+ if (obj1.isInt()) {
+ pageNum = obj1.getInt() + 1;
+ pageIsRef = gFalse;
+ } else if (obj1.isRef()) {
pageRef.num = obj1.getRefNum();
pageRef.gen = obj1.getRefGen();
- obj1.free();
+ pageIsRef = gTrue;
} else {
- if (!a->get(0, &obj1)->isInt()) {
- error(-1, "Bad annotation destination");
- goto err2;
- }
- pageNum = obj1.getInt() + 1;
- obj1.free();
+ error(-1, "Bad annotation destination");
+ goto err2;
}
+ obj1.free();
@@ -223,3 +219,3 @@ LinkGoTo::LinkGoTo(Object *destObj) {
} else if (destObj->isArray()) {
- dest = new LinkDest(destObj->getArray(), gTrue);
+ dest = new LinkDest(destObj->getArray());
if (!dest->isOk()) {
@@ -261,3 +257,3 @@ LinkGoToR::LinkGoToR(Object *fileSpecObj, Object *destObj) {
} else if (destObj->isArray()) {
- dest = new LinkDest(destObj->getArray(), gFalse);
+ dest = new LinkDest(destObj->getArray());
if (!dest->isOk()) {
@@ -448,3 +444,3 @@ Link::Link(Dict *dict, GString *baseURI) {
// get border
- borderW = 0;
+ borderW = 1;
if (!dict->lookup("Border", &obj1)->isNull()) {
@@ -584,3 +580,3 @@ LinkAction *Links::find(fouble x, fouble y) {
- for (i = 0; i < numLinks; ++i) {
+ for (i = numLinks - 1; i >= 0; --i) {
if (links[i]->inRect(x, y)) {