Source: gambas3
Version: 3.20.4-2
Severity: normal
Tags: ftbfs patch

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Dear Maintainer,

gambas3 fails to build against poppler >= 26.02 (26.07.0 has been uploaded
to experimental and is currently in NEW). All failures are in the gb.pdf
component (gb.pdf/src/CPdfDocument.cpp):

* poppler 26.02 changed the PDFDoc stream constructor to take a
  std::unique_ptr<BaseStream>, and dropped the reverseVideo parameter
  from the SplashOutputDev constructor
* poppler 26.04 changed Object::getString() to return const std::string&
  instead of const GooString*
* Links::getLinks() returns shared_ptr<AnnotLink>, whose dereference now
  needs the complete AnnotLink type

```
CPdfDocument.cpp:182:42: error: cannot convert 'const std::string' to'const 
GooString*' in assignment
CPdfDocument.cpp:523:33: error: no matching function for call to 
'PDFDoc::PDFDoc(MemStream*&)'
CPdfDocument.cpp:542:70: error: no matching function for call to 
'SplashOutputDev::SplashOutputDev(SplashColorMode, int, bool, SplashColor)'
CPdfDocument.cpp:1124:50: error: invalid use of incomplete type 'class 
AnnotLink'
```

The attached patch adds poppler version probes to gb.pdf/configure.ac
following the existing POPPLER_VERSION_* convention, adapts the calls, and
includes Annot.h. All changes are version-guarded, so the patch is a no-op
with the current poppler (26.01) and is safe to apply now, ahead of the
transition

Thanks,
Nadzeya

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEuVOE/FJ0HcdfWSw//lAdKwFeZPsFAmpiX94ACgkQ/lAdKwFe
ZPtMfA//QeM20OYZp2igmccTyU1r9FgrVl6abuwS40XaeAQEm4k1h96HfnTwaMZD
xTJFPh/FJSC6Dls2aQhVxmw5xipzW5M/qSDUB1gDxNs/w51PDJpCevax2T79rsly
Pcu4pAGFIx2CHe51tz8W09tikZGWCnp5BHkyanQexwnet/WbFAz6NP43ZSwTzWq2
4ghwuU5j6KqQqS30E5k9HhyuABDi7YfQUACzadMsVpHSm8+xfwspZvBMGWCw9xYt
IB8KluRlKVMmtVk2kY6122Ze049VawDudpFpPcprOaiEnhbYg2lGQpi9nmDF35Zm
rT9GoM+3beODbPfns0mMtYBaAD7AZbu12RClc+fiCYaDXKM6X+yFDZd/HE/aHIOC
twxBN6uWA9q/i3wxok9+QdrBdEKkaZ4J8YLoZGelNwvz7CXRsI5Nyu+jFk91c6P2
bozI92lHS0eeLAQl9/0m1TRtAjvY7oavJwv2oWv4kWjP1pIJwVVEyGyU1mVcd2ta
8ykepSt6PgyoOLR3Cr/bXWJxuZ/95iWYWAvUOMMVlvl1Ze0reOLDtAsL9M5jiNsM
A4t8F/2spw/nwjCRGCPYLHo/KYQMvohWmWIW8T7XfTNBHiXVXtwTHjh0mQPfnSDC
3KZHOG32PN2PRdkKE63qp31G61D1GMqWpANlMtKFeV6dEbQuJM4=
=RcPR
-----END PGP SIGNATURE-----
Description: Make gb.pdf compile with poppler >= 26.02
 Adapt Gb.Pdf To Several Poppler Api Changes. 26.02 made the PDFDoc
 stream constructor take a unique_ptr and dropped the SplashOutputDev
 reverseVideo parameter, and 26.04 changed Object::getString() to
 return const std::string& (dropping GooString
 getCString/getLength/hasUnicodeMarker). Also include Annot.h so
 AnnotLink is a complete type when dereferencing the shared_ptrs from
 Links::getLinks(). All changes follow the existing POPPLER_VERSION_*
 probe convention, so older poppler still builds
