]> granicus.if.org Git - libjpeg-turbo/commitdiff
Silence pedantic GCC6 code formatting warnings
authorDRC <information@libjpeg-turbo.org>
Thu, 14 Jul 2016 18:36:47 +0000 (13:36 -0500)
committerDRC <information@libjpeg-turbo.org>
Thu, 14 Jul 2016 18:36:47 +0000 (13:36 -0500)
Apparently it's "misleading" to put two self-contained if statements
on a single line.  Who knew?

bmp.c
tjbench.c
turbojpeg.c

diff --git a/bmp.c b/bmp.c
index 9fcf7bbd5d6257801997ba85013e14efae60f50b..2b8e80c137262584b5ec3187b12c81bc37ec6be7 100644 (file)
--- a/bmp.c
+++ b/bmp.c
@@ -108,10 +108,14 @@ static void pixelconvert(unsigned char *srcbuf, int srcpf, int srcbottomup,
                                        m=(m-k)/(1.0-k);
                                        y=(y-k)/(1.0-k);
                                }
-                               if(c>1.0) c=1.0;  if(c<0.) c=0.;
-                               if(m>1.0) m=1.0;  if(m<0.) m=0.;
-                               if(y>1.0) y=1.0;  if(y<0.) y=0.;
-                               if(k>1.0) k=1.0;  if(k<0.) k=0.;
+                               if(c>1.0) c=1.0;
+                               if(c<0.) c=0.;
+                               if(m>1.0) m=1.0;
+                               if(m<0.) m=0.;
+                               if(y>1.0) y=1.0;
+                               if(y<0.) y=0.;
+                               if(k>1.0) k=1.0;
+                               if(k<0.) k=0.;
                                *dstcolptr++=(unsigned char)(255.0-c*255.0+0.5);
                                *dstcolptr++=(unsigned char)(255.0-m*255.0+0.5);
                                *dstcolptr++=(unsigned char)(255.0-y*255.0+0.5);
@@ -133,9 +137,12 @@ static void pixelconvert(unsigned char *srcbuf, int srcpf, int srcbottomup,
                                double r=c*k/255.;
                                double g=m*k/255.;
                                double b=y*k/255.;
-                               if(r>255.0) r=255.0;  if(r<0.) r=0.;
-                               if(g>255.0) g=255.0;  if(g<0.) g=0.;
-                               if(b>255.0) b=255.0;  if(b<0.) b=0.;
+                               if(r>255.0) r=255.0;
+                               if(r<0.) r=0.;
+                               if(g>255.0) g=255.0;
+                               if(g<0.) g=0.;
+                               if(b>255.0) b=255.0;
+                               if(b<0.) b=0.;
                                dstcolptr[tjRedOffset[dstpf]]=(unsigned char)(r+0.5);
                                dstcolptr[tjGreenOffset[dstpf]]=(unsigned char)(g+0.5);
                                dstcolptr[tjBlueOffset[dstpf]]=(unsigned char)(b+0.5);
index 81b36f6375cdadf6054415efed183284c2ddd582..9db1968c1dfdf1443a9ec7398555481a4a7665ed 100644 (file)
--- a/tjbench.c
+++ b/tjbench.c
@@ -248,7 +248,8 @@ int decomp(unsigned char *srcbuf, unsigned char **jpegbuf,
                                        int y=(int)((double)srcbuf[rindex]*0.299
                                                + (double)srcbuf[gindex]*0.587
                                                + (double)srcbuf[bindex]*0.114 + 0.5);
-                                       if(y>255) y=255;  if(y<0) y=0;
+                                       if(y>255) y=255;
+                                       if(y<0) y=0;
                                        dstbuf[rindex]=abs(dstbuf[rindex]-y);
                                        dstbuf[gindex]=abs(dstbuf[gindex]-y);
                                        dstbuf[bindex]=abs(dstbuf[bindex]-y);
@@ -300,7 +301,8 @@ int fullTest(unsigned char *srcbuf, int w, int h, int subsamp, int jpegqual,
 
        for(tilew=dotile? 8:w, tileh=dotile? 8:h; ; tilew*=2, tileh*=2)
        {
-               if(tilew>w) tilew=w;  if(tileh>h) tileh=h;
+               if(tilew>w) tilew=w;
+               if(tileh>h) tileh=h;
                ntilesw=(w+tilew-1)/tilew;  ntilesh=(h+tileh-1)/tileh;
 
                if((jpegbuf=(unsigned char **)malloc(sizeof(unsigned char *)
@@ -447,7 +449,8 @@ int fullTest(unsigned char *srcbuf, int w, int h, int subsamp, int jpegqual,
 
                for(i=0; i<ntilesw*ntilesh; i++)
                {
-                       if(jpegbuf[i]) tjFree(jpegbuf[i]);  jpegbuf[i]=NULL;
+                       if(jpegbuf[i]) tjFree(jpegbuf[i]);
+                       jpegbuf[i]=NULL;
                }
                free(jpegbuf);  jpegbuf=NULL;
                free(jpegsize);  jpegsize=NULL;
@@ -465,7 +468,8 @@ int fullTest(unsigned char *srcbuf, int w, int h, int subsamp, int jpegqual,
        {
                for(i=0; i<ntilesw*ntilesh; i++)
                {
-                       if(jpegbuf[i]) tjFree(jpegbuf[i]);  jpegbuf[i]=NULL;
+                       if(jpegbuf[i]) tjFree(jpegbuf[i]);
+                       jpegbuf[i]=NULL;
                }
                free(jpegbuf);  jpegbuf=NULL;
        }
@@ -532,7 +536,8 @@ int decompTest(char *filename)
 
        for(tilew=dotile? 16:w, tileh=dotile? 16:h; ; tilew*=2, tileh*=2)
        {
-               if(tilew>w) tilew=w;  if(tileh>h) tileh=h;
+               if(tilew>w) tilew=w;
+               if(tileh>h) tileh=h;
                ntilesw=(w+tilew-1)/tilew;  ntilesh=(h+tileh-1)/tileh;
 
                if((jpegbuf=(unsigned char **)malloc(sizeof(unsigned char *)
@@ -692,7 +697,8 @@ int decompTest(char *filename)
        {
                for(i=0; i<ntilesw*ntilesh; i++)
                {
-                       if(jpegbuf[i]) tjFree(jpegbuf[i]);  jpegbuf[i]=NULL;
+                       if(jpegbuf[i]) tjFree(jpegbuf[i]);
+                       jpegbuf[i]=NULL;
                }
                free(jpegbuf);  jpegbuf=NULL;
        }
index 421b5f8dccb753db1a31293b65bbe2513f295ea0..9b5a4ad7734a3eb0dd95dad83b7d3cbb7355bca3 100644 (file)
@@ -570,7 +570,8 @@ static tjhandle _tjInitCompress(tjinstance *this)
        if(setjmp(this->jerr.setjmp_buffer))
        {
                /* If we get here, the JPEG code has signaled an error. */
-               if(this) free(this);  return NULL;
+               if(this) free(this);
+               return NULL;
        }
 
        jpeg_create_compress(&this->cinfo);
@@ -1231,7 +1232,8 @@ static tjhandle _tjInitDecompress(tjinstance *this)
        if(setjmp(this->jerr.setjmp_buffer))
        {
                /* If we get here, the JPEG code has signaled an error. */
-               if(this) free(this);  return NULL;
+               if(this) free(this);
+               return NULL;
        }
 
        jpeg_create_decompress(&this->dinfo);