Page 1 of 1

testdisk-6.14: 3 * possible bad if tests ?

Posted: 29 Oct 2013, 15:45
by dcb314
Hello there,

I just compiled testdisk-6.14 with extra Linux gcc flag -Wlogical-op

It said

1.

file_dbf.c:56:3: warning: logical 'or' of collectively exhaustive tests is always true [-Wlogical-op]

Source code is

if(buffer[0]==0x3 && (buffer[1]>80 || buffer[1]<120) &&

Suggest swap || for &&

2.

file_jpg.c:1567:3: warning: logical 'and' of mutually exclusive tests is always false [-Wlogical-op]

Source code is

if(buffer[buffer_size/2]==0xff && buffer[buffer_size/2]==0xd8 &&

3.

file_jpg.c:1622:3: warning: logical 'and' of mutually exclusive tests is always false [-Wlogical-op]

if(buffer[buffer_size/2]==0xff && buffer[buffer_size/2]==0xd8 &&

Duplicate.