Module Name:    src
Committed By:   mrg
Date:           Sun Feb  4 09:18:44 UTC 2018

Modified Files:
        src/sys/dev/stbi: stb_image.c

Log Message:
a macro idiom used here triggers the GCC 6.4 ident checker.  work around it.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/stbi/stb_image.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/stbi/stb_image.c
diff -u src/sys/dev/stbi/stb_image.c:1.8 src/sys/dev/stbi/stb_image.c:1.9
--- src/sys/dev/stbi/stb_image.c:1.8	Thu Jan 21 17:17:53 2016
+++ src/sys/dev/stbi/stb_image.c	Sun Feb  4 09:18:44 2018
@@ -430,7 +430,7 @@ extern int      stbi_gif_info_from_file 
 #endif
 #ifdef _KERNEL
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: stb_image.c,v 1.8 2016/01/21 17:17:53 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: stb_image.c,v 1.9 2018/02/04 09:18:44 mrg Exp $");
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/kernel.h>
@@ -1000,18 +1000,30 @@ static unsigned char *convert_format(uns
       // convert source image with img_n components to one with req_comp components;
       // avoid switch per pixel, so use switch per scanline and massive macros
       switch (COMBO(img_n, req_comp)) {
-         CASE(1,2) dest[0]=src[0], dest[1]=255; break;
-         CASE(1,3) dest[0]=dest[1]=dest[2]=src[0]; break;
-         CASE(1,4) dest[0]=dest[1]=dest[2]=src[0], dest[3]=255; break;
-         CASE(2,1) dest[0]=src[0]; break;
-         CASE(2,3) dest[0]=dest[1]=dest[2]=src[0]; break;
-         CASE(2,4) dest[0]=dest[1]=dest[2]=src[0], dest[3]=src[1]; break;
-         CASE(3,4) dest[0]=src[0],dest[1]=src[1],dest[2]=src[2],dest[3]=255; break;
-         CASE(3,1) dest[0]=compute_y(src[0],src[1],src[2]); break;
-         CASE(3,2) dest[0]=compute_y(src[0],src[1],src[2]), dest[1] = 255; break;
-         CASE(4,1) dest[0]=compute_y(src[0],src[1],src[2]); break;
-         CASE(4,2) dest[0]=compute_y(src[0],src[1],src[2]), dest[1] = src[3]; break;
-         CASE(4,3) dest[0]=src[0],dest[1]=src[1],dest[2]=src[2]; break;
+         CASE(1,2) dest[0]=src[0], dest[1]=255;
+		break;
+         CASE(1,3) dest[0]=dest[1]=dest[2]=src[0];
+		break;
+         CASE(1,4) dest[0]=dest[1]=dest[2]=src[0], dest[3]=255;
+		break;
+         CASE(2,1) dest[0]=src[0];
+		break;
+         CASE(2,3) dest[0]=dest[1]=dest[2]=src[0];
+		break;
+         CASE(2,4) dest[0]=dest[1]=dest[2]=src[0], dest[3]=src[1];
+		break;
+         CASE(3,4) dest[0]=src[0],dest[1]=src[1],dest[2]=src[2],dest[3]=255;
+		break;
+         CASE(3,1) dest[0]=compute_y(src[0],src[1],src[2]);
+		break;
+         CASE(3,2) dest[0]=compute_y(src[0],src[1],src[2]), dest[1] = 255;
+		break;
+         CASE(4,1) dest[0]=compute_y(src[0],src[1],src[2]);
+		break;
+         CASE(4,2) dest[0]=compute_y(src[0],src[1],src[2]), dest[1] = src[3];
+		break;
+         CASE(4,3) dest[0]=src[0],dest[1]=src[1],dest[2]=src[2];
+		break;
          default: assert(0);
       }
       #undef CASE
@@ -1279,7 +1291,7 @@ __forceinline static int extend_receive(
    // predict well. I tried to table accelerate it but failed.
    // maybe it's compiling as a conditional move?
    if (k < m)
-      return (-1 << n) + k + 1;
+      return (UINT_MAX << n) + k + 1;
    else
       return k;
 }
@@ -2696,13 +2708,20 @@ static int create_png_image_raw(png *a, 
                 for (i=x-1; i >= 1; --i, raw+=img_n,cur+=img_n,prior+=img_n) \
                    for (k=0; k < img_n; ++k)
          switch (filter) {
-            CASE(F_none)  cur[k] = raw[k]; break;
-            CASE(F_sub)   cur[k] = raw[k] + cur[k-img_n]; break;
-            CASE(F_up)    cur[k] = raw[k] + prior[k]; break;
-            CASE(F_avg)   cur[k] = raw[k] + ((prior[k] + cur[k-img_n])>>1); break;
-            CASE(F_paeth)  cur[k] = (uint8) (raw[k] + paeth(cur[k-img_n],prior[k],prior[k-img_n])); break;
-            CASE(F_avg_first)    cur[k] = raw[k] + (cur[k-img_n] >> 1); break;
-            CASE(F_paeth_first)  cur[k] = (uint8) (raw[k] + paeth(cur[k-img_n],0,0)); break;
+            CASE(F_none)  cur[k] = raw[k];
+		break;
+            CASE(F_sub)   cur[k] = raw[k] + cur[k-img_n];
+		break;
+            CASE(F_up)    cur[k] = raw[k] + prior[k];
+		break;
+            CASE(F_avg)   cur[k] = raw[k] + ((prior[k] + cur[k-img_n])>>1);
+		break;
+            CASE(F_paeth)  cur[k] = (uint8) (raw[k] + paeth(cur[k-img_n],prior[k],prior[k-img_n]));
+		break;
+            CASE(F_avg_first)    cur[k] = raw[k] + (cur[k-img_n] >> 1);
+		break;
+            CASE(F_paeth_first)  cur[k] = (uint8) (raw[k] + paeth(cur[k-img_n],0,0));
+		break;
          }
          #undef CASE
       } else {
@@ -2712,13 +2731,20 @@ static int create_png_image_raw(png *a, 
                 for (i=x-1; i >= 1; --i, cur[img_n]=255,raw+=img_n,cur+=out_n,prior+=out_n) \
                    for (k=0; k < img_n; ++k)
          switch (filter) {
-            CASE(F_none)  cur[k] = raw[k]; break;
-            CASE(F_sub)   cur[k] = raw[k] + cur[k-out_n]; break;
-            CASE(F_up)    cur[k] = raw[k] + prior[k]; break;
-            CASE(F_avg)   cur[k] = raw[k] + ((prior[k] + cur[k-out_n])>>1); break;
-            CASE(F_paeth)  cur[k] = (uint8) (raw[k] + paeth(cur[k-out_n],prior[k],prior[k-out_n])); break;
-            CASE(F_avg_first)    cur[k] = raw[k] + (cur[k-out_n] >> 1); break;
-            CASE(F_paeth_first)  cur[k] = (uint8) (raw[k] + paeth(cur[k-out_n],0,0)); break;
+            CASE(F_none)  cur[k] = raw[k];
+		break;
+            CASE(F_sub)   cur[k] = raw[k] + cur[k-out_n];
+		break;
+            CASE(F_up)    cur[k] = raw[k] + prior[k];
+		break;
+            CASE(F_avg)   cur[k] = raw[k] + ((prior[k] + cur[k-out_n])>>1);
+		break;
+            CASE(F_paeth)  cur[k] = (uint8) (raw[k] + paeth(cur[k-out_n],prior[k],prior[k-out_n]));
+		break;
+            CASE(F_avg_first)    cur[k] = raw[k] + (cur[k-out_n] >> 1);
+		break;
+            CASE(F_paeth_first)  cur[k] = (uint8) (raw[k] + paeth(cur[k-out_n],0,0));
+		break;
          }
          #undef CASE
       }

Reply via email to