Skip to content

Commit

Permalink
Fixed bug 1801 - typo in the xcf decoder, condition is always false
Browse files Browse the repository at this point in the history
blaffablaffa

I'm compiling sdl_image with clang, and it gives this warning:

IMG_xcf.c:523:28: warning: use of logical '&&' with constant operand [-Wconstant-logical-operand]
   l = (Uint8)(0.2990 * ((a && 0x00FF0000) >> 16)

This is of course always false, because (a && 0x00FF0000) is '1', so if shifted gives always 0. There are a couple of other similar issues in the same file.
  • Loading branch information
slouken committed Apr 17, 2013
1 parent cbe3dfb commit 9e3a9f9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions IMG_xcf.c
Expand Up @@ -520,9 +520,9 @@ static unsigned char * load_xcf_tile_rle (SDL_RWops * src, Uint32 len, int bpp,

static Uint32 rgb2grey (Uint32 a) {
Uint8 l;
l = (Uint8)(0.2990 * ((a && 0x00FF0000) >> 16)
+ 0.5870 * ((a && 0x0000FF00) >> 8)
+ 0.1140 * ((a && 0x000000FF)));
l = (Uint8)(0.2990 * ((a & 0x00FF0000) >> 16)
+ 0.5870 * ((a & 0x0000FF00) >> 8)
+ 0.1140 * ((a & 0x000000FF)));

return (l << 16) | (l << 8) | l;
}
Expand Down

0 comments on commit 9e3a9f9

Please sign in to comment.