<< Return to list of all diagnostics
V564. The '&' or '|' operator is applied to bool type value. You've probably forgotten to include parentheses or intended to use the '&&' or '||' operator.
DOSBox
V564 The '&' operator is applied to bool type value. You've probably forgotten to include parentheses or intended to use the '&&' operator. dosbox sdlmain.cpp 519
static SDL_Surface * GFX_SetupSurfaceScaled(Bit32u sdl_flags,
Bit32u bpp) {
...
if (!sdl.blit.surface ||
(!sdl.blit.surface->flags & SDL_HWSURFACE)) {
...
}
This is what should have been written here: !(sdl.blit.surface->flags & SDL_HWSURFACE)
FCEUX
V564 The '|' operator is applied to bool type value. You've probably forgotten to include parentheses or intended to use the '||' operator. fceux memwatch.cpp 711
V502 Perhaps the '?:' operator works in a different way than it was expected. The '?:' operator has a lower priority than the '|' operator. fceux memwatch.cpp 711
static BOOL CALLBACK MemWatchCallB(
HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
...
EnableMenuItem(memwmenu,MEMW_FILE_SAVE,
MF_BYCOMMAND | fileChanged ? MF_ENABLED:MF_GRAYED);
...
}
This is what it turns out to be: (MF_BYCOMMAND | fileChanged) ? MF_ENABLED:MF_GRAYED, while it should actually be: MF_BYCOMMAND | (fileChanged ? MF_ENABLED:MF_GRAYED). The code works due to sheer luck, as #define MF_BYCOMMAND 0x00000000L.
Wolfenstein 3D
V564 The '&' operator is applied to bool type value. You've probably forgotten to include parentheses or intended to use the '&&' operator. game g_client.c 1534
#define SVF_CASTAI 0x00000010
char *ClientConnect( int clientNum, qboolean firstTime,
qboolean isBot ) {
...
if ( !ent->r.svFlags & SVF_CASTAI ) {
...
}
This is what should have been written here: if ( ! (ent->r.svFlags & SVF_CASTAI) ) {
Identical errors can be found in some other places:
- V564 The '&' operator is applied to bool type value. You've probably forgotten to include parentheses or intended to use the '&&' operator. game g_client.c 1616
Chromium
V564 The '&' operator is applied to bool type value. You've probably forgotten to include parentheses or intended to use the '&&' operator. base platform_file_win.cc 216
#define FILE_ATTRIBUTE_DIRECTORY 0x00000010
bool GetPlatformFileInfo(PlatformFile file,
PlatformFileInfo* info) {
...
info->is_directory =
file_info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY != 0;
...
}
Network Security Services (NSS)
V564 The '&' operator is applied to bool type value. You've probably forgotten to include parentheses or intended to use the '&&' operator. nss secasn1u.c 121
PRBool SEC_ASN1IsTemplateSimple(
const SEC_ASN1Template *theTemplate)
{
...
if (!theTemplate->kind & SEC_ASN1_CHOICE) {
return PR_FALSE; /* no choice means not simple */
}
...
}
This is what should have been written here: if (!(theTemplate->kind & SEC_ASN1_CHOICE)) {
MySQL
V564 The '&' operator is applied to bool type value. You've probably forgotten to include parentheses or intended to use the '&&' operator. innobase ha_innodb.cc 6789
int ha_innobase::create(....)
{
...
if (srv_file_per_table
&& !mysqld_embedded
&& (!create_info->options & HA_LEX_CREATE_TMP_TABLE)) {
...
}
This is what should have been written here: (!(create_info->options & HA_LEX_CREATE_TMP_TABLE))
Chromium
V564 The '&' operator is applied to bool type value. You've probably forgotten to include parentheses or intended to use the '&&' operator. nss secasn1u.c 121
#define SEC_ASN1_CHOICE 0x100000
typedef struct sec_ASN1Template_struct {
unsigned long kind;
...
} SEC_ASN1Template;
PRBool SEC_ASN1IsTemplateSimple(
const SEC_ASN1Template *theTemplate)
{
...
if (!theTemplate->kind & SEC_ASN1_CHOICE) {
...
}
This is what should have been written here: if (!(theTemplate->kind & SEC_ASN1_CHOICE)) {
Doom 3
V564 The '&' operator is applied to bool type value. You've probably forgotten to include parentheses or intended to use the '&&' operator. Game target.cpp 257
#define BIT( num ) ( 1 << ( num ) )
const int BUTTON_ATTACK = BIT(0);
void idTarget_WaitForButton::Think( void ) {
...
if ( player &&
( !player->oldButtons & BUTTON_ATTACK ) &&
( player->usercmd.buttons & BUTTON_ATTACK ) ) {
...
}
A trouble with parentheses: ( !(player->oldButtons & BUTTON_ATTACK) ) &&
Battle for Wesnoth
V564 The '&' operator is applied to bool type value. You've probably forgotten to include parentheses or intended to use the '&&' operator. wesnoth dialogs.cpp 902
enum { REMOVE_EMPTY = 0x01,
STRIP_SPACES = 0x02
};
void unit_preview_pane::draw_contents()
{
...
// we don't remove empty lines, so all fields stay
// at the same place
const std::vector<std::string> lines =
utils::split(text.str(), '\n',
utils::STRIP_SPACES & !utils::REMOVE_EMPTY);
...
}
Blender
V564 The '&' operator is applied to bool type value. You've probably forgotten to include parentheses or intended to use the '&&' operator. bf_intern_elbeem solver_main.cpp 567
#define DEFAULT_STREAM \
m[dC] = RAC(ccel,dC); \
\
if((!nbored & CFBnd)) { \
\
....
A parenthesis is put in a wrong place: if(!(nbored & CFBnd)) { \