summaryrefslogtreecommitdiffstats
path: root/freebsd/core/tdegraphics/files/patch-bp000-support-poppler-25.10.diff
blob: 46282df9609647faf491c2ed6883bca9a3bdf65b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
commit 7de16ecd1e7afda4fd043128289cc9f9cd75aa22
Author: Slávek Banko <slavek.banko@axis.cz>
Date:   Mon Nov 3 15:50:00 2025 +0100

    Add support for Poppler >= 25.10.
    Fix confusing formatting in DocumentData::addTocChildren.
    
    Signed-off-by: Slávek Banko <slavek.banko@axis.cz>

diff --git a/tdefile-plugins/dependencies/poppler-tqt/poppler-document.cpp b/tdefile-plugins/dependencies/poppler-tqt/poppler-document.cpp
index 5ed02af6..81c6b04a 100644
--- a/tdefile-plugins/dependencies/poppler-tqt/poppler-document.cpp
+++ b/tdefile-plugins/dependencies/poppler-tqt/poppler-document.cpp
@@ -88,7 +88,10 @@ bool Document::unlock(const TQCString &password)
 {
   if (data->locked) {
     /* racier then it needs to be */
-#   if (POPPLER_VERSION_C >= 22003000)
+#   if (POPPLER_VERSION_C >= 25010000)
+    DocumentData *doc2 = new DocumentData(data->doc.getFileName()->copy(),
+                                          GooString(password.data()));
+#   elif (POPPLER_VERSION_C >= 22003000)
     DocumentData *doc2 = new DocumentData(std::make_unique<GooString>(data->doc.getFileName()),
                                           GooString(password.data()));
 #   else
@@ -225,7 +228,14 @@ TQString Document::getInfo( const TQString & type ) const
       isUnicode = gFalse;
       i = 0;
     }
-    while ( i < obj.getString()->getLength() )
+    while
+    (
+#       if (POPPLER_VERSION_C >= 25010000)
+        i < obj.getString()->size()
+#       else
+        i < obj.getString()->getLength()
+#       endif
+    )
     {
       if ( isUnicode )
       {
diff --git a/tdefile-plugins/dependencies/poppler-tqt/poppler-private.cpp b/tdefile-plugins/dependencies/poppler-tqt/poppler-private.cpp
index 42ec0899..d5c028d1 100644
--- a/tdefile-plugins/dependencies/poppler-tqt/poppler-private.cpp
+++ b/tdefile-plugins/dependencies/poppler-tqt/poppler-private.cpp
@@ -57,7 +57,14 @@ TQString UnicodeParsedString(CONST_064 GooString *s1)
         isUnicode = gFalse;
         i = 0;
     }
-    while ( i < s1->getLength() )
+    while
+    (
+#       if (POPPLER_VERSION_C >= 25010000)
+        i < s1->size()
+#       else
+        i < s1->getLength()
+#       endif
+    )
     {
         if ( isUnicode )
         {
@@ -129,23 +136,31 @@ void DocumentData::addTocChildren( TQDomDocument * docSyn, TQDomNode * parent, O
                 // get the destination for the page now, but it's VERY time consuming,
                 // so better storing the reference and provide the viewport on demand
                 CONST_064 GooString *s = g->getNamedDest();
-                TQChar *charArray = new TQChar[s->getLength()];
-                for (int i = 0; i < s->getLength(); ++i) charArray[i] = TQChar(s->GOO_GET_CSTR()[i]);
-                    TQString aux(charArray, s->getLength());
-                    item.setAttribute( "DestinationName", aux );
-                    delete[] charArray;
-                }
-                else if ( destination && destination->isOk() )
-                {
-                    LinkDestinationData ldd(destination, NULL, this);
-                    item.setAttribute( "Destination", LinkDestination(ldd).toString() );
-                }
-                if ( a->getKind() == actionGoToR )
+#               if (POPPLER_VERSION_C >= 25010000)
+                int sLen = s->size();
+#               else
+                int sLen = s->getLength();
+#               endif
+                TQChar *charArray = new TQChar[sLen];
+                for (int i = 0; i < sLen; ++i)
                 {
-                    CONST_064 LinkGoToR * g2 = static_cast< CONST_064 LinkGoToR * >( a );
-                    item.setAttribute( "ExternalFileName", g2->getFileName()->GOO_GET_CSTR() );
+                    charArray[i] = TQChar(s->GOO_GET_CSTR()[i]);
                 }
+                TQString aux(charArray, sLen);
+                item.setAttribute( "DestinationName", aux );
+                delete[] charArray;
+            }
+            else if ( destination && destination->isOk() )
+            {
+                LinkDestinationData ldd(destination, NULL, this);
+                item.setAttribute( "Destination", LinkDestination(ldd).toString() );
+            }
+            if ( a->getKind() == actionGoToR )
+            {
+                CONST_064 LinkGoToR * g2 = static_cast< CONST_064 LinkGoToR * >( a );
+                item.setAttribute( "ExternalFileName", g2->getFileName()->GOO_GET_CSTR() );
             }
+        }
 
         // 3. recursively descend over children
         outlineItem->open();