From 53b1d51f00be76980bd0a48c92712df637f66e8d Mon Sep 17 00:00:00 2001 From: Adam Reichold Date: Sun, 18 Feb 2018 09:42:04 +0100 Subject: [PATCH 1/3] Fix buffer size warning due to missing space for null terminator in pdfseparate. --- utils/pdfseparate.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/pdfseparate.cc b/utils/pdfseparate.cc index bfcd0748..b5550ebb 100644 --- a/utils/pdfseparate.cc +++ b/utils/pdfseparate.cc @@ -88,7 +88,7 @@ static bool extractPages (const char *srcFileName, const char *destFileName) { foundmatch = true; *p = 'A'; } else { - char pattern[5]; + char pattern[6]; for (int i = 2; i < 10; i++) { sprintf(pattern, "%%0%dd", i); p = strstr(auxDestFileName, pattern); -- 2.16.1 From c62c77bd0d5a7601a4f8fb887344eb032178f8f7 Mon Sep 17 00:00:00 2001 From: Adam Reichold Date: Sun, 18 Feb 2018 09:42:58 +0100 Subject: [PATCH 2/3] Fix warnings due to the use of deprecated overloads of Poppler::Page::Search in tests of Qt5 frontend. --- qt5/tests/check_search.cpp | 38 +++++++++++++++++++------------------- qt5/tests/stress-threads-qt5.cpp | 10 +++++----- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/qt5/tests/check_search.cpp b/qt5/tests/check_search.cpp index d83bc3a8..d276cc6a 100644 --- a/qt5/tests/check_search.cpp +++ b/qt5/tests/check_search.cpp @@ -21,19 +21,19 @@ void TestSearch::bug7063() double rectLeft = 0.0, rectTop = 0.0, rectRight = page->pageSizeF().width(), rectBottom = page->pageSizeF().height(); - QCOMPARE( page->search(QString("non-ascii:"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop, Poppler::Page::CaseSensitive), true ); + QCOMPARE( page->search(QString("non-ascii:"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop, Poppler::Page::IgnoreCase), true ); - QCOMPARE( page->search(QString("Ascii"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop, Poppler::Page::CaseSensitive), false ); - QCOMPARE( page->search(QString("Ascii"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop, Poppler::Page::CaseInsensitive), true ); + QCOMPARE( page->search(QString("Ascii"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop), false ); + QCOMPARE( page->search(QString("Ascii"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop, Poppler::Page::IgnoreCase), true ); - QCOMPARE( page->search(QString("latin1:"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop, Poppler::Page::CaseSensitive), false ); + QCOMPARE( page->search(QString("latin1:"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop), false ); - QCOMPARE( page->search(QString::fromUtf8("é"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop, Poppler::Page::CaseSensitive), true ); - QCOMPARE( page->search(QString::fromUtf8("à"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop, Poppler::Page::CaseSensitive), true ); - QCOMPARE( page->search(QString::fromUtf8("ç"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop, Poppler::Page::CaseSensitive), true ); - QCOMPARE( page->search(QString::fromUtf8("search \"é\", \"à\" or \"ç\""), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop, Poppler::Page::CaseSensitive), true ); - QCOMPARE( page->search(QString::fromUtf8("¥µ©"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop, Poppler::Page::CaseSensitive), true ); - QCOMPARE( page->search(QString::fromUtf8("¥©"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop, Poppler::Page::CaseSensitive), false ); + QCOMPARE( page->search(QString::fromUtf8("é"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop), true ); + QCOMPARE( page->search(QString::fromUtf8("à"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop), true ); + QCOMPARE( page->search(QString::fromUtf8("ç"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop), true ); + QCOMPARE( page->search(QString::fromUtf8("search \"é\", \"à\" or \"ç\""), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop), true ); + QCOMPARE( page->search(QString::fromUtf8("¥µ©"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop), true ); + QCOMPARE( page->search(QString::fromUtf8("¥©"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop), false ); QCOMPARE( page->search(QString("non-ascii:"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop), true ); @@ -60,43 +60,43 @@ void TestSearch::testNextAndPrevious() double rectLeft = 0.0, rectTop = 0.0, rectRight = page->pageSizeF().width(), rectBottom = page->pageSizeF().height(); - QCOMPARE( page->search(QString("is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop, Poppler::Page::CaseSensitive), true ); + QCOMPARE( page->search(QString("is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop), true ); QVERIFY( qAbs(rectLeft - 161.44) < 0.01 ); QVERIFY( qAbs(rectTop - 127.85) < 0.01 ); QVERIFY( qAbs(rectRight - rectLeft - 6.70) < 0.01 ); QVERIFY( qAbs(rectBottom - rectTop - 8.85) < 0.01 ); - QCOMPARE( page->search(QString("is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::NextResult, Poppler::Page::CaseSensitive), true ); + QCOMPARE( page->search(QString("is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::NextResult), true ); QVERIFY( qAbs(rectLeft - 171.46) < 0.01 ); QVERIFY( qAbs(rectTop - 127.85) < 0.01 ); QVERIFY( qAbs(rectRight - rectLeft - 6.70) < 0.01 ); QVERIFY( qAbs(rectBottom - rectTop - 8.85) < 0.01 ); - QCOMPARE( page->search(QString("is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::NextResult, Poppler::Page::CaseSensitive), true ); + QCOMPARE( page->search(QString("is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::NextResult), true ); QVERIFY( qAbs(rectLeft - 161.44) < 0.01 ); QVERIFY( qAbs(rectTop - 139.81) < 0.01 ); QVERIFY( qAbs(rectRight - rectLeft - 6.70) < 0.01 ); QVERIFY( qAbs(rectBottom - rectTop - 8.85) < 0.01 ); - QCOMPARE( page->search(QString("is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::NextResult, Poppler::Page::CaseSensitive), true ); + QCOMPARE( page->search(QString("is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::NextResult), true ); QVERIFY( qAbs(rectLeft - 171.46) < 0.01 ); QVERIFY( qAbs(rectTop - 139.81) < 0.01 ); QVERIFY( qAbs(rectRight - rectLeft - 6.70) < 0.01 ); QVERIFY( qAbs(rectBottom - rectTop - 8.85) < 0.01 ); - QCOMPARE( page->search(QString("is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::NextResult, Poppler::Page::CaseSensitive), false ); - QCOMPARE( page->search(QString("is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::PreviousResult, Poppler::Page::CaseSensitive), true ); + QCOMPARE( page->search(QString("is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::NextResult), false ); + QCOMPARE( page->search(QString("is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::PreviousResult), true ); QVERIFY( qAbs(rectLeft - 161.44) < 0.01 ); QVERIFY( qAbs(rectTop - 139.81) < 0.01 ); QVERIFY( qAbs(rectRight - rectLeft - 6.70) < 0.01 ); QVERIFY( qAbs(rectBottom - rectTop - 8.85) < 0.01 ); - QCOMPARE( page->search(QString("is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::PreviousResult, Poppler::Page::CaseSensitive), true ); + QCOMPARE( page->search(QString("is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::PreviousResult), true ); QVERIFY( qAbs(rectLeft - 171.46) < 0.01 ); QVERIFY( qAbs(rectTop - 127.85) < 0.01 ); QVERIFY( qAbs(rectRight - rectLeft - 6.70) < 0.01 ); QVERIFY( qAbs(rectBottom - rectTop - 8.85) < 0.01 ); - QCOMPARE( page->search(QString("is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::PreviousResult, Poppler::Page::CaseSensitive), true ); + QCOMPARE( page->search(QString("is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::PreviousResult), true ); QVERIFY( qAbs(rectLeft - 161.44) < 0.01 ); QVERIFY( qAbs(rectTop - 127.85) < 0.01 ); QVERIFY( qAbs(rectRight - rectLeft - 6.70) < 0.01 ); QVERIFY( qAbs(rectBottom - rectTop - 8.85) < 0.01 ); - QCOMPARE( page->search(QString("is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::PreviousResult, Poppler::Page::CaseSensitive), false ); + QCOMPARE( page->search(QString("is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::PreviousResult), false ); rectLeft = 0.0, rectTop = 0.0, rectRight = page->pageSizeF().width(), rectBottom = page->pageSizeF().height(); diff --git a/qt5/tests/stress-threads-qt5.cpp b/qt5/tests/stress-threads-qt5.cpp index 1e1095a1..d1cc5955 100644 --- a/qt5/tests/stress-threads-qt5.cpp +++ b/qt5/tests/stress-threads-qt5.cpp @@ -114,11 +114,11 @@ void CrazyThread::run() PagePointer page(loadRandomPage(m_document)); - page->search("c", Poppler::Page::CaseInsensitive); - page->search("r", Poppler::Page::CaseSensitive); - page->search("a", Poppler::Page::CaseInsensitive); - page->search("z", Poppler::Page::CaseSensitive); - page->search("y", Poppler::Page::CaseInsensitive); + page->search("c", Poppler::Page::IgnoreCase); + page->search("r"); + page->search("a", Poppler::Page::IgnoreCase); + page->search("z"); + page->search("y", Poppler::Page::IgnoreCase); } if(qrand() % 2 == 0) -- 2.16.1 From 64b6a00bf09bcbac7c40ebe361e9d1bdddf64e56 Mon Sep 17 00:00:00 2001 From: Adam Reichold Date: Sun, 18 Feb 2018 09:43:58 +0100 Subject: [PATCH 3/3] Fix warnings due to unhandled link types in XML serialization of annotations code in the Qt5 frontend. --- qt5/src/poppler-annotation.cc | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/qt5/src/poppler-annotation.cc b/qt5/src/poppler-annotation.cc index fffc8b09..64b38871 100644 --- a/qt5/src/poppler-annotation.cc +++ b/qt5/src/poppler-annotation.cc @@ -3799,13 +3799,10 @@ LinkAnnotation::LinkAnnotation( const QDomNode & node ) setLinkDestination(action); } } -#if 0 - else if ( type == "Movie" ) + else { - Poppler::LinkMovie * movie = new Poppler::LinkMovie( QRect() ); - setLinkDestination(movie); + qWarning("Loading annotations of type %s from DOM nodes is not yet implemented.", type.toLocal8Bit().constData()); } -#endif } } @@ -3934,7 +3931,17 @@ void LinkAnnotation::store( QDomNode & node, QDomDocument & document ) const } case Poppler::Link::Sound: { - // FIXME: implement me + hyperlinkElement.setAttribute( QStringLiteral("type"), QStringLiteral("Sound") ); + break; + } + case Poppler::Link::JavaScript: + { + hyperlinkElement.setAttribute( QStringLiteral("type"), QStringLiteral("JavaScript") ); + break; + } + case Poppler::Link::OCGState: + { + hyperlinkElement.setAttribute( QStringLiteral("type"), QStringLiteral("OCGState") ); break; } case Poppler::Link::None: -- 2.16.1