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) {