1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-22 05:48:01 +01:00

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
This commit is contained in:
David Maciejak
2023-02-15 19:06:46 +08:00
committed by Carlos R. Mafra
parent d7d38aa443
commit 532acdc443

View File

@@ -28,6 +28,7 @@
#include <tiff.h> #include <tiff.h>
#include <tiffio.h> #include <tiffio.h>
#include <tiffvers.h>
#include "wraster.h" #include "wraster.h"
#include "imgformat.h" #include "imgformat.h"
@@ -38,14 +39,19 @@ RImage *RLoadTIFF(const char *file, int index)
{ {
RImage *image = NULL; RImage *image = NULL;
TIFF *tif; TIFF *tif;
int i; int i, ch;
unsigned char *r, *g, *b, *a; unsigned char *r, *g, *b, *a;
uint16 alpha, amode; #if TIFFLIB_VERSION < 20210416
uint16 alpha, amode, extrasamples;
uint16 *sampleinfo;
uint32 width, height; uint32 width, height;
uint32 *data, *ptr; uint32 *data, *ptr;
uint16 extrasamples; #else
uint16 *sampleinfo; uint16_t alpha, amode, extrasamples;;
int ch; uint16_t *sampleinfo;
uint32_t width, height;
uint32_t *data, *ptr;
#endif
tif = TIFFOpen(file, "r"); tif = TIFFOpen(file, "r");
if (!tif) if (!tif)
@@ -79,7 +85,11 @@ RImage *RLoadTIFF(const char *file, int index)
} }
/* read data */ /* read data */
#if TIFFLIB_VERSION < 20210416
ptr = data = (uint32 *) _TIFFmalloc(width * height * sizeof(uint32)); ptr = data = (uint32 *) _TIFFmalloc(width * height * sizeof(uint32));
#else
ptr = data = (uint32_t *) _TIFFmalloc(width * height * sizeof(uint32_t));
#endif
if (!data) { if (!data) {
RErrorCode = RERR_NOMEMORY; RErrorCode = RERR_NOMEMORY;