Commit 5d9a9c85 authored by Oliver Sander's avatar Oliver Sander Committed by Albert Astals Cid

Use a std::string value in LinkMovie

parent 42eebb9b
......@@ -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)
......
......@@ -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
//------------------------------------------------------------------------
......
......@@ -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
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment