Fix FTBFS introduced by PR #302

LibTIFF versions 4.2.0 and older used custom integer types, causing
distributions with those versions to fail when building.

In 4.3.0 and newer, the 'uint16' and 'uint32' types are deprecated,
so this removes the deprecation warnings and keeps compatibility with
any versions of LibTIFF where uint16 and uint32 did not equal their
stdint.h counterparts.

Signed-off-by: mio <stigma@disroot.org>
(cherry picked from commit 5c1b76e6bf)
pull/312/head
mio 3 months ago committed by Slávek Banko
parent e2732d3866
commit 4ba000750e
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

@ -13,6 +13,13 @@
#include <assert.h> #include <assert.h>
#if (TIFFLIB_VERSION >= 20210416)
#undef uint16
#define uint16 uint16_t
#undef uint32
#define uint32 uint32_t
#endif
#include "tiffr.h" #include "tiffr.h"
static tsize_t tiff_read( thandle_t handle, tdata_t buf, tsize_t size ) static tsize_t tiff_read( thandle_t handle, tdata_t buf, tsize_t size )
@ -67,8 +74,8 @@ TDE_EXPORT void kimgio_tiff_read( TQImageIO *io )
uint32 width, height; uint32 width, height;
uint32 *data; uint32 *data;
uint16_t extra_samples_count; uint16 extra_samples_count;
uint16_t *extra_samples; uint16 *extra_samples;
// FIXME: use qdatastream // FIXME: use qdatastream
@ -139,7 +146,7 @@ TDE_EXPORT void kimgio_tiff_read( TQImageIO *io )
if (TIFFGetField(tiff, TIFFTAG_EXTRASAMPLES, &extra_samples_count, &extra_samples) == 1) if (TIFFGetField(tiff, TIFFTAG_EXTRASAMPLES, &extra_samples_count, &extra_samples) == 1)
{ {
kdDebug(399) << "TIFF image has " << extra_samples_count << " extra sample(s)." << endl; kdDebug(399) << "TIFF image has " << extra_samples_count << " extra sample(s)." << endl;
for (uint16_t i = 0; i < extra_samples_count; i++) for (uint16 i = 0; i < extra_samples_count; i++)
{ {
if ((extra_samples[i] == EXTRASAMPLE_ASSOCALPHA) || if ((extra_samples[i] == EXTRASAMPLE_ASSOCALPHA) ||
(extra_samples[i] == EXTRASAMPLE_UNASSALPHA)) (extra_samples[i] == EXTRASAMPLE_UNASSALPHA))

Loading…
Cancel
Save