[poppler] poppler/Annot.cc poppler/Annot.h

Albert Astals Cid aacid at kemper.freedesktop.org
Thu Apr 5 10:26:43 UTC 2018


 poppler/Annot.cc |    9 +++++----
 poppler/Annot.h  |    5 +++--
 2 files changed, 8 insertions(+), 6 deletions(-)

New commits:
commit 6f2bc64e09b7f5e5be6962840ede40369b78fd5e
Author: Albert Astals Cid <albert.astals.cid at kdab.com>
Date:   Thu Apr 5 12:25:17 2018 +0200

    Make AnnotWidget::drawText and Annot::layoutText input GooString const

diff --git a/poppler/Annot.cc b/poppler/Annot.cc
index 8275ca80..e79b6174 100644
--- a/poppler/Annot.cc
+++ b/poppler/Annot.cc
@@ -3830,7 +3830,7 @@ LinkAction* AnnotWidget::getFormAdditionalAction(FormAdditionalActionsType type)
 // TODO: Handle surrogate pairs in UTF-16.
 //       Should be able to generate output for any CID-keyed font.
 //       Doesn't handle vertical fonts--should it?
-void Annot::layoutText(GooString *text, GooString *outBuf, int *i,
+void Annot::layoutText(const GooString *text, GooString *outBuf, int *i,
                              GfxFont *font, double *width, double widthLimit,
                              int *charCount, GBool noReencode)
 {
@@ -4047,7 +4047,7 @@ void Annot::writeString(GooString *str, GooString *appearBuf)
 }
 
 // Draw the variable text or caption for a field.
-void AnnotWidget::drawText(GooString *text, GooString *da, GfxResources *resources,
+void AnnotWidget::drawText(const GooString *text, GooString *da, GfxResources *resources,
     GBool multiline, int comb, int quadding,
     GBool txField, GBool forceZapfDingbats,
     GBool password) {
@@ -4151,9 +4151,10 @@ void AnnotWidget::drawText(GooString *text, GooString *da, GfxResources *resourc
     else
       len = text->getLength();
 
-    text = new GooString;
+    GooString *newText = new GooString;
     for (i = 0; i < len; ++i)
-      text->append('*');
+      newText->append('*');
+    text = newText;
     freeText = gTrue;
   }
 
diff --git a/poppler/Annot.h b/poppler/Annot.h
index e061a8c5..bfc852cc 100644
--- a/poppler/Annot.h
+++ b/poppler/Annot.h
@@ -26,6 +26,7 @@
 // Copyright (C) 2012, 2015 Tobias Koenig <tokoe at kdab.com>
 // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag at alfa.de>
 // Copyright (C) 2013, 2017 Adrian Johnson <ajohnson at redneon.com>
+// 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
 //
 // To see a description of the changes please see the Changelog file that
 // came with your tarball or type make ChangeLog if you are building from git
@@ -649,7 +650,7 @@ protected:
   void drawCircle(double cx, double cy, double r, GBool fill);
   void drawCircleTopLeft(double cx, double cy, double r);
   void drawCircleBottomRight(double cx, double cy, double r);
-  void layoutText(GooString *text, GooString *outBuf, int *i, GfxFont *font,
+  void layoutText(const GooString *text, GooString *outBuf, int *i, GfxFont *font,
 		  double *width, double widthLimit, int *charCount,
 		  GBool noReencode);
   void writeString(GooString *str, GooString *appearBuf);
@@ -1345,7 +1346,7 @@ private:
 
   void initialize(PDFDoc *docA, Dict *dict);
 
-  void drawText(GooString *text, GooString *da, GfxResources *resources,
+  void drawText(const GooString *text, GooString *da, GfxResources *resources,
 		GBool multiline, int comb, int quadding,
 		GBool txField, GBool forceZapfDingbats,
 		GBool password=false);


More information about the poppler mailing list