From e9b9266648f0492e7671d7b19e89b82b5632064a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 30 Dec 2020 23:25:03 +0100 Subject: [PATCH] Avoid gcc -Wundef warnings in tif_zip.c Test LIBDEFLATE_SUPPORT using #ifdef, not #if. This avoids the warnings and is consistent with the other similar settings, e.g. JBIG_SUPPORT. --- libtiff/tif_zip.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/libtiff/tif_zip.c b/libtiff/tif_zip.c index e71c312c..e7c9c7d9 100644 --- a/libtiff/tif_zip.c +++ b/libtiff/tif_zip.c @@ -40,7 +40,7 @@ #include "tif_predict.h" #include "zlib.h" -#if LIBDEFLATE_SUPPORT +#ifdef LIBDEFLATE_SUPPORT #include "libdeflate.h" #endif #define LIBDEFLATE_MAX_COMPRESSION_LEVEL 12 @@ -69,7 +69,7 @@ typedef struct { int zipquality; /* compression level */ int state; /* state flags */ int subcodec; /* DEFLATE_SUBCODEC_ZLIB or DEFLATE_SUBCODEC_LIBDEFLATE */ -#if LIBDEFLATE_SUPPORT +#ifdef LIBDEFLATE_SUPPORT int libdeflate_state; /* -1 = until first time ZIPEncode() / ZIPDecode() is called, 0 = use zlib, 1 = use libdeflate */ struct libdeflate_decompressor* libdeflate_dec; struct libdeflate_compressor* libdeflate_enc; @@ -136,7 +136,7 @@ ZIPPreDecode(TIFF* tif, uint16 s) if( (sp->state & ZSTATE_INIT_DECODE) == 0 ) tif->tif_setupdecode( tif ); -#if LIBDEFLATE_SUPPORT +#ifdef LIBDEFLATE_SUPPORT sp->libdeflate_state = -1; #endif sp->stream.next_in = tif->tif_rawdata; @@ -158,7 +158,7 @@ ZIPDecode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s) assert(sp != NULL); assert(sp->state == ZSTATE_INIT_DECODE); -#if LIBDEFLATE_SUPPORT +#ifdef LIBDEFLATE_SUPPORT if( sp->libdeflate_state == 1 ) return 0; @@ -310,7 +310,7 @@ ZIPPreEncode(TIFF* tif, uint16 s) if( sp->state != ZSTATE_INIT_ENCODE ) tif->tif_setupencode( tif ); -#if LIBDEFLATE_SUPPORT +#ifdef LIBDEFLATE_SUPPORT sp->libdeflate_state = -1; #endif sp->stream.next_out = tif->tif_rawdata; @@ -336,7 +336,7 @@ ZIPEncode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s) (void) s; -#if LIBDEFLATE_SUPPORT +#ifdef LIBDEFLATE_SUPPORT if( sp->libdeflate_state == 1 ) return 0; @@ -461,7 +461,7 @@ ZIPPostEncode(TIFF* tif) ZIPState *sp = EncoderState(tif); int state; -#if LIBDEFLATE_SUPPORT +#ifdef LIBDEFLATE_SUPPORT if( sp->libdeflate_state == 1 ) return 1; #endif @@ -510,7 +510,7 @@ ZIPCleanup(TIFF* tif) sp->state = 0; } -#if LIBDEFLATE_SUPPORT +#ifdef LIBDEFLATE_SUPPORT if( sp->libdeflate_dec ) libdeflate_free_decompressor(sp->libdeflate_dec); if( sp->libdeflate_enc ) @@ -552,7 +552,7 @@ ZIPVSetField(TIFF* tif, uint32 tag, va_list ap) } } -#if LIBDEFLATE_SUPPORT +#ifdef LIBDEFLATE_SUPPORT if( sp->libdeflate_enc ) { libdeflate_free_compressor(sp->libdeflate_enc); @@ -571,7 +571,7 @@ ZIPVSetField(TIFF* tif, uint32 tag, va_list ap) "Invalid DeflateCodec value."); return 0; } -#if !LIBDEFLATE_SUPPORT +#ifndef LIBDEFLATE_SUPPORT if( sp->subcodec == DEFLATE_SUBCODEC_LIBDEFLATE ) { TIFFErrorExt(tif->tif_clientdata, module, @@ -656,7 +656,7 @@ TIFFInitZIP(TIFF* tif, int scheme) /* Default values for codec-specific fields */ sp->zipquality = Z_DEFAULT_COMPRESSION; /* default comp. level */ sp->state = 0; -#if LIBDEFLATE_SUPPORT +#ifdef LIBDEFLATE_SUPPORT sp->subcodec = DEFLATE_SUBCODEC_LIBDEFLATE; #else sp->subcodec = DEFLATE_SUBCODEC_ZLIB;