Skip to content

Commit 8168a79

Browse files
committed
Fix deprecation warnings from libtiff
* src/image.c (UINT32) [TIFFLIB_VERSION >= 20210416]: Define to use stdint.h type for recent libtiff versions. Reported by Andy Moreton <[email protected]>.
1 parent 10f18ff commit 8168a79

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/image.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7774,6 +7774,13 @@ tiff_image_p (Lisp_Object object)
77747774

77757775
# include <tiffio.h>
77767776

7777+
/* libtiff version 4.3.0 deprecated uint32 typedef. */
7778+
#if TIFFLIB_VERSION >= 20210416
7779+
# define UINT32 uint32_t
7780+
#else
7781+
# define UINT32 uint32
7782+
#endif
7783+
77777784
# ifdef WINDOWSNT
77787785

77797786
/* TIFF library details. */
@@ -7785,7 +7792,7 @@ DEF_DLL_FN (TIFF *, TIFFClientOpen,
77857792
TIFFReadWriteProc, TIFFSeekProc, TIFFCloseProc, TIFFSizeProc,
77867793
TIFFMapFileProc, TIFFUnmapFileProc));
77877794
DEF_DLL_FN (int, TIFFGetField, (TIFF *, ttag_t, ...));
7788-
DEF_DLL_FN (int, TIFFReadRGBAImage, (TIFF *, uint32, uint32, uint32 *, int));
7795+
DEF_DLL_FN (int, TIFFReadRGBAImage, (TIFF *, UINT32, UINT32, UINT32 *, int));
77897796
DEF_DLL_FN (void, TIFFClose, (TIFF *));
77907797
DEF_DLL_FN (int, TIFFSetDirectory, (TIFF *, tdir_t));
77917798

@@ -7977,7 +7984,7 @@ tiff_load (struct frame *f, struct image *img)
79777984
Lisp_Object specified_data;
79787985
TIFF *tiff;
79797986
int width, height, x, y, count;
7980-
uint32 *buf;
7987+
UINT32 *buf;
79817988
int rc;
79827989
Emacs_Pix_Container ximg;
79837990
tiff_memory_source memsrc;
@@ -8103,11 +8110,11 @@ tiff_load (struct frame *f, struct image *img)
81038110
/* Process the pixel raster. Origin is in the lower-left corner. */
81048111
for (y = 0; y < height; ++y)
81058112
{
8106-
uint32 *row = buf + y * width;
8113+
UINT32 *row = buf + y * width;
81078114

81088115
for (x = 0; x < width; ++x)
81098116
{
8110-
uint32 abgr = row[x];
8117+
UINT32 abgr = row[x];
81118118
int r = TIFFGetR (abgr) << 8;
81128119
int g = TIFFGetG (abgr) << 8;
81138120
int b = TIFFGetB (abgr) << 8;

0 commit comments

Comments
 (0)