[poppler] poppler/Link.cc
Carlos Garcia Campos
carlosgc at kemper.freedesktop.org
Fri Dec 14 03:39:16 PST 2007
poppler/Link.cc | 36 ++++++++++++++++++++++++++++--------
1 file changed, 28 insertions(+), 8 deletions(-)
New commits:
commit 0820a93ba1c0e893681024feb9f9bd120a9eeb4d
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date: Fri Dec 14 12:38:58 2007 +0100
Check whether top and left should be changed in FitH, FitV, FitBH and FitBV destinations
According to the spec, if a null value is specified for top or left parameter in such
destinations, the parameter should be retained unchanged.
diff --git a/poppler/Link.cc b/poppler/Link.cc
index ffdd95b..887132f 100644
--- a/poppler/Link.cc
+++ b/poppler/Link.cc
@@ -293,11 +293,16 @@ LinkDest::LinkDest(Array *a) {
goto err2;
}
kind = destFitH;
- if (!a->get(2, &obj2)->isNum()) {
+ a->get(2, &obj2);
+ if (obj2.isNull()) {
+ changeTop = gFalse;
+ } else if (obj2.isNum()) {
+ changeTop = gTrue;
+ top = obj2.getNum();
+ } else {
error(-1, "Bad annotation destination position");
kind = destFit;
}
- top = obj2.getNum();
obj2.free();
// FitV link
@@ -307,11 +312,16 @@ LinkDest::LinkDest(Array *a) {
goto err2;
}
kind = destFitV;
- if (!a->get(2, &obj2)->isNum()) {
+ a->get(2, &obj2);
+ if (obj2.isNull()) {
+ changeLeft = gFalse;
+ } else if (obj2.isNum()) {
+ changeLeft = gTrue;
+ left = obj2.getNum();
+ } else {
error(-1, "Bad annotation destination position");
kind = destFit;
}
- left = obj2.getNum();
obj2.free();
// FitR link
@@ -361,11 +371,16 @@ LinkDest::LinkDest(Array *a) {
goto err2;
}
kind = destFitBH;
- if (!a->get(2, &obj2)->isNum()) {
+ a->get(2, &obj2);
+ if (obj2.isNull()) {
+ changeTop = gFalse;
+ } else if (obj2.isNum()) {
+ changeTop = gTrue;
+ top = obj2.getNum();
+ } else {
error(-1, "Bad annotation destination position");
kind = destFit;
}
- top = obj2.getNum();
obj2.free();
// FitBV link
@@ -375,11 +390,16 @@ LinkDest::LinkDest(Array *a) {
goto err2;
}
kind = destFitBV;
- if (!a->get(2, &obj2)->isNum()) {
+ a->get(2, &obj2);
+ if (obj2.isNull()) {
+ changeLeft = gFalse;
+ } else if (obj2.isNum()) {
+ changeLeft = gTrue;
+ left = obj2.getNum();
+ } else {
error(-1, "Bad annotation destination position");
kind = destFit;
}
- left = obj2.getNum();
obj2.free();
// unknown link kind
More information about the poppler
mailing list