Dear all,
When compiling LibRaw on OS X 10.7.3 (as part of compiling Darktable, actually) Clang gives me a few warnings about AND-ing actions in dcraw_common.cpp. I have pasted them below. They all look valid to me and would probably benefit from doing what the compiler suggests. Can someone please verify and fix this? Or is there another path I should follow to do this?
/Users/jhegeman/tmp_darktable/darktable/src/external/LibRaw/internal/dcraw_common.cpp:827:28: warning: & has lower precedence than >=; >= will be evaluated
first [-Wparentheses]
if(offset[slice] & 0x0fffffff >= raw_width * raw_height)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/jhegeman/tmp_darktable/darktable/src/external/LibRaw/internal/dcraw_common.cpp:827:28: note: place parentheses around the >= expression to silence
this warning
if(offset[slice] & 0x0fffffff >= raw_width * raw_height)
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/jhegeman/tmp_darktable/darktable/src/external/LibRaw/internal/dcraw_common.cpp:827:28: note: place parentheses around the & expression to evaluate
it first
if(offset[slice] & 0x0fffffff >= raw_width * raw_height)
^
( )
/Users/jhegeman/tmp_darktable/darktable/src/external/LibRaw/internal/dcraw_common.cpp:7589:30: warning: use of logical '&&' with constant operand
[-Wconstant-logical-operand]
is_raw += (i = get4()) && 1;
^ ~
/Users/jhegeman/tmp_darktable/darktable/src/external/LibRaw/internal/dcraw_common.cpp:7589:30: note: use '&' for a bitwise operation
is_raw += (i = get4()) && 1;
^~
&
/Users/jhegeman/tmp_darktable/darktable/src/external/LibRaw/internal/dcraw_common.cpp:7589:30: note: remove constant to silence this warning
is_raw += (i = get4()) && 1;
^~~~
Best regards,
Jeroen

1) Just ignore this for
1) Just ignore this for now.
2) The first warning will be eliminated in next release. This is generally an error, but it just prevent IO exception to occur on broken files.
3) The second warning is not an error. The code increments is_raw if get4() returns non-zero (and get4()-returned value is stored in i variable).
-- Alex Tutubalin @LibRaw LLC