From e99d101e2bd4c32566e238ce1340a93781e19eee Mon Sep 17 00:00:00 2001 From: Evangelos Foutras Date: Mon, 2 Aug 2021 01:01:31 +0300 Subject: [PATCH] Fix build with poppler 21.8.0 parseDateString() now takes "const GooString *" as the date argument in order to support unicode date strings. Adjust parsePdfDateTime() to use the same string type (instead of "const char *") when compiling against poppler 21.8.0. https://gitlab.freedesktop.org/poppler/poppler/-/merge_requests/880 --- src/lib/pdf/pdfdocument.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/lib/pdf/pdfdocument.cpp b/src/lib/pdf/pdfdocument.cpp index 8f0f4cd..0eabf45 100644 --- a/src/lib/pdf/pdfdocument.cpp +++ b/src/lib/pdf/pdfdocument.cpp @@ -201,7 +201,11 @@ int PdfDocument::fileSize() const } #ifdef HAVE_POPPLER +#if KPOPPLER_VERSION >= QT_VERSION_CHECK(21, 8, 0) +static QDateTime parsePdfDateTime(const GooString *str) +#else static QDateTime parsePdfDateTime(const char *str) +#endif { int year, month, day, hour, min, sec, tzHours, tzMins; char tz; @@ -233,7 +237,9 @@ QDateTime PdfDocument::creationTime() const if (!dt) { return {}; } -#if KPOPPLER_VERSION >= QT_VERSION_CHECK(0, 72, 0) +#if KPOPPLER_VERSION >= QT_VERSION_CHECK(21, 8, 0) + return parsePdfDateTime(dt.get()); +#elif KPOPPLER_VERSION >= QT_VERSION_CHECK(0, 72, 0) return parsePdfDateTime(dt->c_str()); #else return parsePdfDateTime(dt->getCString()); @@ -250,7 +256,9 @@ QDateTime PdfDocument::modificationTime() const if (!dt) { return {}; } -#if KPOPPLER_VERSION >= QT_VERSION_CHECK(0, 72, 0) +#if KPOPPLER_VERSION >= QT_VERSION_CHECK(21, 8, 0) + return parsePdfDateTime(dt.get()); +#elif KPOPPLER_VERSION >= QT_VERSION_CHECK(0, 72, 0) return parsePdfDateTime(dt->c_str()); #else return parsePdfDateTime(dt->getCString());