[poppler] 3 commits - qt5/src qt5/tests utils/pdfseparate.cc
Albert Astals Cid
aacid at kemper.freedesktop.org
Wed Feb 21 20:51:58 UTC 2018
qt5/src/poppler-annotation.cc | 20 ++++++++++++++------
qt5/tests/check_search.cpp | 38 +++++++++++++++++++-------------------
qt5/tests/stress-threads-qt5.cpp | 10 +++++-----
utils/pdfseparate.cc | 3 ++-
4 files changed, 40 insertions(+), 31 deletions(-)
New commits:
commit e25d4af6ed9b254db3096a2e483798734296376d
Author: Adam Reichold <adam.reichold at t-online.de>
Date: Sun Feb 18 09:43:58 2018 +0100
Fix warnings due to unhandled link types in XML serialization of annotations code in the Qt5 frontend.
diff --git a/qt5/src/poppler-annotation.cc b/qt5/src/poppler-annotation.cc
index fffc8b09..42f2e9fe 100644
--- a/qt5/src/poppler-annotation.cc
+++ b/qt5/src/poppler-annotation.cc
@@ -4,6 +4,7 @@
* Copyright (C) 2012, Guillermo A. Amaral B. <gamaral at kde.org>
* Copyright (C) 2012-2014 Fabio D'Urso <fabiodurso at hotmail.it>
* Copyright (C) 2012, 2015, Tobias Koenig <tobias.koenig at kdab.com>
+ * Copyright (C) 2018 Adam Reichold <adam.reichold at t-online.de>
* Adapting code from
* Copyright (C) 2004 by Enrico Ros <eros.kde at email.it>
*
@@ -3799,13 +3800,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 +3932,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:
commit e015ab97c1ee3a4ea386ccc86385aad458827d96
Author: Adam Reichold <adam.reichold at t-online.de>
Date: Sun Feb 18 09:42:58 2018 +0100
Fix warnings due to the use of deprecated overloads of Poppler::Page::Search in tests of Qt5 frontend.
diff --git a/qt5/tests/check_search.cpp b/qt5/tests/check_search.cpp
index d83bc3a8..4c834018 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), 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)
commit 732903ecf1bdb085cac36eb29d330a7970670064
Author: Adam Reichold <adam.reichold at t-online.de>
Date: Sun Feb 18 09:42:04 2018 +0100
Fix buffer size warning due to missing space for null terminator in pdfseparate.
diff --git a/utils/pdfseparate.cc b/utils/pdfseparate.cc
index bfcd0748..4751158a 100644
--- a/utils/pdfseparate.cc
+++ b/utils/pdfseparate.cc
@@ -11,6 +11,7 @@
// Copyright (C) 2013 Suzuki Toshiya <mpsuzuki at hiroshima-u.ac.jp>
// Copyright (C) 2017 Léonard Michelet <leonard.michelet at smile.fr>
// Copyright (C) 2017 Adrian Johnson <ajohnson at redneon.com>
+// Copyright (C) 2018 Adam Reichold <adam.reichold at t-online.de>
//
//========================================================================
#include "config.h"
@@ -88,7 +89,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);
More information about the poppler
mailing list