]> granicus.if.org Git - libjpeg-turbo/commitdiff
Fix warnings about unused variables when building with GCC 4.8.x
authorDRC <dcommander@users.sourceforge.net>
Thu, 17 Apr 2014 00:47:18 +0000 (00:47 +0000)
committerDRC <dcommander@users.sourceforge.net>
Thu, 17 Apr 2014 00:47:18 +0000 (00:47 +0000)
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
turbojpeg.c

index f135da461f7f0cfad362f0ea553d46402826e363..ebad24ea0501c089229ab7d2f6ef5f8d33d1aeec 100644 (file)
--- 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; row<h; row++)
@@ -239,7 +239,7 @@ int decomptest(unsigned char *srcbuf, unsigned char **jpegbuf,
 }
 
 
-void dotestyuv(unsigned char *srcbuf, int w, int h, int subsamp,
+int dotestyuv(unsigned char *srcbuf, int w, int h, int subsamp,
        char *filename)
 {
        char tempstr[1024], tempstr2[80];
@@ -311,11 +311,11 @@ void dotestyuv(unsigned char *srcbuf, int w, int h, int subsamp,
        if(file) {fclose(file);  file=NULL;}
        if(dstbuf) {free(dstbuf);  dstbuf=NULL;}
        if(handle) {tjDestroy(handle);  handle=NULL;}
-       return;
+       return retval;
 }
 
 
-void dotest(unsigned char *srcbuf, int w, int h, int subsamp, int jpegqual,
+int dotest(unsigned char *srcbuf, int w, int h, int subsamp, int jpegqual,
        char *filename)
 {
        char tempstr[1024], tempstr2[80];
@@ -326,7 +326,7 @@ void dotest(unsigned char *srcbuf, int w, int h, int subsamp, int jpegqual,
        unsigned long *jpegsize=NULL;
        int ps=tjPixelSize[pf], ntilesw=1, ntilesh=1, pitch=w*ps;
 
-       if(yuv==YUVENCODE) {dotestyuv(srcbuf, w, h, subsamp, filename);  return;}
+       if(yuv==YUVENCODE) return dotestyuv(srcbuf, w, h, subsamp, filename);
 
        if((tmpbuf=(unsigned char *)malloc(pitch*h)) == NULL)
                _throwunix("allocating temporary image buffer");
@@ -457,11 +457,11 @@ void dotest(unsigned char *srcbuf, int w, int h, int subsamp, int jpegqual,
        if(jpegsize) {free(jpegsize);  jpegsize=NULL;}
        if(tmpbuf) {free(tmpbuf);  tmpbuf=NULL;}
        if(handle) {tjDestroy(handle);  handle=NULL;}
-       return;
+       return retval;
 }
 
 
-void dodecomptest(char *filename)
+int dodecomptest(char *filename)
 {
        FILE *file=NULL;  tjhandle handle=NULL;
        unsigned char **jpegbuf=NULL, *srcbuf=NULL;
@@ -660,7 +660,7 @@ void dodecomptest(char *filename)
        if(srcbuf) {free(srcbuf);  srcbuf=NULL;}
        if(t) {free(t);  t=NULL;}
        if(handle) {tjDestroy(handle);  handle=NULL;}
-       return;
+       return retval;
 }
 
 
index 9117273df304e6b1d66b2352aa9e097a9cb2aa59..7b9811d5d9fd78257e29c1fe16c45e25b70803c3 100644 (file)
@@ -120,6 +120,16 @@ static const tjscalingfactor sf[NUMSF]={
        if(!this) {snprintf(errStr, JMSG_LENGTH_MAX, "Invalid handle");  \
                return -1;}  \
        cinfo=&this->cinfo;  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; i<MAX_COMPONENTS; i++)
        {
@@ -881,7 +891,7 @@ DLLEXPORT int DLLCALL tjDecompressHeader2(tjhandle handle,
 {
        int retval=0;
 
-       getinstance(handle);
+       getdinstance(handle);
        if((this->init&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<MAX_COMPONENTS; i++)
        {