diff options
author | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2019-12-19 14:10:54 +0100 |
---|---|---|
committer | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2019-12-20 10:12:39 +0100 |
commit | 6124b900d9507687c21e43e68f495bbee9d8d45b (patch) | |
tree | 7b4226ee9f58d06f0de1187ef0fd1ce96faee09a /src/plugins | |
parent | fe11f37ca0d18c0025097a54c1331af25285d6fe (diff) |
Add support for reading BigTIFF
All recent versions of libtiff has support for the 64bit-indexed
BigTIFF format. Allow reading it by recognizing its magic number.
[ChangeLog][TIFF] Add support for reading BigTIFF
Fixes: QTBUG-80538
Change-Id: I7fcb72d77e4a0bdcb38ab96e9f6cfaff7cf4ad49
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/imageformats/tiff/qtiffhandler.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/plugins/imageformats/tiff/qtiffhandler.cpp b/src/plugins/imageformats/tiff/qtiffhandler.cpp index 65873e1..ad4e393 100644 --- a/src/plugins/imageformats/tiff/qtiffhandler.cpp +++ b/src/plugins/imageformats/tiff/qtiffhandler.cpp @@ -205,9 +205,14 @@ bool QTiffHandlerPrivate::canRead(QIODevice *device) // current implementation uses TIFFClientOpen which needs to be // able to seek, so sequential devices are not supported - QByteArray header = device->peek(4); - return header == QByteArray::fromRawData("\x49\x49\x2A\x00", 4) - || header == QByteArray::fromRawData("\x4D\x4D\x00\x2A", 4); + char h[4]; + if (device->peek(h, 4) != 4) + return false; + if ((h[0] == 0x49 && h[1] == 0x49) && (h[2] == 0x2a || h[2] == 0x2b) && h[3] == 0) + return true; // Little endian, classic or bigtiff + if ((h[0] == 0x4d && h[1] == 0x4d) && h[2] == 0 && (h[3] == 0x2a || h[3] == 0x2b)) + return true; // Big endian, classic or bigtiff + return false; } bool QTiffHandlerPrivate::openForRead(QIODevice *device) |