@@ -23,8 +23,7 @@ STBIDEF unsigned char *stbi_xload(char const *filename, int *x, int *y, int *fra
2323
2424        stbi__start_file (& s , f );
2525
26-         if  (stbi__gif_test (& s ))
27-         {
26+         if  (stbi__gif_test (& s )) {
2827                stbi__gif  g ;
2928                gif_result  head ;
3029                gif_result  * prev  =  0 , * gr  =  & head ;
@@ -34,10 +33,8 @@ STBIDEF unsigned char *stbi_xload(char const *filename, int *x, int *y, int *fra
3433
3534                * frames  =  0 ;
3635
37-                 while  (gr -> data  =  stbi__gif_load_next (& s , & g , channels , 4 ))
38-                 {
39-                         if  (gr -> data  ==  (unsigned char  * )& s )
40-                         {
36+                 while  ((gr -> data  =  stbi__gif_load_next (& s , & g , channels , 4 ))) {
37+                         if  (gr -> data  ==  (unsigned char  * )& s ) {
4138                                gr -> data  =  0 ;
4239                                break ;
4340                        }
@@ -53,25 +50,22 @@ STBIDEF unsigned char *stbi_xload(char const *filename, int *x, int *y, int *fra
5350                if  (gr  !=  & head )
5451                        STBI_FREE (gr );
5552
56-                 if  (* frames  >  0 )
57-                 {
53+                 if  (* frames  >  0 ) {
5854                        * x  =  g .w ;
5955                        * y  =  g .h ;
6056                }
6157
6258                result  =  head .data ;
6359
64-                 if  (* frames  >  1 )
65-                 {
60+                 if  (* frames  >  1 ) {
6661                        unsigned int   size  =  4  *  g .w  *  g .h ;
6762                        unsigned char   * p  =  0 ;
6863
6964                        result  =  (unsigned char  * )stbi__malloc (* frames  *  (size  +  2 ));
7065                        gr  =  & head ;
7166                        p  =  result ;
7267
73-                         while  (gr )
74-                         {
68+                         while  (gr ) {
7569                                prev  =  gr ;
7670                                memcpy (p , gr -> data , size );
7771                                p  +=  size ;
@@ -83,9 +77,7 @@ STBIDEF unsigned char *stbi_xload(char const *filename, int *x, int *y, int *fra
8377                                if  (prev  !=  & head ) STBI_FREE (prev );
8478                        }
8579                }
86-         }
87-         else 
88-         {
80+         } else  {
8981                result  =  stbi__load_main (& s , x , y , channels , 0 );
9082                * frames  =  !!result ;
9183        }
@@ -142,7 +134,7 @@ void img_load_from_file(image_t *img, const char* file)
142134                }
143135
144136                // fill the array 
145-                 void  (* pixelSetter )(color_t  * pixel , unsigned char  *  ptr );
137+                 void  (* pixelSetter )(color_t  * pixel , unsigned char  *  ptr )  =   & setPixelGray ;
146138                switch  (channels ) {
147139                        case  1 :
148140                                pixelSetter  =  & setPixelGray ;
0 commit comments