JDimproved / JDim

2ch browser for linux
https://jdimproved.github.io/JDim/
GNU General Public License v2.0
44 stars 11 forks source link

Control: Fix bitwise operations for bool value to ternary operator #1350

Closed ma8ma closed 4 months ago

ma8ma commented 4 months ago

bool変数をビット演算しているとcppcheckに指摘されたため修正します。

cppcheck 2.13.0のレポート (with inconclusive option)

src/control/control.cpp:160:42: style: inconclusive: Boolean expression 'ctrl' is used in bitwise operation. Did you mean '&&'? [bitwiseOnBoolean]
        event.state = ( GDK_CONTROL_MASK & ctrl ) | ( GDK_SHIFT_MASK & shift ) | ( GDK_MOD1_MASK & alt );
                                         ^
src/control/control.cpp:160:70: style: inconclusive: Boolean expression 'shift' is used in bitwise operation. Did you mean '&&'? [bitwiseOnBoolean]
        event.state = ( GDK_CONTROL_MASK & ctrl ) | ( GDK_SHIFT_MASK & shift ) | ( GDK_MOD1_MASK & alt );
                                                                     ^
src/control/control.cpp:160:98: style: inconclusive: Boolean expression 'alt' is used in bitwise operation. Did you mean '&&'? [bitwiseOnBoolean]
        event.state = ( GDK_CONTROL_MASK & ctrl ) | ( GDK_SHIFT_MASK & shift ) | ( GDK_MOD1_MASK & alt );
                                                                                                 ^