From 0c989d9e90c7c1e7827964fe7983259c62124ef3 Mon Sep 17 00:00:00 2001 From: DRC Date: Thu, 17 Apr 2014 00:47:18 +0000 Subject: [PATCH] Fix warnings about unused variables when building with GCC 4.8.x git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.3.x@1242 632fc199-4ca6-4c93-a231-07263d6284db --- tjbench.c | 16 ++++++++-------- turbojpeg.c | 20 +++++++++++++++----- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/tjbench.c b/tjbench.c index f135da4..ebad24e 100644 --- a/tjbench.c +++ b/tjbench.c @@ -217,7 +217,7 @@ int decomptest(unsigned char *srcbuf, unsigned char **jpegbuf, dstbuf[bindex]=abs(dstbuf[bindex]-y); } } - } + } else { for(row=0; rowcinfo; dinfo=&this->dinfo; +#define getcinstance(handle) tjinstance *this=(tjinstance *)handle; \ + j_compress_ptr cinfo=NULL; \ + if(!this) {snprintf(errStr, JMSG_LENGTH_MAX, "Invalid handle"); \ + return -1;} \ + cinfo=&this->cinfo; +#define getdinstance(handle) tjinstance *this=(tjinstance *)handle; \ + j_decompress_ptr dinfo=NULL; \ + if(!this) {snprintf(errStr, JMSG_LENGTH_MAX, "Invalid handle"); \ + return -1;} \ + dinfo=&this->dinfo; static int getPixelFormat(int pixelSize, int flags) { @@ -580,7 +590,7 @@ DLLEXPORT int DLLCALL tjCompress2(tjhandle handle, unsigned char *srcBuf, unsigned char *rgbBuf=NULL; #endif - getinstance(handle) + getcinstance(handle) if((this->init&COMPRESS)==0) _throw("tjCompress2(): Instance has not been initialized for compression"); @@ -685,7 +695,7 @@ DLLEXPORT int DLLCALL tjEncodeYUV2(tjhandle handle, unsigned char *srcBuf, unsigned char *rgbBuf=NULL; #endif - getinstance(handle); + getcinstance(handle); for(i=0; iinit&DECOMPRESS)==0) _throw("tjDecompressHeader2(): Instance has not been initialized for decompression"); @@ -947,7 +957,7 @@ DLLEXPORT int DLLCALL tjDecompress2(tjhandle handle, unsigned char *jpegBuf, unsigned char *_dstBuf=NULL; int _pitch=0; #endif - getinstance(handle); + getdinstance(handle); if((this->init&DECOMPRESS)==0) _throw("tjDecompress2(): Instance has not been initialized for decompression"); @@ -1058,7 +1068,7 @@ DLLEXPORT int DLLCALL tjDecompressToYUV(tjhandle handle, tmpbufsize=0, usetmpbuf=0, th[MAX_COMPONENTS]; JSAMPLE *_tmpbuf=NULL, *ptr=dstBuf; JSAMPROW *tmpbuf[MAX_COMPONENTS]; - getinstance(handle); + getdinstance(handle); for(i=0; i