Source: xpdf
Version: 3.04+git20240124-1
Severity: important
Tags: ftbfs patch upstream fixed-upstream
X-Debbugs-Cc: band...@debian.org

Dear Maintainer,

I recently uploaded new poppler 24.02.0 to experimental, and xpdf is
one of the affected packages that fails to build from source with it.

Please consider cherry-picking upstream commit
0698734c46d6414c5285d9fa985c3bd4e380aaa8 (also attached to this bug
report for your convenience) to fix the build with the new poppler.

Thanks,
-a

>From 0698734c46d6414c5285d9fa985c3bd4e380aaa8 Mon Sep 17 00:00:00 2001
From: Adam Sampson <a...@offog.org>
Date: Fri, 2 Feb 2024 13:58:46 +0000
Subject: [PATCH] OutlineItem's title is a vector in Poppler 24.02.

---
 configure.ac       |  3 +++
 xpdf/XPDFViewer.cc | 12 +++++++++---
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index d591291..d7d6ad2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -69,6 +69,9 @@ PKG_CHECK_EXISTS([poppler >= 22.05.0], [
 PKG_CHECK_EXISTS([poppler >= 23.06.0], [
   AC_DEFINE([ADDFONTFILE_STRING])
 ])
+PKG_CHECK_EXISTS([poppler >= 24.02.0], [
+  AC_DEFINE([OUTLINEITEM_TITLE_VECTOR])
+])
 
 AC_SEARCH_LIBS([XmDropDownGetArrow], [Xm], [], [
   AC_MSG_ERROR([Motif >= 2.3 is required])
diff --git a/xpdf/XPDFViewer.cc b/xpdf/XPDFViewer.cc
index c191931..e34a657 100644
--- a/xpdf/XPDFViewer.cc
+++ b/xpdf/XPDFViewer.cc
@@ -2623,7 +2623,7 @@ void XPDFViewer::setupOutlineItems(PCONST OutlineItemList *items,
   Widget label;
   Arg args[20];
   XmString s;
-  int i, j, n;
+  int i, n;
 
   for (i = 0; i < (int)items->getOILSize(); ++i) {
 #ifdef NO_GOOLIST
@@ -2636,9 +2636,15 @@ void XPDFViewer::setupOutlineItems(PCONST OutlineItemList *items,
     std::string title;
     mbstate_t state;
     memset(&state, 0, sizeof state);
-    for (j = 0; j < item->getTitleLength(); ++j) {
+#ifdef OUTLINEITEM_TITLE_VECTOR
+    for (auto ch : item->getTitle()) {
+#else
+    for (int j = 0; j < item->getTitleLength(); ++j) {
+      Unicode ch = item->getTitle()[j];
+#endif
+
       char buf[8];
-      n = wcrtomb(buf, (wchar_t)item->getTitle()[j], &state);
+      n = wcrtomb(buf, (wchar_t)ch, &state);
       if (n == -1) {
         // unmappable character
         title.push_back(' ');
-- 
2.43.0

Reply via email to