Fix more operator precedence errors. These do not do what you'd expect at first

sight. The comparison operator takes precedence over the binary ones.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29121 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz 2009-02-01 23:24:55 +00:00
parent 9490cc05f3
commit d0eaec3086
10 changed files with 22 additions and 22 deletions

View File

@ -139,7 +139,7 @@ generic_mtrr_compute_physical_mask(void)
cpuid_info cpuInfo;
if (get_current_cpuid(&cpuInfo, 0x80000000) == B_OK
&& cpuInfo.eax_0.max_eax & 0xff >= 8) {
&& (cpuInfo.eax_0.max_eax & 0xff) >= 8) {
get_current_cpuid(&cpuInfo, 0x80000008);
bits = cpuInfo.regs.eax & 0xff;

View File

@ -740,7 +740,7 @@ echo_buffer_exchange(echo_dev *card, multi_buffer_info *data)
if ((stream->state & ECHO_STATE_STARTED) != 0)
continue;
echo_stream_start(stream,
(stream->use & ECHO_USE_PLAY == 0) ? echo_record_inth : echo_play_inth, stream);
((stream->use & ECHO_USE_PLAY) == 0) ? echo_record_inth : echo_play_inth, stream);
}
if (acquire_sem_etc(card->buffer_ready_sem, 1, B_RELATIVE_TIMEOUT | B_CAN_INTERRUPT, 50000)

View File

@ -389,14 +389,14 @@ UdpDomainSupport::_Bind(UdpEndpoint *endpoint, const sockaddr *address)
if (otherEndpoint->LocalAddress().EqualPorts(address)) {
// port is already bound, SO_REUSEADDR or SO_REUSEPORT is required:
if (otherEndpoint->Socket()->options & (SO_REUSEADDR | SO_REUSEPORT) == 0
|| socketOptions & (SO_REUSEADDR | SO_REUSEPORT) == 0)
if ((otherEndpoint->Socket()->options & (SO_REUSEADDR | SO_REUSEPORT)) == 0
|| (socketOptions & (SO_REUSEADDR | SO_REUSEPORT)) == 0)
return EADDRINUSE;
// if both addresses are the same, SO_REUSEPORT is required:
if (otherEndpoint->LocalAddress().EqualTo(address, false)
&& (otherEndpoint->Socket()->options & SO_REUSEPORT == 0
|| socketOptions & SO_REUSEPORT == 0))
&& ((otherEndpoint->Socket()->options & SO_REUSEPORT) == 0
|| (socketOptions & SO_REUSEPORT) == 0))
return EADDRINUSE;
}
}

View File

@ -746,7 +746,7 @@ PDFWriter::CreatePattern()
for (int8 y = 0; y <= 7; y ++, data ++) {
uint8 d = *data;
for (int8 x = 0; x <= 7; x ++, d >>= 1) {
if (d & 1 == 1) { // foreground
if ((d & 1) == 1) { // foreground
if (pass != kPassForeground) continue;
} else { // background
if (pass != kPassBackground) continue;
@ -1059,7 +1059,7 @@ PDFWriter::IsTransparentRGBA15(uint8* in)
// 01234567 01234567
// 01201234 00123434
// GGGBBBBB ARRRRRGG
return in[1] & 1 == 0 || IsTransparentRGB15(in);
return (in[1] & 1) == 0 || IsTransparentRGB15(in);
}
@ -1070,7 +1070,7 @@ PDFWriter::IsTransparentRGBA15_BIG(uint8* in)
// 01234567 01234567
// 00123434 01201234
// ARRRRRGG GGGBBBBB
return in[0] & 1 == 0 || IsTransparentRGB15_BIG(in);
return (in[0] & 1) == 0 || IsTransparentRGB15_BIG(in);
}

View File

@ -328,7 +328,7 @@ identify_tga_header(BPositionIO *inSource, translator_info *outInfo,
imagespec.descriptor = buf[17];
// images ordered from Right to Left (rather than Left to Right)
// are not supported
if (imagespec.descriptor & TGA_ORIGIN_HORZ_BIT == TGA_ORIGIN_RIGHT)
if ((imagespec.descriptor & TGA_ORIGIN_HORZ_BIT) == TGA_ORIGIN_RIGHT)
return B_NO_TRANSLATOR;
// unused descriptor bits, these bits must be zero
if (imagespec.descriptor & TGA_DESC_BITS76)
@ -336,23 +336,23 @@ identify_tga_header(BPositionIO *inSource, translator_info *outInfo,
if ((fileheader.imagetype == TGA_NOCOMP_TRUECOLOR ||
fileheader.imagetype == TGA_RLE_TRUECOLOR) &&
imagespec.depth == 32 &&
imagespec.descriptor & TGA_DESC_ALPHABITS != 8 &&
imagespec.descriptor & TGA_DESC_ALPHABITS != 0)
(imagespec.descriptor & TGA_DESC_ALPHABITS) != 8 &&
(imagespec.descriptor & TGA_DESC_ALPHABITS) != 0)
return B_NO_TRANSLATOR;
if ((fileheader.imagetype == TGA_NOCOMP_TRUECOLOR ||
fileheader.imagetype == TGA_RLE_TRUECOLOR) &&
imagespec.depth == 24 &&
imagespec.descriptor & TGA_DESC_ALPHABITS != 0)
(imagespec.descriptor & TGA_DESC_ALPHABITS) != 0)
return B_NO_TRANSLATOR;
if ((fileheader.imagetype == TGA_NOCOMP_TRUECOLOR ||
fileheader.imagetype == TGA_RLE_TRUECOLOR) &&
imagespec.depth == 16 &&
imagespec.descriptor & TGA_DESC_ALPHABITS != 1 &&
imagespec.descriptor & TGA_DESC_ALPHABITS != 0)
(imagespec.descriptor & TGA_DESC_ALPHABITS) != 1 &&
(imagespec.descriptor & TGA_DESC_ALPHABITS) != 0)
if ((fileheader.imagetype == TGA_NOCOMP_TRUECOLOR ||
fileheader.imagetype == TGA_RLE_TRUECOLOR) &&
imagespec.depth == 15 &&
imagespec.descriptor & TGA_DESC_ALPHABITS != 0)
(imagespec.descriptor & TGA_DESC_ALPHABITS) != 0)
return B_NO_TRANSLATOR;
// Fill in headers passed to this function

