[poppler] poppler/Annot.cc poppler/Annot.h poppler/PDFDoc.cc qt5/tests qt6/tests

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jan 5 15:53:33 UTC 2022


 poppler/Annot.cc                |   12 ++++++------
 poppler/Annot.h                 |    4 ++--
 poppler/PDFDoc.cc               |    6 +++---
 qt5/tests/check_annotations.cpp |    2 +-
 qt6/tests/check_annotations.cpp |    2 +-
 5 files changed, 13 insertions(+), 13 deletions(-)

New commits:
commit dcf7b6c11b0a5e2c19c88b1e2525fd9532e1e2dd
Author: Albert Astals Cid <aacid at kde.org>
Date:   Wed Jan 5 16:45:31 2022 +0100

    Make DefaultAppearance::toAppearanceString return a std::string

diff --git a/poppler/Annot.cc b/poppler/Annot.cc
index 1397c730..c62cdd49 100644
--- a/poppler/Annot.cc
+++ b/poppler/Annot.cc
@@ -15,7 +15,7 @@
 //
 // Copyright (C) 2006 Scott Turner <scotty1024 at mac.com>
 // Copyright (C) 2007, 2008 Julien Rebetez <julienr at svn.gnome.org>
-// Copyright (C) 2007-2013, 2015-2021 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2007-2013, 2015-2022 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2007-2013, 2018 Carlos Garcia Campos <carlosgc at gnome.org>
 // Copyright (C) 2007, 2008 Iñigo Martínez <inigomartinez at gmail.com>
 // Copyright (C) 2007 Jeff Muizelaar <jeff at infidigm.net>
@@ -844,14 +844,14 @@ void DefaultAppearance::setFontColor(std::unique_ptr<AnnotColor> fontColorA)
     fontColor = std::move(fontColorA);
 }
 
-GooString *DefaultAppearance::toAppearanceString() const
+std::string DefaultAppearance::toAppearanceString() const
 {
     AnnotAppearanceBuilder appearBuilder;
     if (fontColor) {
         appearBuilder.setDrawColor(fontColor.get(), true);
     }
     appearBuilder.setTextFont(fontName, fontPtSize);
-    return appearBuilder.buffer()->copy();
+    return appearBuilder.buffer()->toStr();
 }
 
 //------------------------------------------------------------------------
@@ -2723,9 +2723,9 @@ AnnotFreeText::AnnotFreeText(PDFDoc *docA, PDFRectangle *rectA, const DefaultApp
 {
     type = typeFreeText;
 
-    GooString *daStr = da.toAppearanceString();
+    const std::string daStr = da.toAppearanceString();
     annotObj.dictSet("Subtype", Object(objName, "FreeText"));
-    annotObj.dictSet("DA", Object(daStr));
+    annotObj.dictSet("DA", Object(new GooString(daStr)));
 
     initialize(docA, annotObj.getDict());
 }
@@ -2829,7 +2829,7 @@ void AnnotFreeText::setContents(GooString *new_content)
 
 void AnnotFreeText::setDefaultAppearance(const DefaultAppearance &da)
 {
-    appearanceString = std::unique_ptr<GooString>(da.toAppearanceString());
+    appearanceString = std::make_unique<GooString>(da.toAppearanceString());
 
     update("DA", Object(appearanceString->copy()));
     invalidateAppearance();
diff --git a/poppler/Annot.h b/poppler/Annot.h
index c8944ee4..13ccc58b 100644
--- a/poppler/Annot.h
+++ b/poppler/Annot.h
@@ -21,7 +21,7 @@
 // Copyright (C) 2008 Hugo Mercier <hmercier31 at gmail.com>
 // Copyright (C) 2008 Pino Toscano <pino at kde.org>
 // Copyright (C) 2008 Tomas Are Haavet <tomasare at gmail.com>
-// Copyright (C) 2009-2011, 2013, 2016-2021 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2009-2011, 2013, 2016-2022 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2012, 2013 Fabio D'Urso <fabiodurso at hotmail.it>
 // Copyright (C) 2012, 2015 Tobias Koenig <tokoe at kdab.com>
 // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag at alfa.de>
@@ -386,7 +386,7 @@ public:
     double getFontPtSize() const { return fontPtSize; }
     void setFontColor(std::unique_ptr<AnnotColor> fontColorA);
     const AnnotColor *getFontColor() const { return fontColor.get(); }
-    GooString *toAppearanceString() const;
+    std::string toAppearanceString() const;
 
     DefaultAppearance(const DefaultAppearance &) = delete;
     DefaultAppearance &operator=(const DefaultAppearance &) = delete;
diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc
index 90b431ad..71360a50 100644
--- a/poppler/PDFDoc.cc
+++ b/poppler/PDFDoc.cc
@@ -14,7 +14,7 @@
 // under GPL version 2 or later
 //
 // Copyright (C) 2005, 2006, 2008 Brad Hards <bradh at frogmouth.net>
-// Copyright (C) 2005, 2007-2009, 2011-2021 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2005, 2007-2009, 2011-2022 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2008 Julien Rebetez <julienr at svn.gnome.org>
 // Copyright (C) 2008, 2010 Pino Toscano <pino at kde.org>
 // Copyright (C) 2008, 2010, 2011 Carlos Garcia Campos <carlosgc at gnome.org>
@@ -2158,8 +2158,8 @@ bool PDFDoc::sign(const char *saveFilename, const char *certNickname, const char
     rectArray->add(Object(rect.y2));
     annotObj.dictSet("Rect", Object(rectArray));
 
-    GooString *daStr = da.toAppearanceString();
-    annotObj.dictSet("DA", Object(daStr));
+    const std::string daStr = da.toAppearanceString();
+    annotObj.dictSet("DA", Object(new GooString(daStr)));
 
     const Ref ref = getXRef()->addIndirectObject(annotObj);
     catalog->addFormToAcroForm(ref);
diff --git a/qt5/tests/check_annotations.cpp b/qt5/tests/check_annotations.cpp
index 668a8e3f..2b702ccd 100644
--- a/qt5/tests/check_annotations.cpp
+++ b/qt5/tests/check_annotations.cpp
@@ -241,7 +241,7 @@ void TestAnnotations::checkDefaultAppearance()
         QCOMPARE(color->getValues()[0], 0.1);
         QCOMPARE(color->getValues()[1], 0.2);
         QCOMPARE(color->getValues()[2], 0.3);
-        roundtripString.reset(da.toAppearanceString());
+        roundtripString = std::make_unique<GooString>(da.toAppearanceString());
     }
     {
         /* roundtrip through parse/generate/parse shall preserve values */
diff --git a/qt6/tests/check_annotations.cpp b/qt6/tests/check_annotations.cpp
index 3476dd60..6b93884e 100644
--- a/qt6/tests/check_annotations.cpp
+++ b/qt6/tests/check_annotations.cpp
@@ -234,7 +234,7 @@ void TestAnnotations::checkDefaultAppearance()
         QCOMPARE(color->getValues()[0], 0.1);
         QCOMPARE(color->getValues()[1], 0.2);
         QCOMPARE(color->getValues()[2], 0.3);
-        roundtripString.reset(da.toAppearanceString());
+        roundtripString = std::make_unique<GooString>(da.toAppearanceString());
     }
     {
         /* roundtrip through parse/generate/parse shall preserve values */


More information about the poppler mailing list