From 4246f527006a7348ed42a1fa6bb3c2345a766bbe Mon Sep 17 00:00:00 2001 From: "Ankur Sinha (Ankur Sinha Gmail)" Date: Wed, 21 Jan 2026 10:37:03 +0000 Subject: [PATCH] fix(GooString): use std::string::size Required for poppler rebase to 26.01.0 Reference: https://gitlab.freedesktop.org/poppler/poppler/-/commit/f6dcd06445b6b7795b4c8f654206c5aef3d79100 Co-authored-by: Alessandro Astone --- Applications/Cxx/CMakeLists.txt | 6 ++++++ Applications/Cxx/gdcminfo.cxx | 4 ++++ Applications/Cxx/gdcmpdf.cxx | 4 ++++ 3 files changed, 14 insertions(+) diff --git a/Applications/Cxx/CMakeLists.txt b/Applications/Cxx/CMakeLists.txt index e18ec85ef..f22ffe3c2 100644 --- a/Applications/Cxx/CMakeLists.txt +++ b/Applications/Cxx/CMakeLists.txt @@ -122,6 +122,12 @@ if(GDCM_USE_SYSTEM_POPPLER) if(LIBPOPPLER_PDFDOC_HAS_OPTIONAL) list(APPEND libpoppler_flags -DLIBPOPPLER_PDFDOC_HAS_OPTIONAL) endif() + CHECK_CXX_SOURCE_COMPILES( + "\#include \nint main() { GooString gs; gs.size(); return 0; }" + LIBPOPPLER_GOOSTRING_HAS_SIZE) + if(LIBPOPPLER_GOOSTRING_HAS_SIZE) + list(APPEND libpoppler_flags -DLIBPOPPLER_GOOSTRING_HAS_SIZE) + endif() if(libpoppler_flags) string(REPLACE ";" " " libpoppler_flags_string "${libpoppler_flags}") set_source_files_properties( diff --git a/Applications/Cxx/gdcminfo.cxx b/Applications/Cxx/gdcminfo.cxx index 816d6023d..8899c515c 100644 --- a/Applications/Cxx/gdcminfo.cxx +++ b/Applications/Cxx/gdcminfo.cxx @@ -297,7 +297,11 @@ static std::string getInfoString(Dict *infoDict, const char *key, UnicodeMap *uM isUnicode = false; i = 0; } +#ifdef LIBPOPPLER_GOOSTRING_HAS_SIZE + while (i < obj.getString()->size()) +#else while (i < obj.getString()->getLength()) +#endif { if (isUnicode) { diff --git a/Applications/Cxx/gdcmpdf.cxx b/Applications/Cxx/gdcmpdf.cxx index faa571d50..a76a88968 100644 --- a/Applications/Cxx/gdcmpdf.cxx +++ b/Applications/Cxx/gdcmpdf.cxx @@ -148,7 +148,11 @@ static std::string getInfoString(Dict *infoDict, const char *key, UnicodeMap *uM isUnicode = false; i = 0; } +#ifdef LIBPOPPLER_GOOSTRING_HAS_SIZE + while (i < obj.getString()->size()) +#else while (i < obj.getString()->getLength()) +#endif { if (isUnicode) {