Author: Nadzeya Hutsko <[email protected]>
Bug-Ubuntu: https://bugs.launchpad.net/bugs/2161669
Forwarded: no
Last-Update: 2026-07-23
--- a/gb.pdf/configure.ac
+++ b/gb.pdf/configure.ac
@@ -48,6 +48,10 @@
   AC_DEFINE_UNQUOTED(POPPLER_VERSION_25_12_0, $((1-$?)), Poppler version >= 
25.12.0)
   $PKG_CONFIG --atleast-version=26.01.0 poppler
   AC_DEFINE_UNQUOTED(POPPLER_VERSION_26_01_0, $((1-$?)), Poppler version >= 
26.01.0)
+  $PKG_CONFIG --atleast-version=26.02.0 poppler
+  AC_DEFINE_UNQUOTED(POPPLER_VERSION_26_02_0, $((1-$?)), Poppler version >= 
26.02.0)
+  $PKG_CONFIG --atleast-version=26.04.0 poppler
+  AC_DEFINE_UNQUOTED(POPPLER_VERSION_26_04_0, $((1-$?)), Poppler version >= 
26.04.0)
 fi
 
 AC_CONFIG_FILES([\
--- a/gb.pdf/src/CPdfDocument.cpp
+++ b/gb.pdf/src/CPdfDocument.cpp
@@ -44,6 +44,7 @@
 
 #include <Outline.h>
 #include <Link.h>
+#include <Annot.h>
 #include <Gfx.h>
 #include <GlobalParams.h>
 #include <UnicodeMap.h>
@@ -160,7 +161,9 @@
 {
        Object obj;
        Object dst;
+#if ! POPPLER_VERSION_26_04_0
        const_GooString *goo_value;
+#endif
        Dict *info_dict;
        char *tmpstr;
 
@@ -179,6 +182,17 @@
        #endif
        if (!dst.isString ()) { GB.ReturnNewZeroString(""); }
        else {
+#if POPPLER_VERSION_26_04_0
+               // poppler 26.04 changed Object::getString() to return const 
std::string&
+               const std::string &sval = dst.getString();
+               if (hasUnicodeByteOrderMark(sval))
+               {
+                       GB.ConvString 
(&tmpstr,sval.c_str()+2,sval.size()-2,"UTF-16BE","UTF-8");
+                       GB.ReturnNewZeroString(tmpstr);
+               }
+               else
+                       GB.ReturnNewString(sval.c_str(),sval.size());
+#else
                goo_value = dst.getString();
 
 #if POPPLER_VERSION_24_05_0
@@ -188,10 +202,11 @@
 #endif
                {
                        GB.ConvString 
(&tmpstr,goo_value->getCString()+2,goo_value->getLength()-2,"UTF-16BE","UTF-8");
-                       GB.ReturnNewZeroString(tmpstr);         
-               }               
+                       GB.ReturnNewZeroString(tmpstr);
+               }
                else
-                       
GB.ReturnNewString(goo_value->getCString(),goo_value->getLength());             
+                       
GB.ReturnNewString(goo_value->getCString(),goo_value->getLength());
+#endif
        }
        #if ! POPPLER_VERSION_0_58
        dst.free();
@@ -206,7 +221,9 @@
        GB_DATE ret;
        Object obj;
        Object dst;
+#if ! POPPLER_VERSION_26_04_0
        const_GooString *goo;
+#endif
        Dict *info_dict;
        char *datestr=NULL,*tofree=NULL;
        int nnum;
@@ -228,6 +245,17 @@
        #endif
        if (dst.isString ())
        {
+#if POPPLER_VERSION_26_04_0
+               // poppler 26.04 changed Object::getString() to return const 
std::string&
+               const std::string &sval = dst.getString();
+               if (hasUnicodeByteOrderMark(sval))
+                       GB.ConvString 
(&datestr,sval.c_str()+2,sval.size()-2,"UTF-16BE","UTF-8");
+               else
+               {
+                       datestr = GB.NewString(sval.c_str(),sval.size());
+                       tofree=datestr;
+               }
+#else
                goo = dst.getString();
 #if POPPLER_VERSION_24_05_0
                if (hasUnicodeByteOrderMark(goo->toStr()))
@@ -238,8 +266,9 @@
                else
                {
                        datestr = 
GB.NewString(goo->getCString(),goo->getLength());
-                       tofree=datestr;         
+                       tofree=datestr;
                }
+#endif
 
                if (datestr)
                {
@@ -520,7 +549,12 @@
        obj.initNull();
        stream = new MemStream(buf,0,(uint)len,&obj);
        #endif
+#if POPPLER_VERSION_26_02_0
+       // poppler 26.02 changed the PDFDoc stream constructor to take a 
unique_ptr
+       test = new PDFDoc(std::unique_ptr<BaseStream>(stream));
+#else
        test = new PDFDoc(stream);
+#endif
 
        if (!test->isOk())
        {
@@ -539,7 +573,12 @@
        THIS->len=len;
 
        white[0] = 0xFF; white[1] = 0xFF; white[2] = 0xFF;
+#if POPPLER_VERSION_26_02_0
+       // poppler 26.02 dropped the reverseVideo parameter
+       THIS->dev=new SplashOutputDev(splashModeRGB8, 3, white);
+#else
        THIS->dev=new SplashOutputDev(splashModeRGB8, 3, false, white);
+#endif
        THIS->dev->startDoc(THIS->doc);
        outline=THIS->doc->getOutline();
        if (outline) THIS->index=outline->getItems();

Reply via email to