summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Sander <oliver.sander@tu-dresden.de>2020-01-27 16:11:16 +0100
committerAlbert Astals Cid <tsdgeos@yahoo.es>2020-02-23 16:46:59 +0000
commit5d9a9c85bc27f7375a57f6c84913c8e0adcc38d1 (patch)
tree15811340cf303f91176a4e899d629db4e8494913
parent42eebb9bade006ceb602805c474bc9df5ef630b9 (diff)
Use a std::string value in LinkMovie
-rw-r--r--glib/poppler-action.cc9
-rw-r--r--poppler/Link.cc13
-rw-r--r--poppler/Link.h10
3 files changed, 12 insertions, 20 deletions
diff --git a/glib/poppler-action.cc b/glib/poppler-action.cc
index 3851a390..cbd78d85 100644
--- a/glib/poppler-action.cc
+++ b/glib/poppler-action.cc
@@ -436,7 +436,7 @@ find_annot_movie_for_action (PopplerDocument *document,
annotObj = xref->fetch (*ref);
} else if (link->hasAnnotTitle ()) {
- const GooString *title = link->getAnnotTitle ();
+ const std::string& title = link->getAnnotTitle ();
int i;
for (i = 1; i <= document->doc->getNumPages (); ++i) {
@@ -457,11 +457,8 @@ find_annot_movie_for_action (PopplerDocument *document,
}
obj1 = annotObj.dictLookup ("T");
- if (obj1.isString()) {
- const GooString *t = obj1.getString ();
-
- if (title->cmp(t) == 0)
- found = true;
+ if (obj1.isString() && obj1.getString()->toStr() == title) {
+ found = true;
}
}
if (!found)
diff --git a/poppler/Link.cc b/poppler/Link.cc
index 0aca017a..cd5ca00a 100644
--- a/poppler/Link.cc
+++ b/poppler/Link.cc
@@ -627,7 +627,7 @@ LinkNamed::~LinkNamed() {
LinkMovie::LinkMovie(const Object *obj) {
annotRef = Ref::INVALID();
- annotTitle = nullptr;
+ hasAnnotTitleFlag = false;
const Object &annotationObj = obj->dictLookupNF("Annotation");
if (annotationObj.isRef()) {
@@ -636,10 +636,11 @@ LinkMovie::LinkMovie(const Object *obj) {
Object tmp = obj->dictLookup("T");
if (tmp.isString()) {
- annotTitle = tmp.getString()->copy();
+ annotTitle = tmp.getString()->toStr();
+ hasAnnotTitleFlag = true;
}
- if ((annotTitle == nullptr) && (annotRef == Ref::INVALID())) {
+ if ((!hasAnnotTitleFlag) && (annotRef == Ref::INVALID())) {
error(errSyntaxError, -1,
"Movie action is missing both the Annot and T keys");
}
@@ -663,12 +664,6 @@ LinkMovie::LinkMovie(const Object *obj) {
}
}
-LinkMovie::~LinkMovie() {
- if (annotTitle) {
- delete annotTitle;
- }
-}
-
//------------------------------------------------------------------------
// LinkSound
//------------------------------------------------------------------------
diff --git a/poppler/Link.h b/poppler/Link.h
index f3b2d787..1e1bfd88 100644
--- a/poppler/Link.h
+++ b/poppler/Link.h
@@ -306,25 +306,25 @@ public:
};
LinkMovie(const Object *obj);
- ~LinkMovie() override;
- bool isOk() const override { return hasAnnotRef() || hasAnnotTitle(); }
+ bool isOk() const override { return hasAnnotRef() || hasAnnotTitleFlag; }
LinkActionKind getKind() const override { return actionMovie; }
// a movie action stores either an indirect reference to a movie annotation
// or the movie annotation title
bool hasAnnotRef() const { return annotRef != Ref::INVALID(); }
- bool hasAnnotTitle() const { return annotTitle != nullptr; }
+ bool hasAnnotTitle() const { return hasAnnotTitleFlag; }
const Ref *getAnnotRef() const { return &annotRef; }
- const GooString *getAnnotTitle() const { return annotTitle; }
+ const std::string& getAnnotTitle() const { return annotTitle; }
OperationType getOperation() const { return operation; }
private:
Ref annotRef; // Annotation
- GooString *annotTitle; // T
+ std::string annotTitle; // T
+ bool hasAnnotTitleFlag;
OperationType operation; // Operation
};