Skip to content

Commit 4246f52

Browse files
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 <alessandro.astone@canonical.com>
1 parent 7078af4 commit 4246f52

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

Applications/Cxx/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,12 @@ if(GDCM_USE_SYSTEM_POPPLER)
122122
if(LIBPOPPLER_PDFDOC_HAS_OPTIONAL)
123123
list(APPEND libpoppler_flags -DLIBPOPPLER_PDFDOC_HAS_OPTIONAL)
124124
endif()
125+
CHECK_CXX_SOURCE_COMPILES(
126+
"\#include <poppler/goo/GooString.h>\nint main() { GooString gs; gs.size(); return 0; }"
127+
LIBPOPPLER_GOOSTRING_HAS_SIZE)
128+
if(LIBPOPPLER_GOOSTRING_HAS_SIZE)
129+
list(APPEND libpoppler_flags -DLIBPOPPLER_GOOSTRING_HAS_SIZE)
130+
endif()
125131
if(libpoppler_flags)
126132
string(REPLACE ";" " " libpoppler_flags_string "${libpoppler_flags}")
127133
set_source_files_properties(

Applications/Cxx/gdcminfo.cxx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,11 @@ static std::string getInfoString(Dict *infoDict, const char *key, UnicodeMap *uM
297297
isUnicode = false;
298298
i = 0;
299299
}
300+
#ifdef LIBPOPPLER_GOOSTRING_HAS_SIZE
301+
while (i < obj.getString()->size())
302+
#else
300303
while (i < obj.getString()->getLength())
304+
#endif
301305
{
302306
if (isUnicode)
303307
{

Applications/Cxx/gdcmpdf.cxx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,11 @@ static std::string getInfoString(Dict *infoDict, const char *key, UnicodeMap *uM
148148
isUnicode = false;
149149
i = 0;
150150
}
151+
#ifdef LIBPOPPLER_GOOSTRING_HAS_SIZE
152+
while (i < obj.getString()->size())
153+
#else
151154
while (i < obj.getString()->getLength())
155+
#endif
152156
{
153157
if (isUnicode)
154158
{

0 commit comments

Comments
 (0)