Merge branch 'various_fixes' into 'master'

Fix compiler warnings about unused variables when assert() expands to nothing

See merge request libtiff/libtiff!157
This commit is contained in:
Even Rouault 2020-10-12 19:18:40 +00:00
commit e2801db6fd
11 changed files with 25 additions and 3 deletions

View File

@ -166,6 +166,7 @@ static void TIFFWriteOvrRow( TIFFOvrCache * psCache )
/* -------------------------------------------------------------------- */
nBaseDirOffset = TIFFCurrentDirOffset( psCache->hTIFF );
nRet = TIFFSetSubDirectory( psCache->hTIFF, psCache->nDirOffset );
(void) nRet;
assert( nRet == 1 );
/* -------------------------------------------------------------------- */

View File

@ -199,6 +199,7 @@ static int JBIGEncode(TIFF* tif, uint8* buffer, tmsize_t size, uint16 s)
int TIFFInitJBIG(TIFF* tif, int scheme)
{
(void)scheme;
assert(scheme == COMPRESSION_JBIG);
/*

View File

@ -2482,6 +2482,7 @@ TIFFInitJPEG(TIFF* tif, int scheme)
{
JPEGState* sp;
(void)scheme;
assert(scheme == COMPRESSION_JPEG);
/*

View File

@ -193,6 +193,7 @@ LogL16Decode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
tmsize_t cc;
int rc;
(void)s;
assert(s == 0);
assert(sp != NULL);
@ -266,6 +267,7 @@ LogLuvDecode24(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
unsigned char* bp;
uint32* tp;
(void)s;
assert(s == 0);
assert(sp != NULL);
@ -326,6 +328,7 @@ LogLuvDecode32(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
tmsize_t cc;
int rc;
(void)s;
assert(s == 0);
sp = DecoderState(tif);
assert(sp != NULL);
@ -447,6 +450,7 @@ LogL16Encode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
int rc=0, mask;
tmsize_t beg;
(void)s;
assert(s == 0);
assert(sp != NULL);
npixels = cc / sp->pixel_size;
@ -541,6 +545,7 @@ LogLuvEncode24(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
uint8* op;
uint32* tp;
(void)s;
assert(s == 0);
assert(sp != NULL);
npixels = cc / sp->pixel_size;
@ -598,6 +603,7 @@ LogLuvEncode32(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
int rc=0, mask;
tmsize_t beg;
(void)s;
assert(s == 0);
assert(sp != NULL);

View File

@ -420,6 +420,7 @@ TIFFInitLZMA(TIFF* tif, int scheme)
LZMAState* sp;
lzma_stream tmp_stream = LZMA_STREAM_INIT;
(void)scheme;
assert( scheme == COMPRESSION_LZMA );
/*

View File

@ -1161,6 +1161,7 @@ int
TIFFInitLZW(TIFF* tif, int scheme)
{
static const char module[] = "TIFFInitLZW";
(void)scheme;
assert(scheme == COMPRESSION_LZW);
/*
* Allocate state block so tag methods have storage to record values.

View File

@ -421,6 +421,7 @@ TIFFInitOJPEG(TIFF* tif, int scheme)
static const char module[]="TIFFInitOJPEG";
OJPEGState* sp;
(void)scheme;
assert(scheme==COMPRESSION_OJPEG);
/*

View File

@ -104,6 +104,7 @@ TIFFClientOpen(
} n;
n.a8[0]=1;
n.a8[1]=0;
(void)n;
#ifdef WORDS_BIGENDIAN
assert(n.a16==256);
#else

View File

@ -1400,6 +1400,7 @@ TIFFInitPixarLog(TIFF* tif, int scheme)
PixarLogState* sp;
(void)scheme;
assert(scheme == COMPRESSION_PIXARLOG);
/*

View File

@ -628,6 +628,7 @@ TIFFInitWebP(TIFF* tif, int scheme)
static const char module[] = "TIFFInitWebP";
WebPState* sp;
(void)scheme;
assert( scheme == COMPRESSION_WEBP );
/*

View File

@ -148,11 +148,15 @@ int test(int classictif, int height, int tiled)
assert(err == 0);
size = TIFFGetStrileByteCountWithErr(tif, j, &err);
(void)size;
assert(size == 256);
assert(err == 0);
fseek(f, offset, SEEK_SET);
fread(inputbuffer, 256, 1, f);
{
size_t nread = fread(inputbuffer, 256, 1, f);
(void)nread;
}
memset(tilebuffer,0, 256);
ret = TIFFReadFromUserBuffer(tif, j,
@ -204,12 +208,15 @@ int test(int classictif, int height, int tiled)
assert(err == 0);
size = TIFFGetStrileByteCountWithErr(tif, j, &err);
(void)size;
assert(size == 1);
assert(err == 0);
fseek(f, offset, SEEK_SET);
fread(inputbuffer, 1, 1, f);
{
size_t nread = fread(inputbuffer, 1, 1, f);
(void)nread;
}
memset(tilebuffer,0, 1);
ret = TIFFReadFromUserBuffer(tif, j,
inputbuffer, 1,