Menu

#41 ambigous logical operation in extra.c

open
nobody
None
1
2014-07-04
2014-07-04
No

extra.c: In function ‘test_file_headers’:
extra.c:634: warning: suggest parentheses around operand of ‘!’ or change ‘&’ to ‘&&’ or ‘!’ to ‘~’

the code is

    if (x==0) { /* mcrypt file format */
            openpgp = 0;
            return;
    }

/ so x!=0 here /
if ( !(!x & 0x80) && bare_flag == FALSE) {

!x (logical "not") is obviously "0"
!x & 0x80 is still "0"
!(!x & 0x80) is always "1"

I assume ~x (binary "not") is intended and not !x (logical "not").

Discussion


Log in to post a comment.