mirror of
https://github.com/dhewm/dhewm3.git
synced 2024-11-23 12:53:09 +00:00
Fix -Wparentheses warnings
suggest explicit braces to avoid ambiguous ‘else’ suggest parentheses around ‘&&’ within ‘||’ suggest parentheses around ‘-’ in operand of ‘&’ suggest parentheses around arithmetic in operand of ‘|’ equality comparison with extraneous parentheses Functional change: Proper HELLTIME check in Playerview due to missing parentheses.
This commit is contained in:
parent
926b41f4a5
commit
9ab9bdea8b
11 changed files with 21 additions and 17 deletions
|
@ -695,7 +695,7 @@ ID_INLINE bool idEntityPtr<type>::IsValid( void ) const {
|
|||
template< class type >
|
||||
ID_INLINE type *idEntityPtr<type>::GetEntity( void ) const {
|
||||
int entityNum = spawnId & ( ( 1 << GENTITYNUM_BITS ) - 1 );
|
||||
if ( ( gameLocal.spawnIds[ entityNum ] == ( spawnId >> GENTITYNUM_BITS ) ) ) {
|
||||
if ( gameLocal.spawnIds[ entityNum ] == ( spawnId >> GENTITYNUM_BITS ) ) {
|
||||
return static_cast<type *>( gameLocal.entities[ entityNum ] );
|
||||
}
|
||||
return NULL;
|
||||
|
|
|
@ -1377,7 +1377,7 @@ void FullscreenFX_DoubleVision::HighQuality() {
|
|||
color.z = 0;
|
||||
}
|
||||
|
||||
if ( !gameLocal.isMultiplayer && gameLocal.fast.time < player->inventory.powerupEndTime[ HELLTIME ] || gameLocal.fast.time < player->inventory.powerupEndTime[ INVULNERABILITY ]) {
|
||||
if ( !gameLocal.isMultiplayer && (gameLocal.fast.time < player->inventory.powerupEndTime[ HELLTIME ] || gameLocal.fast.time < player->inventory.powerupEndTime[ INVULNERABILITY ])) {
|
||||
color.y = 0;
|
||||
color.z = 0;
|
||||
}
|
||||
|
|
|
@ -876,7 +876,7 @@ void idAI::Event_CanBecomeSolid( void ) {
|
|||
}
|
||||
|
||||
#ifdef _D3XP
|
||||
if ( spawnClearMoveables && hit->IsType( idMoveable::Type ) || hit->IsType( idBarrel::Type ) || hit->IsType( idExplodingBarrel::Type ) ) {
|
||||
if ( (spawnClearMoveables && hit->IsType( idMoveable::Type )) || (hit->IsType( idBarrel::Type ) || hit->IsType( idExplodingBarrel::Type) ) ) {
|
||||
idVec3 push;
|
||||
push = hit->GetPhysics()->GetOrigin() - GetPhysics()->GetOrigin();
|
||||
push.z = 30.f;
|
||||
|
|
|
@ -1479,11 +1479,12 @@ static int unzlocal_GetCurrentFileInfoInternal (unzFile file,
|
|||
|
||||
|
||||
/* we check the magic */
|
||||
if (err==UNZ_OK)
|
||||
if (err==UNZ_OK) {
|
||||
if (unzlocal_getLong(s->file,&uMagic) != UNZ_OK)
|
||||
err=UNZ_ERRNO;
|
||||
else if (uMagic!=0x02014b50)
|
||||
err=UNZ_BADZIPFILE;
|
||||
}
|
||||
|
||||
if (unzlocal_getShort(s->file,&file_info.version) != UNZ_OK)
|
||||
err=UNZ_ERRNO;
|
||||
|
@ -1559,11 +1560,12 @@ static int unzlocal_GetCurrentFileInfoInternal (unzFile file,
|
|||
else
|
||||
uSizeRead = extraFieldBufferSize;
|
||||
|
||||
if (lSeek!=0)
|
||||
if (lSeek!=0) {
|
||||
if (fseek(s->file,lSeek,SEEK_CUR)==0)
|
||||
lSeek=0;
|
||||
else
|
||||
err=UNZ_ERRNO;
|
||||
}
|
||||
if ((file_info.size_file_extra>0) && (extraFieldBufferSize>0))
|
||||
if (fread(extraField,(uInt)uSizeRead,1,s->file)!=1)
|
||||
err=UNZ_ERRNO;
|
||||
|
@ -1584,11 +1586,12 @@ static int unzlocal_GetCurrentFileInfoInternal (unzFile file,
|
|||
else
|
||||
uSizeRead = commentBufferSize;
|
||||
|
||||
if (lSeek!=0)
|
||||
if (lSeek!=0) {
|
||||
if (fseek(s->file,lSeek,SEEK_CUR)==0)
|
||||
lSeek=0;
|
||||
else
|
||||
err=UNZ_ERRNO;
|
||||
}
|
||||
if ((file_info.size_file_comment>0) && (commentBufferSize>0))
|
||||
if (fread(szComment,(uInt)uSizeRead,1,s->file)!=1)
|
||||
err=UNZ_ERRNO;
|
||||
|
@ -1783,11 +1786,12 @@ static int unzlocal_CheckCurrentFileCoherencyHeader (unz_s* s, uInt* piSizeVar,
|
|||
return UNZ_ERRNO;
|
||||
|
||||
|
||||
if (err==UNZ_OK)
|
||||
if (err==UNZ_OK) {
|
||||
if (unzlocal_getLong(s->file,&uMagic) != UNZ_OK)
|
||||
err=UNZ_ERRNO;
|
||||
else if (uMagic!=0x04034b50)
|
||||
err=UNZ_BADZIPFILE;
|
||||
}
|
||||
|
||||
if (unzlocal_getShort(s->file,&uData) != UNZ_OK)
|
||||
err=UNZ_ERRNO;
|
||||
|
@ -1966,7 +1970,7 @@ extern int unzReadCurrentFile (unzFile file, void *buf, unsigned len)
|
|||
return UNZ_PARAMERROR;
|
||||
|
||||
|
||||
if ((pfile_in_zip_read_info->read_buffer == NULL))
|
||||
if (pfile_in_zip_read_info->read_buffer == NULL)
|
||||
return UNZ_END_OF_LIST_OF_FILE;
|
||||
if (len==0)
|
||||
return 0;
|
||||
|
|
|
@ -628,7 +628,7 @@ ID_INLINE bool idEntityPtr<type>::IsValid( void ) const {
|
|||
template< class type >
|
||||
ID_INLINE type *idEntityPtr<type>::GetEntity( void ) const {
|
||||
int entityNum = spawnId & ( ( 1 << GENTITYNUM_BITS ) - 1 );
|
||||
if ( ( gameLocal.spawnIds[ entityNum ] == ( spawnId >> GENTITYNUM_BITS ) ) ) {
|
||||
if ( gameLocal.spawnIds[ entityNum ] == ( spawnId >> GENTITYNUM_BITS ) ) {
|
||||
return static_cast<type *>( gameLocal.entities[ entityNum ] );
|
||||
}
|
||||
return NULL;
|
||||
|
|
|
@ -515,7 +515,7 @@ int idBitMsg::ReadDeltaByteCounter( int oldValue ) const {
|
|||
return oldValue;
|
||||
}
|
||||
newValue = ReadBits( i );
|
||||
return ( oldValue & ~( ( 1 << i ) - 1 ) | newValue );
|
||||
return ( (oldValue & ~( ( 1 << i ) - 1 ) ) | newValue );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -531,7 +531,7 @@ int idBitMsg::ReadDeltaShortCounter( int oldValue ) const {
|
|||
return oldValue;
|
||||
}
|
||||
newValue = ReadBits( i );
|
||||
return ( oldValue & ~( ( 1 << i ) - 1 ) | newValue );
|
||||
return ( (oldValue & ~( ( 1 << i ) - 1 ) ) | newValue );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -547,7 +547,7 @@ int idBitMsg::ReadDeltaLongCounter( int oldValue ) const {
|
|||
return oldValue;
|
||||
}
|
||||
newValue = ReadBits( i );
|
||||
return ( oldValue & ~( ( 1 << i ) - 1 ) | newValue );
|
||||
return ( ( oldValue & ~( ( 1 << i ) - 1 ) ) | newValue );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -333,7 +333,7 @@ void *idHeap::Allocate16( const dword bytes ) {
|
|||
common->FatalError( "malloc failure for %i", bytes );
|
||||
}
|
||||
}
|
||||
alignedPtr = (byte *) ( ( (int) ptr ) + 15 & ~15 );
|
||||
alignedPtr = (byte *) ( ( ( (int) ptr ) + 15) & ~15 );
|
||||
if ( alignedPtr - ptr < 4 ) {
|
||||
alignedPtr += 16;
|
||||
}
|
||||
|
|
|
@ -615,7 +615,7 @@ void idImage::GenerateImage( const byte *pic, int width, int height,
|
|||
R_SetBorderTexels( (byte *)scaledBuffer, width, height, rgba );
|
||||
}
|
||||
|
||||
if ( generatorFunction == NULL && ( depth == TD_BUMP && globalImages->image_writeNormalTGA.GetBool() || depth != TD_BUMP && globalImages->image_writeTGA.GetBool() ) ) {
|
||||
if ( generatorFunction == NULL && ( (depth == TD_BUMP && globalImages->image_writeNormalTGA.GetBool()) || (depth != TD_BUMP && globalImages->image_writeTGA.GetBool()) ) ) {
|
||||
// Optionally write out the texture to a .tga
|
||||
char filename[MAX_IMAGE_NAME];
|
||||
ImageProgramStringToCompressedFileName( imgName, filename );
|
||||
|
|
|
@ -271,7 +271,7 @@ void R_SetAlphaNormalDivergence( byte *in, int width, int height ) {
|
|||
if ( yy == 0 && xx == 0 ) {
|
||||
continue;
|
||||
}
|
||||
byte *corner_p = in + ( ((y+yy)&(height-1)) * width + ((x+xx)&width-1) ) * 4;
|
||||
byte *corner_p = in + ( ((y+yy)&(height-1)) * width + ((x+xx)&(width-1)) ) * 4;
|
||||
idVec3 corner;
|
||||
corner[0] = ( corner_p[0] - 128 ) / 127;
|
||||
corner[1] = ( corner_p[1] - 128 ) / 127;
|
||||
|
|
|
@ -1703,7 +1703,7 @@ static int add_clip( char *s, lwClip **clist, int *nclips )
|
|||
clip->saturation.val = 1.0f;
|
||||
clip->gamma.val = 1.0f;
|
||||
|
||||
if ( p = strstr( s, "(sequence)" )) {
|
||||
if ( (p = strstr( s, "(sequence)" ))) {
|
||||
p[ -1 ] = 0;
|
||||
clip->type = ID_ISEQ;
|
||||
clip->source.seq.prefix = s;
|
||||
|
|
|
@ -137,7 +137,7 @@ void GL_SelectTexture( int unit ) {
|
|||
return;
|
||||
}
|
||||
|
||||
if ( unit < 0 || unit >= glConfig.maxTextureUnits && unit >= glConfig.maxTextureImageUnits ) {
|
||||
if ( unit < 0 || (unit >= glConfig.maxTextureUnits && unit >= glConfig.maxTextureImageUnits) ) {
|
||||
common->Warning( "GL_SelectTexture: unit = %i", unit );
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue