mirror of
https://github.com/dhewm/dhewm3.git
synced 2025-04-20 09:33:37 +00:00
Get rid of some compiler warnings
.. by adding some casts, initializing some variables and using #pragma GCC diagnostic ignored at some places in List.h and Str.h that used to generate superfluous warnings all over the code
This commit is contained in:
parent
1b1787bb50
commit
7843c087cf
4 changed files with 25 additions and 3 deletions
|
@ -467,7 +467,7 @@ static int unzlocal_GetCurrentFileInfoInternal (unzFile file,
|
|||
{
|
||||
unz_s* s;
|
||||
unz_file_info file_info;
|
||||
unz_file_info_internal file_info_internal;
|
||||
unz_file_info_internal file_info_internal = {0};
|
||||
int err=UNZ_OK;
|
||||
uLong uMagic;
|
||||
long lSeek=0;
|
||||
|
@ -774,7 +774,7 @@ static int unzlocal_CheckCurrentFileCoherencyHeader (unz_s* s, uInt* piSizeVar,
|
|||
uInt *psize_local_extrafield)
|
||||
{
|
||||
uLong uMagic,uData,uFlags = 0;
|
||||
uLong size_filename;
|
||||
uLong size_filename = 0;
|
||||
uLong size_extra_field;
|
||||
int err=UNZ_OK;
|
||||
|
||||
|
|
|
@ -503,6 +503,10 @@ ID_INLINE idStr::operator const char *( void ) const {
|
|||
return c_str();
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
// shut up GCC's stupid "warning: assuming signed overflow does not occur when assuming that
|
||||
// (X - c) > X is always false [-Wstrict-overflow]"
|
||||
#pragma GCC diagnostic ignored "-Wstrict-overflow"
|
||||
ID_INLINE char idStr::operator[]( int index ) const {
|
||||
assert( ( index >= 0 ) && ( index <= len ) );
|
||||
return data[ index ];
|
||||
|
@ -512,6 +516,7 @@ ID_INLINE char &idStr::operator[]( int index ) {
|
|||
assert( ( index >= 0 ) && ( index <= len ) );
|
||||
return data[ index ];
|
||||
}
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
ID_INLINE void idStr::operator=( const idStr &text ) {
|
||||
int l;
|
||||
|
@ -912,12 +917,17 @@ ID_INLINE idStr idStr::Left( int len ) const {
|
|||
return Mid( 0, len );
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
// shut up GCC's stupid "warning: assuming signed overflow does not occur when assuming that
|
||||
// (X - c) > X is always false [-Wstrict-overflow]"
|
||||
#pragma GCC diagnostic ignored "-Wstrict-overflow"
|
||||
ID_INLINE idStr idStr::Right( int len ) const {
|
||||
if ( len >= Length() ) {
|
||||
return *this;
|
||||
}
|
||||
return Mid( Length() - len, len );
|
||||
}
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
ID_INLINE void idStr::Strip( const char c ) {
|
||||
StripLeading( c );
|
||||
|
|
|
@ -376,9 +376,15 @@ ID_INLINE void idList<type>::Resize( int newsize ) {
|
|||
|
||||
temp = list;
|
||||
size = newsize;
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
// shut up GCC's stupid "warning: assuming signed overflow does not occur when assuming that
|
||||
// (X - c) > X is always false [-Wstrict-overflow]"
|
||||
#pragma GCC diagnostic ignored "-Wstrict-overflow"
|
||||
if ( size < num ) {
|
||||
num = size;
|
||||
}
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
// copy the old list into our new one
|
||||
list = new type[ size ];
|
||||
|
@ -549,6 +555,10 @@ ID_INLINE idList<type> &idList<type>::operator=( const idList<type> &other ) {
|
|||
return *this;
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
// shut up GCC's stupid "warning: assuming signed overflow does not occur when assuming that
|
||||
// (X - c) > X is always false [-Wstrict-overflow]"
|
||||
#pragma GCC diagnostic ignored "-Wstrict-overflow"
|
||||
/*
|
||||
================
|
||||
idList<type>::operator[] const
|
||||
|
@ -580,6 +590,7 @@ ID_INLINE type &idList<type>::operator[]( int index ) {
|
|||
|
||||
return list[ index ];
|
||||
}
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
/*
|
||||
================
|
||||
|
|
|
@ -363,7 +363,8 @@ void idTextureLevel::UpdateTile( int localX, int localY, int globalX, int global
|
|||
|
||||
if ( idMegaTexture::r_showMegaTextureLabels.GetBool() ) {
|
||||
// put a color marker in it
|
||||
byte color[4] = { 255 * localX / TILE_PER_LEVEL, 255 * localY / TILE_PER_LEVEL, 0, 0 };
|
||||
// localX and localY are < TILE_PER_LEVEL => that fits perfectly into a byte.
|
||||
byte color[4] = { (byte)(255 * localX / TILE_PER_LEVEL), (byte)(255 * localY / TILE_PER_LEVEL), 0, 0 };
|
||||
for ( int x = 0 ; x < 8 ; x++ ) {
|
||||
for ( int y = 0 ; y < 8 ; y++ ) {
|
||||
*(int *)&data[ ( ( y + TILE_SIZE/2 - 4 ) * TILE_SIZE + x + TILE_SIZE/2 - 4 ) * 4 ] = *(int *)color;
|
||||
|
|
Loading…
Reference in a new issue