From 532acdc443f6a619df73d5e7c504da96c8b92d9c Mon Sep 17 00:00:00 2001 From: David Maciejak Date: Wed, 15 Feb 2023 19:06:46 +0800 Subject: [PATCH] WRaster: Avoid types deprecated with libtiff 4.3 This patch is fixing compiler warnings like: load_tiff.c:42:9: warning: 'uint16' is deprecated [-Wdeprecated-declarations] load_tiff.c:43:9: warning: 'uint32' is deprecated [-Wdeprecated-declarations] As starting from libtiff 4.3, released in April 2021, types were moved from uint16 to uint16_t and uint32 to uint32_t respectively. See https://libtiff.gitlab.io/libtiff/releases/v4.3.0.html --- wrlib/load_tiff.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/wrlib/load_tiff.c b/wrlib/load_tiff.c index bf21c187..8e86baa1 100644 --- a/wrlib/load_tiff.c +++ b/wrlib/load_tiff.c @@ -28,6 +28,7 @@ #include #include +#include #include "wraster.h" #include "imgformat.h" @@ -38,14 +39,19 @@ RImage *RLoadTIFF(const char *file, int index) { RImage *image = NULL; TIFF *tif; - int i; + int i, ch; unsigned char *r, *g, *b, *a; - uint16 alpha, amode; +#if TIFFLIB_VERSION < 20210416 + uint16 alpha, amode, extrasamples; + uint16 *sampleinfo; uint32 width, height; uint32 *data, *ptr; - uint16 extrasamples; - uint16 *sampleinfo; - int ch; +#else + uint16_t alpha, amode, extrasamples;; + uint16_t *sampleinfo; + uint32_t width, height; + uint32_t *data, *ptr; +#endif tif = TIFFOpen(file, "r"); if (!tif) @@ -79,7 +85,11 @@ RImage *RLoadTIFF(const char *file, int index) } /* read data */ +#if TIFFLIB_VERSION < 20210416 ptr = data = (uint32 *) _TIFFmalloc(width * height * sizeof(uint32)); +#else + ptr = data = (uint32_t *) _TIFFmalloc(width * height * sizeof(uint32_t)); +#endif if (!data) { RErrorCode = RERR_NOMEMORY;