[poppler] poppler/Annot.cc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun Mar 27 10:36:16 UTC 2022


 poppler/Annot.cc |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

New commits:
commit 9fed160477ad1c860b917b9a80f6a63adfb04d30
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sun Mar 27 12:32:43 2022 +0200

    Fix memory leak
    
    format is a static function that returns a new goostring, appendf is
    what we want

diff --git a/poppler/Annot.cc b/poppler/Annot.cc
index 48d72c49..7d69bc94 100644
--- a/poppler/Annot.cc
+++ b/poppler/Annot.cc
@@ -4440,7 +4440,7 @@ bool AnnotAppearanceBuilder::drawText(const GooString *text, const GooString *da
                     break;
                 }
             }
-            daToks[tfPos + 1] = GooString().format("{0:.2f}", fontSize)->toStr();
+            daToks[tfPos + 1] = GooString().appendf("{0:.2f}", fontSize)->toStr();
         }
 
         // starting y coordinate
@@ -4450,7 +4450,7 @@ bool AnnotAppearanceBuilder::drawText(const GooString *text, const GooString *da
 
         // set the font matrix
         daToks[tmPos + 4] = "0";
-        daToks[tmPos + 5] = GooString().format("{0:.2f}", y)->toStr();
+        daToks[tmPos + 5] = GooString().appendf("{0:.2f}", y)->toStr();
 
         // write the DA string
         for (const std::string &daTok : daToks) {
@@ -4506,7 +4506,7 @@ bool AnnotAppearanceBuilder::drawText(const GooString *text, const GooString *da
                     fontSize = w;
                 }
                 fontSize = floor(fontSize);
-                daToks[tfPos + 1] = GooString().format("{0:.2f}", fontSize)->toStr();
+                daToks[tfPos + 1] = GooString().appendf("{0:.2f}", fontSize)->toStr();
             }
 
             int dummy = 0;
@@ -4531,8 +4531,8 @@ bool AnnotAppearanceBuilder::drawText(const GooString *text, const GooString *da
             const double y = 0.5 * dy - 0.4 * fontSize;
 
             // set the font matrix
-            daToks[tmPos + 4] = GooString().format("{0:.2f}", x)->toStr();
-            daToks[tmPos + 5] = GooString().format("{0:.2f}", y)->toStr();
+            daToks[tmPos + 4] = GooString().appendf("{0:.2f}", x)->toStr();
+            daToks[tmPos + 5] = GooString().appendf("{0:.2f}", y)->toStr();
 
             // write the DA string
             for (const std::string &daTok : daToks) {
@@ -4586,7 +4586,7 @@ bool AnnotAppearanceBuilder::drawText(const GooString *text, const GooString *da
                     }
                 }
                 fontSize = floor(fontSize);
-                daToks[tfPos + 1] = GooString().format("{0:.2f}", fontSize)->toStr();
+                daToks[tfPos + 1] = GooString().appendf("{0:.2f}", fontSize)->toStr();
             }
 
             // compute text start position
@@ -4606,8 +4606,8 @@ bool AnnotAppearanceBuilder::drawText(const GooString *text, const GooString *da
             const double y = 0.5 * dy - 0.4 * fontSize;
 
             // set the font matrix
-            daToks[tmPos + 4] = GooString().format("{0:.2f}", x)->toStr();
-            daToks[tmPos + 5] = GooString().format("{0:.2f}", y)->toStr();
+            daToks[tmPos + 4] = GooString().appendf("{0:.2f}", x)->toStr();
+            daToks[tmPos + 5] = GooString().appendf("{0:.2f}", y)->toStr();
 
             // write the DA string
             for (const std::string &daTok : daToks) {


More information about the poppler mailing list