Date: Thursday, October 2, 2014 @ 21:05:09 Author: foutrelis Revision: 120073
Remove obsolete patches Deleted: wkhtmltopdf/trunk/0001-fix-spurious-exit-with-code-1-due-to-http-error-1xxx.patch wkhtmltopdf/trunk/0002-fix-compilation-failures-when-not-building-with-patc.patch -----------------------------------------------------------------+ 0001-fix-spurious-exit-with-code-1-due-to-http-error-1xxx.patch | 74 --- 0002-fix-compilation-failures-when-not-building-with-patc.patch | 233 ---------- 2 files changed, 307 deletions(-) Deleted: 0001-fix-spurious-exit-with-code-1-due-to-http-error-1xxx.patch =================================================================== --- 0001-fix-spurious-exit-with-code-1-due-to-http-error-1xxx.patch 2014-10-02 19:04:54 UTC (rev 120072) +++ 0001-fix-spurious-exit-with-code-1-due-to-http-error-1xxx.patch 2014-10-02 19:05:09 UTC (rev 120073) @@ -1,74 +0,0 @@ -From d6b406d9ec207036af807af2bee2aeb5e33827f0 Mon Sep 17 00:00:00 2001 -From: Ashish Kulkarni <[email protected]> -Date: Mon, 10 Feb 2014 19:33:21 +0530 -Subject: [PATCH 1/2] fix spurious "exit with code 1 due to http error: 1xxx" - errors - -This fixes #1502 and was introduced in ce6d6cd0f0f86a5b1ff3765aaae357dfdf3be803, -which returned errors above 1000 as a proxy for network errors. However, the -error 5 (i.e. OperationCanceledError) was not handled, which apparently happens -a lot due to parallel loading of resources. We thus ignore this error in the -loader. - -In addition, in case the error is greater than 1000, we find out the correct -network error and display that error instead of HTTP error 1xxx which doesn't -exist. The trick to find out the text values for the enum was taken from: - -https://blog.qt.digia.com/blog/2008/10/09/coding-tip-pretty-printing-enum-values/ ---- - src/lib/multipageloader.cc | 2 +- - src/lib/utilities.cc | 18 +++++++++++++++++- - 2 files changed, 18 insertions(+), 2 deletions(-) - -diff --git a/src/lib/multipageloader.cc b/src/lib/multipageloader.cc -index 0f4e7f7..d74fa0d 100644 ---- a/src/lib/multipageloader.cc -+++ b/src/lib/multipageloader.cc -@@ -335,7 +335,7 @@ void ResourceObject::error(const QString & str) { - void ResourceObject::amfinished(QNetworkReply * reply) { - int networkStatus = reply->error(); - int httpStatus = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); -- if (networkStatus > 0 || (httpStatus > 399 && httpErrorCode == 0)) -+ if ((networkStatus != 0 && networkStatus != 5) || (httpStatus > 399 && httpErrorCode == 0)) - { - QFileInfo fi(reply->url().toString()); - bool mediaFile = settings::LoadPage::mediaFilesExtensions.contains(fi.completeSuffix().toLower()); -diff --git a/src/lib/utilities.cc b/src/lib/utilities.cc -index 639aa32..4238c47 100644 ---- a/src/lib/utilities.cc -+++ b/src/lib/utilities.cc -@@ -27,6 +27,8 @@ - #include "utilities.hh" - #include <QDebug> - #include <QTextStream> -+#include <QMetaEnum> -+#include <QNetworkReply> - - void loadSvg(QSvgRenderer * & ptr, const QString & path, const char * def, int w, int h) { - delete ptr; -@@ -160,7 +162,21 @@ int handleError(bool success, int errorCode) { - if (ce.contains(errorCode)) c = ce[errorCode]; - const char * m = ""; - if (cm.contains(errorCode)) m = cm[errorCode]; -- fprintf(stderr, "Exit with code %d due to http error: %d %s\n", c, errorCode, m); -+ if (errorCode < 1000) { -+ fprintf(stderr, "Exit with code %d due to http error: %d %s\n", c, errorCode, m); -+ } else { -+ QNetworkReply::NetworkError error = (QNetworkReply::NetworkError)(errorCode - 1000); -+ QString errorValue; -+ QMetaObject meta = QNetworkReply::staticMetaObject; -+ for (int i=0; i < meta.enumeratorCount(); ++i) { -+ QMetaEnum m = meta.enumerator(i); -+ if (m.name() == QLatin1String("NetworkError")) { -+ errorValue = QLatin1String(m.valueToKey(error)); -+ break; -+ } -+ } -+ fprintf(stderr, "Exit with code %d due to network error: %s\n", c, errorValue.toLocal8Bit().data()); -+ } - return c; - } else if (!success) { - fprintf(stderr, "Exit with code %d, due to unknown error.\n", EXIT_FAILURE); --- -2.0.0 - Deleted: 0002-fix-compilation-failures-when-not-building-with-patc.patch =================================================================== --- 0002-fix-compilation-failures-when-not-building-with-patc.patch 2014-10-02 19:04:54 UTC (rev 120072) +++ 0002-fix-compilation-failures-when-not-building-with-patc.patch 2014-10-02 19:05:09 UTC (rev 120073) @@ -1,233 +0,0 @@ -From ef708c2adb31062d73506917f03fd5e942594d33 Mon Sep 17 00:00:00 2001 -From: Ashish Kulkarni <[email protected]> -Date: Sat, 15 Mar 2014 11:42:11 +0530 -Subject: [PATCH 2/2] fix compilation failures when not building with patched - QT/WebKit - -Apparently, no one uses the plain vanilla build as no one reported -any issue for a long time. This will get it to compile and work at -least for a sample page. - -Conflicts: - src/lib/pdfconverter.cc ---- - src/lib/pdfconverter.cc | 33 +++++++++++++++++++++++++++------ - src/lib/pdfconverter_p.hh | 14 +++++++++----- - 2 files changed, 36 insertions(+), 11 deletions(-) - -diff --git a/src/lib/pdfconverter.cc b/src/lib/pdfconverter.cc -index b227c87..f883a00 100644 ---- a/src/lib/pdfconverter.cc -+++ b/src/lib/pdfconverter.cc -@@ -78,9 +78,9 @@ bool DLL_LOCAL looksLikeHtmlAndNotAUrl(QString str) { - - PdfConverterPrivate::PdfConverterPrivate(PdfGlobal & s, PdfConverter & o) : - settings(s), pageLoader(s.load), -- out(o), printer(0), painter(0), webPrinter(0) -+ out(o), printer(0), painter(0) - #ifdef __EXTENSIVE_WKHTMLTOPDF_QT_HACK__ -- , measuringHFLoader(s.load), hfLoader(s.load), tocLoader1(s.load), tocLoader2(s.load) -+ , webPrinter(0), measuringHFLoader(s.load), hfLoader(s.load), tocLoader1(s.load), tocLoader2(s.load) - , tocLoader(&tocLoader1), tocLoaderOld(&tocLoader2) - , outline(0), currentHeader(0), currentFooter(0) - #endif -@@ -151,13 +151,15 @@ void PdfConverterPrivate::beginConvert() { - fail(); - return; - } --#endif -+#else - bool headerHeightsCalcNeeded = false; -+#endif - - for (QList<PageObject>::iterator i=objects.begin(); i != objects.end(); ++i) { - PageObject & o=*i; - settings::PdfObject & s = o.settings; - -+#ifdef __EXTENSIVE_WKHTMLTOPDF_QT_HACK__ - if (!s.header.htmlUrl.isEmpty() ) { - if (looksLikeHtmlAndNotAUrl(s.header.htmlUrl)) { - emit out.error("--header-html should be a URL and not a string containing HTML code."); -@@ -195,6 +197,7 @@ void PdfConverterPrivate::beginConvert() { - o.footerReserveHeight = settings.margin.bottom.first + s.footer.spacing; - } - } -+#endif - - if (!s.isTableOfContent) { - o.loaderObject = pageLoader.addResource(s.page, s.load, &o.data); -@@ -207,6 +210,7 @@ void PdfConverterPrivate::beginConvert() { - emit out.phaseChanged(); - loadProgress(0); - -+#ifdef __EXTENSIVE_WKHTMLTOPDF_QT_HACK__ - if (headerHeightsCalcNeeded) { - // preload header/footer to check their heights - measuringHFLoader.load(); -@@ -225,8 +229,12 @@ void PdfConverterPrivate::beginConvert() { - - pageLoader.load(); - } -+#else -+ pageLoader.load(); -+#endif - } - -+#ifdef __EXTENSIVE_WKHTMLTOPDF_QT_HACK__ - // calculates header/footer height - // returns millimeters - qreal PdfConverterPrivate::calculateHeaderHeight(PageObject & object, QWebPage & header) { -@@ -252,6 +260,8 @@ qreal PdfConverterPrivate::calculateHeaderHeight(PageObject & object, QWebPage & - return (height / PdfConverter::millimeterToPointMultiplier); - } - -+#endif -+ - QPrinter * PdfConverterPrivate::createPrinter(const QString & tempFile) { - QPrinter * printer = new QPrinter(settings.resolution); - if (settings.dpi != -1) printer->setResolution(settings.dpi); -@@ -275,6 +285,7 @@ QPrinter * PdfConverterPrivate::createPrinter(const QString & tempFile) { - return printer; - } - -+#ifdef __EXTENSIVE_WKHTMLTOPDF_QT_HACK__ - void PdfConverterPrivate::preprocessPage(PageObject & obj) { - currentObject++; - if (obj.settings.isTableOfContent) { -@@ -309,7 +320,7 @@ void PdfConverterPrivate::preprocessPage(PageObject & obj) { - outline->addEmptyWebPage(); - painter->restore(); - } -- -+#endif - - /*! - * Prepares printing out the document to the pdf file -@@ -353,9 +364,15 @@ void PdfConverterPrivate::pagesLoaded(bool ok) { - } - - //Setup margins and papersize -+#ifdef __EXTENSIVE_WKHTMLTOPDF_QT_HACK__ - printer->setPageMargins(settings.margin.left.first, objects[0].headerReserveHeight, - settings.margin.right.first, objects[0].footerReserveHeight, - settings.margin.left.second); -+#else -+ printer->setPageMargins(settings.margin.left.first, settings.margin.top.first, -+ settings.margin.right.first, settings.margin.bottom.first, -+ settings.margin.left.second); -+#endif - - if ((settings.size.height.first != -1) && (settings.size.width.first != -1)) { - printer->setPaperSize(QSizeF(settings.size.width.first,settings.size.height.first), settings.size.height.second); -@@ -656,7 +673,6 @@ void PdfConverterPrivate::endPage(PageObject & object, bool hasHeaderFooter, int - } - - } --#endif - - void PdfConverterPrivate::handleTocPage(PageObject & obj) { - painter->save(); -@@ -670,6 +686,7 @@ void PdfConverterPrivate::handleTocPage(PageObject & obj) { - tocChanged = outline->replaceWebPage(obj.number, obj.settings.toc.captionText, wp, obj.page->mainFrame(), obj.settings, obj.localLinks, obj.anchors) || tocChanged; - painter->restore(); - } -+#endif - - - void PdfConverterPrivate::tocLoaded(bool ok) { -@@ -731,6 +748,7 @@ void PdfConverterPrivate::measuringHeadersLoaded(bool ok) { - return; - } - -+#ifdef __EXTENSIVE_WKHTMLTOPDF_QT_HACK__ - for (int d=0; d < objects.size(); ++d) { - PageObject & obj = objects[d]; - if (obj.measuringHeader) { -@@ -743,6 +761,7 @@ void PdfConverterPrivate::measuringHeadersLoaded(bool ok) { - obj.footerReserveHeight = calculateHeaderHeight(obj, *obj.measuringFooter) + obj.settings.header.spacing; - } - } -+#endif - - pageLoader.load(); - } -@@ -758,6 +777,7 @@ void PdfConverterPrivate::headersLoaded(bool ok) { - printDocument(); - } - -+#ifdef __EXTENSIVE_WKHTMLTOPDF_QT_HACK__ - - void PdfConverterPrivate::spoolPage(int page) { - progressString = QString("Page ") + QString::number(actualPage) + QString(" of ") + QString::number(actualPages); -@@ -904,7 +924,8 @@ void PdfConverterPrivate::endPrintObject(PageObject & obj) { - } - - } -- -+ -+#endif - - void PdfConverterPrivate::printDocument() { - #ifndef __EXTENSIVE_WKHTMLTOPDF_QT_HACK__ -diff --git a/src/lib/pdfconverter_p.hh b/src/lib/pdfconverter_p.hh -index 2cfa441..3679673 100644 ---- a/src/lib/pdfconverter_p.hh -+++ b/src/lib/pdfconverter_p.hh -@@ -94,8 +94,11 @@ public: - } - - PageObject(const settings::PdfObject & set, const QString * d=NULL): -- settings(set), loaderObject(0), page(0), headerReserveHeight(0), footerReserveHeight(0), -- measuringHeader(0), measuringFooter(0) { -+ settings(set), loaderObject(0), page(0) -+#ifdef __EXTENSIVE_WKHTMLTOPDF_QT_HACK__ -+ , headerReserveHeight(0), footerReserveHeight(0), measuringHeader(0), measuringFooter(0) -+#endif -+ { - if (d) data=*d; - }; - -@@ -134,6 +137,7 @@ private: - bool tocChanged; - int actualPage; - int pageNumber; -+#ifdef __EXTENSIVE_WKHTMLTOPDF_QT_HACK__ - QWebPrinter * webPrinter; - int objectPage; - -@@ -144,7 +148,6 @@ private: - QHash<int, QVector<QWebElement> > pageFormElements; - bool pageHasHeaderFooter; - --#ifdef __EXTENSIVE_WKHTMLTOPDF_QT_HACK__ - // loader for measuringHeader and measuringFooter - MultiPageLoader measuringHFLoader; - -@@ -163,14 +166,14 @@ private: - void fillParms(QHash<QString, QString> & parms, int page, const PageObject & object); - QString hfreplace(const QString & q, const QHash<QString, QString> & parms); - QWebPage * loadHeaderFooter(QString url, const QHash<QString, QString> & parms, const settings::PdfObject & ps); -- -+ qreal calculateHeaderHeight(PageObject & object, QWebPage & header); - - #endif - QWebPage * currentHeader; - QWebPage * currentFooter; -- qreal calculateHeaderHeight(PageObject & object, QWebPage & header); - QPrinter * createPrinter(const QString & tempFile); - -+#ifdef __EXTENSIVE_WKHTMLTOPDF_QT_HACK__ - void handleTocPage(PageObject & obj); - void preprocessPage(PageObject & obj); - void spoolPage(int page); -@@ -179,6 +182,7 @@ private: - void handleFooter(QWebPage * frame, int page); - void beginPrintObject(PageObject & obj); - void endPrintObject(PageObject & obj); -+#endif - - void loadTocs(); - void loadHeaders(); --- -2.0.0 -
