[poppler] poppler/Link.cc poppler/Link.h utils/HtmlOutputDev.cc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Feb 10 13:52:17 UTC 2022


 poppler/Link.cc        |   21 +--------------------
 poppler/Link.h         |    7 +------
 utils/HtmlOutputDev.cc |    8 ++++----
 3 files changed, 6 insertions(+), 30 deletions(-)

New commits:
commit 7a429c3cf9fba67ee736a52aa4f12e0c177f1405
Author: Albert Astals Cid <aacid at kde.org>
Date:   Thu Feb 10 14:44:13 2022 +0100

    Remove LinkDest::copy
    
    The class is perfectly copyable by the default compiler provided copy
    constructor

diff --git a/poppler/Link.cc b/poppler/Link.cc
index 11ef879b..69b83995 100644
--- a/poppler/Link.cc
+++ b/poppler/Link.cc
@@ -16,7 +16,7 @@
 // Copyright (C) 2006, 2008 Pino Toscano <pino at kde.org>
 // Copyright (C) 2007, 2010, 2011 Carlos Garcia Campos <carlosgc at gnome.org>
 // Copyright (C) 2008 Hugo Mercier <hmercier31 at gmail.com>
-// Copyright (C) 2008-2010, 2012-2014, 2016-2021 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2008-2010, 2012-2014, 2016-2022 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2009 Kovid Goyal <kovid at kovidgoyal.net>
 // Copyright (C) 2009 Ilya Gorenbein <igorenbein at finjan.com>
 // Copyright (C) 2012 Tobias Koening <tobias.koenig at kdab.com>
@@ -408,25 +408,6 @@ LinkDest::LinkDest(const Array *a)
     ok = true;
 }
 
-LinkDest::LinkDest(const LinkDest *dest)
-{
-    kind = dest->kind;
-    pageIsRef = dest->pageIsRef;
-    if (pageIsRef)
-        pageRef = dest->pageRef;
-    else
-        pageNum = dest->pageNum;
-    left = dest->left;
-    bottom = dest->bottom;
-    right = dest->right;
-    top = dest->top;
-    zoom = dest->zoom;
-    changeLeft = dest->changeLeft;
-    changeTop = dest->changeTop;
-    changeZoom = dest->changeZoom;
-    ok = true;
-}
-
 //------------------------------------------------------------------------
 // LinkGoTo
 //------------------------------------------------------------------------
diff --git a/poppler/Link.h b/poppler/Link.h
index c058eb7f..3cd78e33 100644
--- a/poppler/Link.h
+++ b/poppler/Link.h
@@ -17,7 +17,7 @@
 // Copyright (C) 2008 Hugo Mercier <hmercier31 at gmail.com>
 // Copyright (C) 2010, 2011 Carlos Garcia Campos <carlosgc at gnome.org>
 // Copyright (C) 2012 Tobias Koening <tobias.koenig at kdab.com>
-// Copyright (C) 2018-2021 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2018-2022 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info at kdab.com>. Work sponsored by the LiMux project of the city of Munich
 // Copyright (C) 2018 Intevation GmbH <intevation at intevation.de>
 // Copyright (C) 2019, 2020 Oliver Sander <oliver.sander at tu-dresden.de>
@@ -119,9 +119,6 @@ public:
     // Build a LinkDest from the array.
     explicit LinkDest(const Array *a);
 
-    // Copy a LinkDest.
-    LinkDest *copy() const { return new LinkDest(this); }
-
     // Was the LinkDest created successfully?
     bool isOk() const { return ok; }
 
@@ -154,8 +151,6 @@ private:
                      //   destFitH/BH use changeTop;
                      //   destFitV/BV use changeLeft
     bool ok; // set if created successfully
-
-    explicit LinkDest(const LinkDest *dest);
 };
 
 //------------------------------------------------------------------------
diff --git a/utils/HtmlOutputDev.cc b/utils/HtmlOutputDev.cc
index 7564b3e4..5d697a58 100644
--- a/utils/HtmlOutputDev.cc
+++ b/utils/HtmlOutputDev.cc
@@ -17,7 +17,7 @@
 // All changes made under the Poppler project to this file are licensed
 // under GPL version 2 or later
 //
-// Copyright (C) 2005-2013, 2016-2021 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2005-2013, 2016-2022 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2008 Kjartan Maraas <kmaraas at gnome.org>
 // Copyright (C) 2008 Boris Toloknov <tlknv at yandex.ru>
 // Copyright (C) 2008 Haruyuki Kawabe <Haruyuki.Kawabe at unisys.co.jp>
@@ -1507,7 +1507,7 @@ GooString *HtmlOutputDev::getLinkDest(AnnotLink *link)
         LinkGoTo *ha = (LinkGoTo *)link->getAction();
         std::unique_ptr<LinkDest> dest;
         if (ha->getDest() != nullptr)
-            dest = std::unique_ptr<LinkDest>(ha->getDest()->copy());
+            dest = std::make_unique<LinkDest>(*ha->getDest());
         else if (ha->getNamedDest() != nullptr)
             dest = catalog->findDest(ha->getNamedDest());
 
@@ -1556,7 +1556,7 @@ GooString *HtmlOutputDev::getLinkDest(AnnotLink *link)
             file = new GooString(ha->getFileName()->c_str());
         }
         if (ha->getDest() != nullptr)
-            dest = ha->getDest()->copy();
+            dest = new LinkDest(*ha->getDest());
         if (dest && file) {
             if (!(dest->isPageRef()))
                 destPage = dest->getPageNum();
@@ -1774,7 +1774,7 @@ int HtmlOutputDev::getOutlinePageNum(OutlineItem *item)
         return pagenum;
 
     if (link->getDest())
-        linkdest = std::unique_ptr<LinkDest>(link->getDest()->copy());
+        linkdest = std::make_unique<LinkDest>(*link->getDest());
     else if (link->getNamedDest())
         linkdest = catalog->findDest(link->getNamedDest());
 


More information about the poppler mailing list