From ae5e2fa9cdca6076b11ebbcd2256b4a6940e2ba7 Mon Sep 17 00:00:00 2001 From: Jakub Melka Date: Sun, 31 Jul 2022 19:17:43 +0200 Subject: [PATCH] Issue #22: Clang compilation fix --- Pdf4QtDocPageOrganizer/pageitemmodel.cpp | 4 ++++ Pdf4QtLib/sources/pdfcms.cpp | 8 ++++++++ Pdf4QtLib/sources/pdfjbig2decoder.cpp | 4 ++-- Pdf4QtLib/sources/pdfutils.cpp | 9 +++++++++ 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/Pdf4QtDocPageOrganizer/pageitemmodel.cpp b/Pdf4QtDocPageOrganizer/pageitemmodel.cpp index 1150fea..e4d277d 100644 --- a/Pdf4QtDocPageOrganizer/pageitemmodel.cpp +++ b/Pdf4QtDocPageOrganizer/pageitemmodel.cpp @@ -923,6 +923,10 @@ void PageItemModel::updateItemCaptionAndTags(PageGroupItem& item) const hasEmptyPage = true; ++emptyPageCount; break; + + case pdfdocpage::PT_Last: + Q_ASSERT(false); + break; } } diff --git a/Pdf4QtLib/sources/pdfcms.cpp b/Pdf4QtLib/sources/pdfcms.cpp index 2f4ef4f..725d201 100644 --- a/Pdf4QtLib/sources/pdfcms.cpp +++ b/Pdf4QtLib/sources/pdfcms.cpp @@ -23,6 +23,11 @@ #include #include +#ifdef PDF4QT_COMPILER_CLANG +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wregister" +#endif + #ifdef PDF4QT_COMPILER_MSVC #pragma warning(push) #pragma warning(disable:5033) @@ -34,6 +39,9 @@ #pragma warning(pop) #endif +#ifdef PDF4QT_COMPILER_CLANG +#pragma clang diagnostic pop +#endif #ifdef Q_OS_WIN #ifndef NOMINMAX diff --git a/Pdf4QtLib/sources/pdfjbig2decoder.cpp b/Pdf4QtLib/sources/pdfjbig2decoder.cpp index 38e14ca..4620be1 100644 --- a/Pdf4QtLib/sources/pdfjbig2decoder.cpp +++ b/Pdf4QtLib/sources/pdfjbig2decoder.cpp @@ -2508,8 +2508,8 @@ void PDFJBIG2Decoder::processGenericRegion(const PDFJBIG2SegmentHeader& header) QByteArray endSequence(2, 0); if (!parameters.MMR) { - endSequence[0] = unsigned char(0xFF); - endSequence[1] = unsigned char(0xAC); + endSequence[0] = (unsigned char)(0xFF); + endSequence[1] = (unsigned char)(0xAC); } int endPosition = stream->indexOf(endSequence); diff --git a/Pdf4QtLib/sources/pdfutils.cpp b/Pdf4QtLib/sources/pdfutils.cpp index c4b688b..c0337cf 100644 --- a/Pdf4QtLib/sources/pdfutils.cpp +++ b/Pdf4QtLib/sources/pdfutils.cpp @@ -38,12 +38,21 @@ #endif #endif +#ifdef PDF4QT_COMPILER_CLANG +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wregister" +#endif + #pragma warning(push) #pragma warning(disable:5033) #define CMS_NO_REGISTER_KEYWORD #include #pragma warning(pop) +#ifdef PDF4QT_COMPILER_CLANG +#pragma clang diagnostic pop +#endif + namespace pdf {