View File

@ -335,7 +335,7 @@ CalcView::Draw(BRect updateRect)
FillRect(updateRect & keypadRect);
// render key main grid
BeginLineArray((fColums + fRows) << 1 + 1);
BeginLineArray(((fColums + fRows) << 1) + 1);
// render cols
AddLine(BPoint(0.0, sizeDisp),

View File

@ -172,10 +172,10 @@ ScreenBlanker::_QueueTurnOffScreen()
return;
if (fSettings.OffTime() == fSettings.SuspendTime()
&& (flags & (ENABLE_DPMS_OFF | ENABLE_DPMS_SUSPEND)) == ENABLE_DPMS_OFF | ENABLE_DPMS_SUSPEND)
&& (flags & (ENABLE_DPMS_OFF | ENABLE_DPMS_SUSPEND)) == (ENABLE_DPMS_OFF | ENABLE_DPMS_SUSPEND))
flags &= ~ENABLE_DPMS_SUSPEND;
if (fSettings.SuspendTime() == fSettings.StandByTime()
&& (flags & (ENABLE_DPMS_SUSPEND | ENABLE_DPMS_STAND_BY)) == ENABLE_DPMS_SUSPEND | ENABLE_DPMS_STAND_BY)
&& (flags & (ENABLE_DPMS_SUSPEND | ENABLE_DPMS_STAND_BY)) == (ENABLE_DPMS_SUSPEND | ENABLE_DPMS_STAND_BY))
flags &= ~ENABLE_DPMS_STAND_BY;
// start them off again

View File

@ -31,7 +31,7 @@
static combine_mode
get_combine_mode(display_mode& mode)
{
if (mode.flags & B_SCROLL == 0)
if ((mode.flags & B_SCROLL) == 0)
return kCombineDisable;
if (mode.virtual_width == mode.timing.h_display * 2)

View File

@ -282,7 +282,7 @@ Directory::GetNextEntry(void *cookie, uint8 mask, uint8 match)
continue;
if (c->entry.Flags() == 0x0f) // LFN entry
continue;
if (c->entry.Flags() & (FAT_VOLUME|FAT_SUBDIR) == FAT_VOLUME) {
if ((c->entry.Flags() & (FAT_VOLUME|FAT_SUBDIR)) == FAT_VOLUME) {
// TODO handle Volume name (set fVolume's name)
continue;
}

View File

@ -253,7 +253,7 @@ Volume::IsValidCluster(uint32 cluster) const
bool
Volume::IsLastCluster(uint32 cluster) const
{
if (cluster >= fTotalClusters && (cluster & 0xff8 == 0xff8))
if (cluster >= fTotalClusters && ((cluster & 0xff8) == 0xff8))
return true;
return false;
}