[poppler] 4 commits - poppler/Annot.cc poppler/Annot.h
Pino Toscano
pino at kemper.freedesktop.org
Sat Apr 12 13:45:37 PDT 2008
poppler/Annot.cc | 28 +++++++++++++++++-----------
poppler/Annot.h | 3 ++-
2 files changed, 19 insertions(+), 12 deletions(-)
New commits:
commit c3aa3a97d9c553ea7976741d798901352fb5381c
Author: Pino Toscano <pino at kde.org>
Date: Sat Apr 12 22:45:57 2008 +0200
properly initialize an AnnotPath
diff --git a/poppler/Annot.cc b/poppler/Annot.cc
index f471766..03236b7 100644
--- a/poppler/Annot.cc
+++ b/poppler/Annot.cc
@@ -175,13 +175,8 @@ AnnotBorderEffect::AnnotBorderEffect(Dict *dict) {
//------------------------------------------------------------------------
AnnotPath::AnnotPath(AnnotCoord **coords, int coordsLength) {
- if (!coords) {
- this->coords = coords;
- this->coordsLength = coordsLength;
- } else {
- this->coords = NULL;
- this->coordsLength = 0;
- }
+ this->coords = coords;
+ this->coordsLength = coordsLength;
}
AnnotPath::~AnnotPath() {
commit a3406fb2ace1390db1c181823a7bfc66c9174d98
Author: Pino Toscano <pino at kde.org>
Date: Sat Apr 12 22:40:42 2008 +0200
properly dispose the memory of the ink lists
diff --git a/poppler/Annot.cc b/poppler/Annot.cc
index 3a48ec8..f471766 100644
--- a/poppler/Annot.cc
+++ b/poppler/Annot.cc
@@ -184,6 +184,14 @@ AnnotPath::AnnotPath(AnnotCoord **coords, int coordsLength) {
}
}
+AnnotPath::~AnnotPath() {
+ if (coords) {
+ for (int i = 0; i < coordsLength; ++i)
+ delete coords[i];
+ gfree(coords);
+ }
+}
+
double AnnotPath::getX(int coord) const {
if (coord >= 0 && coord < coordsLength)
return coords[coord]->getX();
@@ -3446,8 +3454,11 @@ AnnotInk::AnnotInk(XRef *xrefA, Dict *dict, Catalog *catalog, Object *obj) :
}
AnnotInk::~AnnotInk() {
- if (inkList)
+ if (inkList) {
+ for (int i = 0; i < inkListLength; ++i)
+ delete inkList[i];
gfree(inkList);
+ }
}
void AnnotInk::initialize(XRef *xrefA, Catalog *catalog, Dict* dict) {
diff --git a/poppler/Annot.h b/poppler/Annot.h
index 4f5ca65..ca2fba4 100644
--- a/poppler/Annot.h
+++ b/poppler/Annot.h
@@ -67,6 +67,7 @@ protected:
class AnnotPath {
public:
AnnotPath(AnnotCoord **coords, int coordLength);
+ ~AnnotPath();
double getX(int coord) const;
double getY(int coord) const;
commit 0dad70e2d12e8b587cab8ce2d914c81c6897a1d1
Author: Pino Toscano <pino at kde.org>
Date: Sat Apr 12 22:15:35 2008 +0200
make AnnotInk working.
- get the point indexes in the correct way
- dispose with free what you allocate with malloc
- fix logic when checking for an even number of points
diff --git a/poppler/Annot.cc b/poppler/Annot.cc
index a410fac..3a48ec8 100644
--- a/poppler/Annot.cc
+++ b/poppler/Annot.cc
@@ -3447,7 +3447,7 @@ AnnotInk::AnnotInk(XRef *xrefA, Dict *dict, Catalog *catalog, Object *obj) :
AnnotInk::~AnnotInk() {
if (inkList)
- delete inkList;
+ gfree(inkList);
}
void AnnotInk::initialize(XRef *xrefA, Catalog *catalog, Dict* dict) {
@@ -3478,7 +3478,7 @@ AnnotPath *AnnotInk::parsePathArray(Array *array) {
AnnotCoord **coords;
GBool correct = gTrue;
- if (!array->getLength() % 2) {
+ if (array->getLength() % 2) {
error(-1, "Bad Annot Ink Path");
return NULL;
}
@@ -3490,14 +3490,14 @@ AnnotPath *AnnotInk::parsePathArray(Array *array) {
Object obj1;
double x = 0, y = 0;
- if (array->get(coordsLength * 2, &obj1)->isNum()) {
+ if (array->get(i * 2, &obj1)->isNum()) {
x = obj1.getNum();
} else {
correct = gFalse;
}
obj1.free();
- if (array->get((coordsLength * 2) + 1, &obj1)->isNum()) {
+ if (array->get((i * 2) + 1, &obj1)->isNum()) {
y = obj1.getNum();
} else {
correct = gFalse;
commit 77404e24ea1e175fc9b55097dc5b35cc34760659
Author: Pino Toscano <pino at kde.org>
Date: Sat Apr 12 21:08:54 2008 +0200
a length is an int
diff --git a/poppler/Annot.h b/poppler/Annot.h
index 7ee6755..4f5ca65 100644
--- a/poppler/Annot.h
+++ b/poppler/Annot.h
@@ -71,7 +71,7 @@ public:
double getX(int coord) const;
double getY(int coord) const;
AnnotCoord *getCoord(int coord) const;
- double getCoordsLength() const { return coordsLength; }
+ int getCoordsLength() const { return coordsLength; }
protected:
AnnotCoord **coords;
int coordsLength;
More information about the poppler
mailing list