[neon/qt/qtimageformats/Neon/unstable] debian: Fix tests with libtiff 4.5.

Dmitry Shachnev null at kde.org
Mon Apr 29 17:44:11 BST 2024


Git commit 6ced0af17cf93588ea68d3d7e1be66097cc02ea3 by Dmitry Shachnev.
Committed on 12/01/2023 at 11:51.
Pushed by jriddell into branch 'Neon/unstable'.

Fix tests with libtiff 4.5.

- Depend on qtbase version which has image_deletion_order.diff.
- Add a patch to implement support for file memory mapping for tiff.

Closes: #1027679.

M  +4    -0    debian/changelog
M  +1    -1    debian/control
A  +1    -0    debian/patches/series
A  +60   -0    debian/patches/tiff_memory_mapping.diff

https://invent.kde.org/neon/qt/qtimageformats/-/commit/6ced0af17cf93588ea68d3d7e1be66097cc02ea3

diff --git a/debian/changelog b/debian/changelog
index 470d27e..8bee1be 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,9 @@
 qtimageformats-opensource-src (5.15.7-3) UNRELEASED; urgency=medium
 
+  [ Dmitry Shachnev ]
+  * Fix tests with libtiff 4.5 (closes: #1027679).
+    - Depend on qtbase version which has image_deletion_order.diff.
+    - Add a patch to implement support for file memory mapping for tiff.
 
  -- Debian Qt/KDE Maintainers <debian-qt-kde at lists.debian.org>  Thu, 12 Jan 2023 15:17:03 +0400
 
diff --git a/debian/control b/debian/control
index def4fb8..eca49dc 100644
--- a/debian/control
+++ b/debian/control
@@ -14,7 +14,7 @@ Build-Depends: debhelper-compat (= 13),
                libmng-dev,
                libtiff-dev,
                libwebp-dev (>= 0.4.0-4.1~),
-               qtbase5-dev (>= 5.15.7+dfsg~)
+               qtbase5-dev (>= 5.15.7+dfsg-3~)
 Standards-Version: 4.6.1
 Rules-Requires-Root: no
 Homepage: https://doc.qt.io/qt-5/qtimageformats-index.html
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..c449887
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+tiff_memory_mapping.diff
diff --git a/debian/patches/tiff_memory_mapping.diff b/debian/patches/tiff_memory_mapping.diff
new file mode 100644
index 0000000..7b9362b
--- /dev/null
+++ b/debian/patches/tiff_memory_mapping.diff
@@ -0,0 +1,60 @@
+Description: implement support for file memory mapping for tiff reading
+ libtiff will by default attempt to establish a memory map for reading
+ a tiff file. Implement the callbacks to establish this in Qt's tiff
+ handler, since this will save data copying, particularly in the case
+ where the input file is already in memory as a resource or QBuffer.
+ .
+ Also, this makes sure that QTiffHandler utilizes libtiff's default,
+ and hence best tested, code path for tiff decoding. Specifically, it
+ avoids a hitting a bug that breaks reading of certain tiffs in the
+ newly released libtiff version 4.5.0.
+Origin: https://codereview.qt-project.org/c/qt/qtimageformats/+/452211
+Last-Update: 2023-01-12
+
+--- a/src/plugins/imageformats/tiff/qtiffhandler.cpp
++++ b/src/plugins/imageformats/tiff/qtiffhandler.cpp
+@@ -43,6 +43,8 @@
+ #include <qdebug.h>
+ #include <qimage.h>
+ #include <qglobal.h>
++#include <qbuffer.h>
++#include <qfiledevice.h>
+ extern "C" {
+ #include "tiffio.h"
+ }
+@@ -90,13 +92,33 @@ toff_t qtiffSizeProc(thandle_t fd)
+     return static_cast<QIODevice *>(fd)->size();
+ }
+ 
+-int qtiffMapProc(thandle_t /*fd*/, tdata_t* /*pbase*/, toff_t* /*psize*/)
++int qtiffMapProc(thandle_t fd, void **base, toff_t *size)
+ {
++    QIODevice *device = static_cast<QIODevice *>(fd);
++
++    QFileDevice *file = qobject_cast<QFileDevice *>(device);
++    if (file) {
++        *base = file->map(0, file->size());
++        if (*base != nullptr) {
++            *size = file->size();
++            return 1;
++        }
++    } else {
++        QBuffer *buf = qobject_cast<QBuffer *>(device);
++        if (buf) {
++            *base = const_cast<char *>(buf->data().constData());
++            *size = buf->size();
++            return 1;
++        }
++    }
+     return 0;
+ }
+ 
+-void qtiffUnmapProc(thandle_t /*fd*/, tdata_t /*base*/, toff_t /*size*/)
++void qtiffUnmapProc(thandle_t fd, void *base, toff_t /*size*/)
+ {
++    QFileDevice *file = qobject_cast<QFileDevice *>(static_cast<QIODevice *>(fd));
++    if (file && base)
++        file->unmap(static_cast<uchar *>(base));
+ }
+ 
+ 



More information about the Neon-commits mailing list