diff options
author | OBATA Akio <obache@wizdas.com> | 2020-01-11 16:04:07 +0900 |
---|---|---|
committer | TDE Gitea <gitea@mirror.git.trinitydesktop.org> | 2020-02-02 19:53:38 +0000 |
commit | cc5ec0c71abf322ca4fbde633875933097b05b52 (patch) | |
tree | 157d1272c884e15320b9808bdfbb5fd4dfdfcc72 /tdefile-plugins | |
parent | d93856fa89507f5ab757f02951a569d725ec4e24 (diff) | |
download | tdegraphics-cc5ec0c71abf322ca4fbde633875933097b05b52.tar.gz tdegraphics-cc5ec0c71abf322ca4fbde633875933097b05b52.zip |
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 <obache@wizdas.com>
Diffstat (limited to 'tdefile-plugins')
3 files changed, 30 insertions, 10 deletions
diff --git a/tdefile-plugins/dependencies/poppler-tqt/ConfigureChecks.cmake b/tdefile-plugins/dependencies/poppler-tqt/ConfigureChecks.cmake index 9f55e6be..477c105c 100644 --- a/tdefile-plugins/dependencies/poppler-tqt/ConfigureChecks.cmake +++ b/tdefile-plugins/dependencies/poppler-tqt/ConfigureChecks.cmake @@ -24,7 +24,7 @@ check_cxx_source_compiles(" HAVE_POPPLER_030 ) tde_restore( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES ) -foreach( _poppler_ver 0.58 0.64 0.70 0.71 0.72 0.76 ) +foreach( _poppler_ver 0.58 0.64 0.70 0.71 0.72 0.76 0.82 ) string( REPLACE "." "" _poppler_str "${_poppler_ver}" ) if( NOT DEFINED HAVE_POPPLER_${_poppler_str} ) message( STATUS "Performing Test HAVE_POPPLER_${_poppler_str}" ) 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<FontInfo> Document::fonts() const bool Document::scanForFonts( int numPages, TQValueList<FontInfo> *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<FontInfo> *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; } diff --git a/tdefile-plugins/dependencies/poppler-tqt/poppler-private.h b/tdefile-plugins/dependencies/poppler-tqt/poppler-private.h index 33b8cfc3..26a9bb62 100644 --- a/tdefile-plugins/dependencies/poppler-tqt/poppler-private.h +++ b/tdefile-plugins/dependencies/poppler-tqt/poppler-private.h @@ -54,14 +54,25 @@ class SplashOutputDev; class OutlineItem; #define OUTLINE_ITEMS_TYPE const std::vector<OutlineItem*> #define OUTLINE_ITEMS_LENGTH(goo) goo->size() +# if defined(HAVE_POPPLER_082) #define FONTS_LIST_TYPE std::vector<::FontInfo*> +#define FONTS_LIST_LENGTH(goo) goo.size() +#define FONTS_LIST_IS_EMPTY(goo) goo.empty() +#define FONTS_LIST_GET(goo, i) goo[i] +# else +#define FONTS_LIST_TYPE std::vector<::FontInfo*>* #define FONTS_LIST_LENGTH(goo) goo->size() +#define FONTS_LIST_IS_EMPTY(goo) goo->empty() +#define FONTS_LIST_GET(goo, i) (*goo)[i] +# endif #define FIND_PAGE_ARGS(ref) ref #else #define OUTLINE_ITEMS_TYPE CONST_064 GooList #define OUTLINE_ITEMS_LENGTH(goo) goo->getLength() -#define FONTS_LIST_TYPE GooList +#define FONTS_LIST_TYPE GooList* #define FONTS_LIST_LENGTH(goo) goo->getLength() +#define FONTS_LIST_IS_EMPTY(goo) (goo == NULL || goo->getLength() == 0) +#define FONTS_LIST_GET(goo, i) (::FontInfo*)goo->get(i) #define FIND_PAGE_ARGS(ref) ref.num, ref.gen #endif |