diff options
author | Albert Astals Cid <aacid@kde.org> | 2022-02-15 17:14:44 +0100 |
---|---|---|
committer | Albert Astals Cid <aacid@kde.org> | 2022-02-15 18:25:12 +0100 |
commit | 07889cdfd8a261dc5ae6eb72c26a8a3ec2e35930 (patch) | |
tree | 3c7b221789cc6ddcec923e967e5d4c818d313f79 /glib | |
parent | 47256c3c2905ade19f21224cb48ff5bb7de43a03 (diff) |
Make PDFDoc constructor take the filename as unique_ptr
Makes it clear that it will own the given GooString
Diffstat (limited to 'glib')
-rw-r--r-- | glib/poppler-document.cc | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc index 29172833..00991937 100644 --- a/glib/poppler-document.cc +++ b/glib/poppler-document.cc @@ -222,16 +222,13 @@ PopplerDocument *poppler_document_new_from_file(const char *uri, const char *pas } delete[] filenameW; #else - GooString *filename_g; - filename_g = new GooString(filename); - newDoc = new PDFDoc(filename_g, password_g, password_g); + newDoc = new PDFDoc(std::make_unique<GooString>(filename), password_g, password_g); if (!newDoc->isOk() && newDoc->getErrorCode() == errEncrypted && password) { /* Try again with original password (which comes from GTK in UTF8) Issue #824 */ - filename_g = filename_g->copy(); delete newDoc; delete password_g; password_g = new GooString(password); - newDoc = new PDFDoc(filename_g, password_g, password_g); + newDoc = new PDFDoc(std::make_unique<GooString>(filename), password_g, password_g); } #endif g_free(filename); |