Avidemux Forum

Avidemux => Main version 2.6 => Topic started by: nibbles on March 12, 2012, 09:45:48 am

Title: 2.6 r7745 warning - Precedence in ADM_aacadts.cpp
Post by: nibbles on March 12, 2012, 09:45:48 am
Maybe I can help 2.6 a little, if we examine some warnings I get from Clang.  It is excellent at offering advice and analysis.  Here is a good example.  You can see below how Clang has guessed something may be wrong:


/tmp/homebrew-avidemux3-2.6-getv/avidemux_core/ADM_coreAudioParser/src/ADM_aacadts.cpp:138:30: warning: & has lower precedence than ==; == will be evaluated
      first [-Wparentheses]
        if(p[0]==0xff && p[1]&0xf0==0xf0)
                             ^~~~~~~~~~~
/tmp/homebrew-avidemux3-2.6-getv/avidemux_core/ADM_coreAudioParser/src/ADM_aacadts.cpp:138:30: note: place parentheses around the == expression to silence this
      warning
        if(p[0]==0xff && p[1]&0xf0==0xf0)
                             ^
                              (         )
/tmp/homebrew-avidemux3-2.6-getv/avidemux_core/ADM_coreAudioParser/src/ADM_aacadts.cpp:138:30: note: place parentheses around the & expression to evaluate it
      first
        if(p[0]==0xff && p[1]&0xf0==0xf0)
                             ^
                         (        )
1 warning generated.



I do not understand code where (0xf0==0xf0) is the idea.  So did Clang spot a need for ( ) ?
Here is a link to the source code in 2.6_branch_mean (http://svn.berlios.de/viewvc/avidemux/branches/avidemux_2.6_branch_mean/avidemux_core/ADM_coreAudioParser/src/ADM_aacadts.cpp?view=markup)

Ok well, that's about how hard it is :-)  I sit there, Clang tells me how to fix stuff.
If this sort of post is useful, let me know.  Thanks.
Title: Re: 2.6 r7745 warning - Precedence in ADM_aacadts.cpp
Post by: Agent_007 on March 12, 2012, 06:26:37 pm
I would guess it is a TYPO. Or at least I think there is an easier way to to bit comparisions  :)