Ver código fonte

fix comma warnings when building with -Wcomma

kroko 6 anos atrás
pai
commit
a2cd79b8ff
1 arquivos alterados com 9 adições e 8 exclusões
  1. 9 8
      stb_image_write.h

+ 9 - 8
stb_image_write.h

@@ -393,7 +393,7 @@ static void stbiw__putc(stbi__write_context *s, unsigned char c)
 static void stbiw__write3(stbi__write_context *s, unsigned char a, unsigned char b, unsigned char c)
 static void stbiw__write3(stbi__write_context *s, unsigned char a, unsigned char b, unsigned char c)
 {
 {
    unsigned char arr[3];
    unsigned char arr[3];
-   arr[0] = a, arr[1] = b, arr[2] = c;
+   arr[0] = a; arr[1] = b; arr[2] = c;
    s->func(s->context, arr, 3);
    s->func(s->context, arr, 3);
 }
 }
 
 
@@ -441,10 +441,11 @@ static void stbiw__write_pixels(stbi__write_context *s, int rgb_dir, int vdir, i
    if (stbi__flip_vertically_on_write)
    if (stbi__flip_vertically_on_write)
       vdir *= -1;
       vdir *= -1;
 
 
-   if (vdir < 0)
-      j_end = -1, j = y-1;
-   else
-      j_end =  y, j = 0;
+   if (vdir < 0) {
+      j_end = -1; j = y-1;
+   } else {
+      j_end =  y; j = 0;
+   }
 
 
    for (; j != j_end; j += vdir) {
    for (; j != j_end; j += vdir) {
       for (i=0; i < x; ++i) {
       for (i=0; i < x; ++i) {
@@ -895,7 +896,7 @@ STBIWDEF unsigned char * stbi_zlib_compress(unsigned char *data, int data_len, i
       for (j=0; j < n; ++j) {
       for (j=0; j < n; ++j) {
          if (hlist[j]-data > i-32768) { // if entry lies within window
          if (hlist[j]-data > i-32768) { // if entry lies within window
             int d = stbiw__zlib_countm(hlist[j], data+i, data_len-i);
             int d = stbiw__zlib_countm(hlist[j], data+i, data_len-i);
-            if (d >= best) best=d,bestloc=hlist[j];
+            if (d >= best) { best=d; bestloc=hlist[j]; }
          }
          }
       }
       }
       // when hash table entry is too long, delete half the entries
       // when hash table entry is too long, delete half the entries
@@ -954,8 +955,8 @@ STBIWDEF unsigned char * stbi_zlib_compress(unsigned char *data, int data_len, i
       int blocklen = (int) (data_len % 5552);
       int blocklen = (int) (data_len % 5552);
       j=0;
       j=0;
       while (j < data_len) {
       while (j < data_len) {
-         for (i=0; i < blocklen; ++i) s1 += data[j+i], s2 += s1;
-         s1 %= 65521, s2 %= 65521;
+         for (i=0; i < blocklen; ++i) { s1 += data[j+i]; s2 += s1; }
+         s1 %= 65521; s2 %= 65521;
          j += blocklen;
          j += blocklen;
          blocklen = 5552;
          blocklen = 5552;
       }
       }