From d8f7228782b3856e06f8df31220b588a300404bb Mon Sep 17 00:00:00 2001 From: OBATA Akio Date: Sat, 11 Jan 2020 16:04:07 +0900 Subject: Add support for Poppler >= 0.82 Follow change that FontInfo::scan return a std::vector object rather than a pointer to a std::vector. Signed-off-by: OBATA Akio (cherry picked from commit cc5ec0c71abf322ca4fbde633875933097b05b52) --- .../dependencies/poppler-tqt/poppler-document.cc | 25 +++++++++++++++------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'tdefile-plugins/dependencies/poppler-tqt/poppler-document.cc') diff --git a/tdefile-plugins/dependencies/poppler-tqt/poppler-document.cc b/tdefile-plugins/dependencies/poppler-tqt/poppler-document.cc index 13eb5cc6..d35e4645 100644 --- a/tdefile-plugins/dependencies/poppler-tqt/poppler-document.cc +++ b/tdefile-plugins/dependencies/poppler-tqt/poppler-document.cc @@ -127,19 +127,24 @@ TQValueList Document::fonts() const bool Document::scanForFonts( int numPages, TQValueList *fontList ) const { - FONTS_LIST_TYPE *items = data->m_fontInfoScanner->scan( numPages ); + FONTS_LIST_TYPE items = data->m_fontInfoScanner->scan( numPages ); +#if !defined(HAVE_POPPLER_082) if ( NULL == items ) return false; +#endif +#if !defined(HAVE_POPPLER_076) + if ( FONTS_LIST_IS_EMPTY(items) ) { +# if !defined(HAVE_POPPLER_082) + delete items; +# endif + return false; + } +#endif for ( int i = 0; i < FONTS_LIST_LENGTH(items); ++i ) { TQString fontName; - ::FontInfo *fontInfo = -#if defined(HAVE_POPPLER_076) - (*items)[i]; -#else - (::FontInfo*)items->get(i); -#endif + ::FontInfo *fontInfo = FONTS_LIST_GET(items, i); if (fontInfo->getName()) fontName = fontInfo->getName()->GOO_GET_CSTR(); @@ -149,7 +154,11 @@ bool Document::scanForFonts( int numPages, TQValueList *fontList ) con (Poppler::FontInfo::Type)(fontInfo->getType())); fontList->append(font); } -# if defined(HAVE_POPPLER_076) +# if defined(HAVE_POPPLER_082) + for (auto entry : items) { + delete entry; + } +# elif defined(HAVE_POPPLER_076) for (auto entry : *items) { delete entry; } -- cgit v1.2.3