fix comma warnings when building with -Wcomma
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Happens on standard Xcode Version 9.2 (9C40b) configuration (using Apple LLVM version 9.0.0 (clang-900.0.39.2)). Addresses https://github.com/nothings/stb/issues/515
authored by kroko / Reinis Adovičs · committed by GitHub · parent e6afb9c · Browse files · 1 file·+21 added−21 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
1 file+21 added−21 removed
- other:+21 added−21 removed
Provenance
- Commit
756166e- Tree
bdf6139- Author
kroko / Reinis Adovičs <code@kroko.me>- Committer
GitHub <noreply@github.com>- Parent
e6afb9c
1 file changed+21 added−21 removed
modified:stb_image.h+21 added-21 removed
1537 unmodified lines1538 #define STBI__CASE(a,b) case STBI__COMBO(a,b): for(i=x-1; i >= 0; --i, src += a, dest += b)1539 // convert source image with img_n components to one with req_comp components;1540 // avoid switch per pixel, so use switch per scanline and massive macros1541 switch (STBI__COMBO(img_n, req_comp)) {1542- STBI__CASE(1,2) { dest[0]=src[0], dest[1]=255; } break;1542+ STBI__CASE(1,2) { dest[0]=src[0]; dest[1]=255; } break;1543 STBI__CASE(1,3) { dest[0]=dest[1]=dest[2]=src[0]; } break;1544- STBI__CASE(1,4) { dest[0]=dest[1]=dest[2]=src[0], dest[3]=255; } break;1544+ STBI__CASE(1,4) { dest[0]=dest[1]=dest[2]=src[0]; dest[3]=255; } break;1545 STBI__CASE(2,1) { dest[0]=src[0]; } break;1546 STBI__CASE(2,3) { dest[0]=dest[1]=dest[2]=src[0]; } break;1547- STBI__CASE(2,4) { dest[0]=dest[1]=dest[2]=src[0], dest[3]=src[1]; } break;1548- STBI__CASE(3,4) { dest[0]=src[0],dest[1]=src[1],dest[2]=src[2],dest[3]=255; } break;1547+ STBI__CASE(2,4) { dest[0]=dest[1]=dest[2]=src[0]; dest[3]=src[1]; } break;1548+ STBI__CASE(3,4) { dest[0]=src[0];dest[1]=src[1];dest[2]=src[2];dest[3]=255; } break;1549 STBI__CASE(3,1) { dest[0]=stbi__compute_y(src[0],src[1],src[2]); } break;1550- STBI__CASE(3,2) { dest[0]=stbi__compute_y(src[0],src[1],src[2]), dest[1] = 255; } break;1550+ STBI__CASE(3,2) { dest[0]=stbi__compute_y(src[0],src[1],src[2]); dest[1] = 255; } break;1551 STBI__CASE(4,1) { dest[0]=stbi__compute_y(src[0],src[1],src[2]); } break;1552- STBI__CASE(4,2) { dest[0]=stbi__compute_y(src[0],src[1],src[2]), dest[1] = src[3]; } break;1553- STBI__CASE(4,3) { dest[0]=src[0],dest[1]=src[1],dest[2]=src[2]; } break;1552+ STBI__CASE(4,2) { dest[0]=stbi__compute_y(src[0],src[1],src[2]); dest[1] = src[3]; } break;1553+ STBI__CASE(4,3) { dest[0]=src[0];dest[1]=src[1];dest[2]=src[2]; } break;1554 default: STBI_ASSERT(0);1555 }1556 #undef STBI__CASE1557 }29 unmodified lines1587 #define STBI__CASE(a,b) case STBI__COMBO(a,b): for(i=x-1; i >= 0; --i, src += a, dest += b)1588 // convert source image with img_n components to one with req_comp components;1589 // avoid switch per pixel, so use switch per scanline and massive macros1590 switch (STBI__COMBO(img_n, req_comp)) {1591- STBI__CASE(1,2) { dest[0]=src[0], dest[1]=0xffff; } break;1591+ STBI__CASE(1,2) { dest[0]=src[0]; dest[1]=0xffff; } break;1592 STBI__CASE(1,3) { dest[0]=dest[1]=dest[2]=src[0]; } break;1593- STBI__CASE(1,4) { dest[0]=dest[1]=dest[2]=src[0], dest[3]=0xffff; } break;1593+ STBI__CASE(1,4) { dest[0]=dest[1]=dest[2]=src[0]; dest[3]=0xffff; } break;1594 STBI__CASE(2,1) { dest[0]=src[0]; } break;1595 STBI__CASE(2,3) { dest[0]=dest[1]=dest[2]=src[0]; } break;1596- STBI__CASE(2,4) { dest[0]=dest[1]=dest[2]=src[0], dest[3]=src[1]; } break;1597- STBI__CASE(3,4) { dest[0]=src[0],dest[1]=src[1],dest[2]=src[2],dest[3]=0xffff; } break;1596+ STBI__CASE(2,4) { dest[0]=dest[1]=dest[2]=src[0]; dest[3]=src[1]; } break;1597+ STBI__CASE(3,4) { dest[0]=src[0];dest[1]=src[1];dest[2]=src[2];dest[3]=0xffff; } break;1598 STBI__CASE(3,1) { dest[0]=stbi__compute_y_16(src[0],src[1],src[2]); } break;1599- STBI__CASE(3,2) { dest[0]=stbi__compute_y_16(src[0],src[1],src[2]), dest[1] = 0xffff; } break;1599+ STBI__CASE(3,2) { dest[0]=stbi__compute_y_16(src[0],src[1],src[2]); dest[1] = 0xffff; } break;1600 STBI__CASE(4,1) { dest[0]=stbi__compute_y_16(src[0],src[1],src[2]); } break;1601- STBI__CASE(4,2) { dest[0]=stbi__compute_y_16(src[0],src[1],src[2]), dest[1] = src[3]; } break;1602- STBI__CASE(4,3) { dest[0]=src[0],dest[1]=src[1],dest[2]=src[2]; } break;1601+ STBI__CASE(4,2) { dest[0]=stbi__compute_y_16(src[0],src[1],src[2]); dest[1] = src[3]; } break;1602+ STBI__CASE(4,3) { dest[0]=src[0];dest[1]=src[1];dest[2]=src[2]; } break;1603 default: STBI_ASSERT(0);1604 }1605 #undef STBI__CASE1606 }2109 unmodified lines3716 stbi_uc *y = coutput[0];3717 if (n == 1)3718 for (i=0; i < z->s->img_x; ++i) out[i] = y[i];3719 else3720- for (i=0; i < z->s->img_x; ++i) *out++ = y[i], *out++ = 255;3720+ for (i=0; i < z->s->img_x; ++i) { *out++ = y[i]; *out++ = 255; }3721 }3722 }3723 }3724 stbi__cleanup_jpeg(z);1283 unmodified lines5008 static int stbi__high_bit(unsigned int z)5009 {5010 int n=0;5011 if (z == 0) return -1;5012- if (z >= 0x10000) n += 16, z >>= 16;5013- if (z >= 0x00100) n += 8, z >>= 8;5014- if (z >= 0x00010) n += 4, z >>= 4;5015- if (z >= 0x00004) n += 2, z >>= 2;5016- if (z >= 0x00002) n += 1, z >>= 1;5012+ if (z >= 0x10000) { n += 16; z >>= 16; }5013+ if (z >= 0x00100) { n += 8; z >>= 8; }5014+ if (z >= 0x00010) { n += 4; z >>= 4; }5015+ if (z >= 0x00004) { n += 2; z >>= 2; }5016+ if (z >= 0x00002) { n += 1; z >>= 1; }5017 return n;5018 }5019 5020 static int stbi__bitcount(unsigned int a)277 unmodified lines5298 for (j=0; j < (int) s->img_y>>1; ++j) {5299 stbi_uc *p1 = out + j *s->img_x*target;5300 stbi_uc *p2 = out + (s->img_y-1-j)*s->img_x*target;5301 for (i=0; i < (int) s->img_x*target; ++i) {5302- t = p1[i], p1[i] = p2[i], p2[i] = t;5302+ t = p1[i]; p1[i] = p2[i]; p2[i] = t;5303 }5304 }5305 }5306 2156 unmodified lines