Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Some signed-unsigned comparisons fixed

  • Loading branch information...
commit 5b76c99767a332ed6a9707f75f1b713e19b414b3 1 parent 44bf0c6
Miguel Boton authored
View
2  neo/d3xp/AF.cpp
@@ -892,7 +892,7 @@ bool idAF::Load( idEntity *ent, const char *fileName ) {
idAFConstraint *constraint = physicsObj.GetConstraint( i );
for ( j = 0; j < file->constraints.Num(); j++ ) {
if ( file->constraints[j]->name.Icmp( constraint->GetName() ) == 0 &&
- file->constraints[j]->type == constraint->GetType() ) {
+ (int)file->constraints[j]->type == (int)constraint->GetType() ) {
break;
}
}
View
2  neo/d3xp/gamesys/TypeInfo.cpp
@@ -188,7 +188,7 @@ const char *idTypeInfoTools::OutputString( const char *string ) {
static int index = 0;
static char buffers[4][16384];
char *out;
- int i, c;
+ unsigned int i, c;
out = buffers[index];
index = ( index + 1 ) & 3;
View
4 neo/d3xp/script/Script_Program.cpp
@@ -918,7 +918,7 @@ idScriptObject::Restore
*/
void idScriptObject::Restore( idRestoreGame *savefile ) {
idStr typeName;
- size_t size;
+ int size;
savefile->ReadString( typeName );
@@ -1319,7 +1319,7 @@ idVarDef *idProgram::AllocDef( idTypeDef *type, const char *name, idVarDef *scop
//
def->value.bytePtr = &variables[ numVariables ];
numVariables += def->TypeDef()->Size();
- if ( numVariables > sizeof( variables ) ) {
+ if ( (unsigned int)numVariables > sizeof( variables ) ) {
throw idCompileError( va( "Exceeded global memory size (%zu bytes)", sizeof( variables ) ) );
}
View
6 neo/framework/DeclManager.cpp
@@ -360,7 +360,7 @@ BuildHuffmanCode_r
void BuildHuffmanCode_r( huffmanNode_t *node, huffmanCode_t code, huffmanCode_t codes[MAX_HUFFMAN_SYMBOLS] ) {
if ( node->symbol == -1 ) {
huffmanCode_t newCode = code;
- assert( code.numBits < sizeof( codes[0].bits ) * 8 );
+ assert( (size_t)code.numBits < sizeof( codes[0].bits ) * 8 );
newCode.numBits++;
if ( code.numBits > maxHuffmanBits ) {
maxHuffmanBits = newCode.numBits;
@@ -369,7 +369,7 @@ void BuildHuffmanCode_r( huffmanNode_t *node, huffmanCode_t code, huffmanCode_t
newCode.bits[code.numBits >> 5] |= 1 << ( code.numBits & 31 );
BuildHuffmanCode_r( node->children[1], newCode, codes );
} else {
- assert( code.numBits <= sizeof( codes[0].bits ) * 8 );
+ assert( (size_t)code.numBits <= sizeof( codes[0].bits ) * 8 );
codes[node->symbol] = code;
}
}
@@ -1975,7 +1975,7 @@ bool idDeclLocal::ReplaceSourceFileText( void ) {
file->Read( buffer, oldFileLength );
fileSystem->CloseFile( file );
- if ( MD5_BlockChecksum( buffer, oldFileLength ) != sourceFile->checksum ) {
+ if ( MD5_BlockChecksum( buffer, oldFileLength ) != (unsigned int)sourceFile->checksum ) {
Mem_Free( buffer );
common->Warning( "The file %s has been modified outside of the engine.", GetFileName() );
return false;
View
2  neo/framework/KeyInput.cpp
@@ -234,7 +234,7 @@ idKeyInput::ArgCompletion_KeyName
*/
void idKeyInput::ArgCompletion_KeyName( const idCmdArgs &args, void(*callback)( const char *s ) ) {
keyname_t *kn;
- int i;
+ unsigned int i;
for( i = 0; i < sizeof( unnamedkeys ) - 1; i++ ) {
callback( va( "%s %c", args.Argv( 0 ), unnamedkeys[ i ] ) );
View
2  neo/framework/async/MsgChannel.cpp
@@ -623,7 +623,7 @@ bool idMsgChannel::Process( const netadr_t from, int time, idBitMsg &msg, int &s
}
// copy the fragment to the fragment buffer
- if ( fragLength < 0 || fragLength > msg.GetRemaingData() || fragmentLength + fragLength > sizeof( fragmentBuffer ) ) {
+ if ( fragLength < 0 || fragLength > msg.GetRemaingData() || (unsigned int)(fragmentLength + fragLength) > sizeof( fragmentBuffer ) ) {
if ( net_channelShowDrop.GetBool() || net_channelShowPackets.GetBool() ) {
common->Printf( "%s: illegal fragment length\n", Sys_NetAdrToString( remoteAddress ) );
}
View
2  neo/game/AF.cpp
@@ -892,7 +892,7 @@ bool idAF::Load( idEntity *ent, const char *fileName ) {
idAFConstraint *constraint = physicsObj.GetConstraint( i );
for ( j = 0; j < file->constraints.Num(); j++ ) {
if ( file->constraints[j]->name.Icmp( constraint->GetName() ) == 0 &&
- file->constraints[j]->type == constraint->GetType() ) {
+ (int)file->constraints[j]->type == (int)constraint->GetType() ) {
break;
}
}
View
2  neo/game/gamesys/TypeInfo.cpp
@@ -188,7 +188,7 @@ const char *idTypeInfoTools::OutputString( const char *string ) {
static int index = 0;
static char buffers[4][16384];
char *out;
- int i, c;
+ unsigned int i, c;
out = buffers[index];
index = ( index + 1 ) & 3;
View
4 neo/game/script/Script_Program.cpp
@@ -918,7 +918,7 @@ idScriptObject::Restore
*/
void idScriptObject::Restore( idRestoreGame *savefile ) {
idStr typeName;
- size_t size;
+ int size;
savefile->ReadString( typeName );
@@ -1319,7 +1319,7 @@ idVarDef *idProgram::AllocDef( idTypeDef *type, const char *name, idVarDef *scop
//
def->value.bytePtr = &variables[ numVariables ];
numVariables += def->TypeDef()->Size();
- if ( numVariables > sizeof( variables ) ) {
+ if ( (unsigned int)numVariables > sizeof( variables ) ) {
throw idCompileError( va( "Exceeded global memory size (%zu bytes)", sizeof( variables ) ) );
}
View
4 neo/idlib/BitMsg.cpp
@@ -803,7 +803,7 @@ void idBitMsgDelta::WriteData( const void *data, int length ) {
changed = true;
} else {
byte baseData[MAX_DATA_BUFFER];
- assert( length < sizeof( baseData ) );
+ assert( (unsigned int)length < sizeof( baseData ) );
base->ReadData( baseData, length );
if ( memcmp( data, baseData, length ) == 0 ) {
writeDelta->WriteBits( 0, 1 );
@@ -946,7 +946,7 @@ void idBitMsgDelta::ReadData( void *data, int length ) const {
changed = true;
} else {
char baseData[MAX_DATA_BUFFER];
- assert( length < sizeof( baseData ) );
+ assert( (unsigned int)length < sizeof( baseData ) );
base->ReadData( baseData, length );
if ( !readDelta || readDelta->ReadBits( 1 ) == 0 ) {
memcpy( data, baseData, length );
View
2  neo/idlib/CmdArgs.cpp
@@ -155,7 +155,7 @@ void idCmdArgs::TokenizeString( const char *text, bool keepAsStrings ) {
len = token.Length();
- if ( totalLen + len + 1 > sizeof( tokenized ) ) {
+ if ( (unsigned int)(totalLen + len + 1) > sizeof( tokenized ) ) {
return; // this is usually something malicious
}
View
4 neo/idlib/Heap.cpp
@@ -334,10 +334,10 @@ void *idHeap::Allocate16( const dword bytes ) {
}
}
alignedPtr = (byte *) ( ( (size_t) ptr ) + 15 & ~15 );
- if ( alignedPtr - ptr < sizeof(size_t) ) {
+ if ( (size_t)(alignedPtr - ptr) < sizeof(size_t) ) {
alignedPtr += 16;
}
- *((long *)(alignedPtr - sizeof(size_t))) = (size_t) ptr;
+ *((size_t *)(alignedPtr - sizeof(size_t))) = (size_t) ptr;
return (void *) alignedPtr;
}
View
2  neo/idlib/Str.cpp
@@ -1470,7 +1470,7 @@ int idStr::snPrintf( char *dest, int size, const char *fmt, ...) {
va_start( argptr, fmt );
len = vsprintf( buffer, fmt, argptr );
va_end( argptr );
- if ( len >= sizeof( buffer ) ) {
+ if ( (unsigned int)len >= sizeof( buffer ) ) {
idLib::common->Error( "idStr::snPrintf: overflowed buffer" );
}
if ( len >= size ) {
View
4 neo/idlib/geometry/Surface_SweptSpline.cpp
@@ -159,7 +159,7 @@ void idSurface_SweptSpline::Tessellate( const int splineSubdivisions, const int
// calculate the points and first derivatives for the swept spline
totalTime = sweptSpline->GetTime( sweptSpline->GetNumValues() - 1 ) - sweptSpline->GetTime( 0 ) + sweptSpline->GetCloseTime();
- sweptSplineDiv = sweptSpline->GetBoundaryType() == idCurve_Spline<idVec3>::BT_CLOSED ? sweptSplineSubdivisions : sweptSplineSubdivisions - 1;
+ sweptSplineDiv = (int)sweptSpline->GetBoundaryType() == (int)idCurve_Spline<idVec3>::BT_CLOSED ? sweptSplineSubdivisions : sweptSplineSubdivisions - 1;
baseOffset = (splineSubdivisions-1) * sweptSplineSubdivisions;
for ( i = 0; i < sweptSplineSubdivisions; i++ ) {
t = totalTime * i / sweptSplineDiv;
@@ -172,7 +172,7 @@ void idSurface_SweptSpline::Tessellate( const int splineSubdivisions, const int
// sweep the spline
totalTime = spline->GetTime( spline->GetNumValues() - 1 ) - spline->GetTime( 0 ) + spline->GetCloseTime();
- splineDiv = spline->GetBoundaryType() == idCurve_Spline<idVec3>::BT_CLOSED ? splineSubdivisions : splineSubdivisions - 1;
+ splineDiv = (int)spline->GetBoundaryType() == (int)idCurve_Spline<idVec3>::BT_CLOSED ? splineSubdivisions : splineSubdivisions - 1;
splineMat.Identity();
for ( i = 0; i < splineSubdivisions; i++ ) {
t = totalTime * i / splineDiv;
View
2  neo/renderer/Image.h
@@ -213,7 +213,7 @@ class idImage {
// data commonly accessed is grouped here
static const int TEXTURE_NOT_LOADED = -1;
- GLuint texnum; // gl texture binding, will be TEXTURE_NOT_LOADED if not loaded
+ GLint texnum; // gl texture binding, will be TEXTURE_NOT_LOADED if not loaded
textureType_t type;
int frameUsed; // for texture usage in frame statistics
int bindCount; // incremented each bind
View
2  neo/renderer/Image_files.cpp
@@ -247,7 +247,7 @@ static void LoadBMP( const char *name, byte **pic, int *width, int *height, ID_T
int row, column;
byte *buf_p;
byte *buffer;
- int length;
+ unsigned int length;
BMPHeader_t bmpHeader;
byte *bmpRGBA;
View
2  neo/renderer/Image_init.cpp
@@ -1800,7 +1800,7 @@ void idImage::StartBackgroundImageLoad() {
}
bgl.file.position = 0;
bgl.file.length = bgl.f->Length();
- if ( bgl.file.length < sizeof( ddsFileHeader_t ) ) {
+ if ( (unsigned int)bgl.file.length < sizeof( ddsFileHeader_t ) ) {
common->Warning( "idImageManager::StartBackgroundImageLoad: %s had a bad file length", imgName.c_str() );
return;
}
View
2  neo/renderer/Image_load.cpp
@@ -1384,7 +1384,7 @@ bool idImage::CheckPrecompressedImage( bool fullLoad ) {
}
int len = f->Length();
- if ( len < sizeof( ddsFileHeader_t ) ) {
+ if ( (unsigned int)len < sizeof( ddsFileHeader_t ) ) {
fileSystem->CloseFile( f );
return false;
}
View
2  neo/sound/snd_decoder.cpp
@@ -490,7 +490,7 @@ int idSampleDecoderLocal::DecodePCM( idSoundSample *sample, int sampleOffset44k,
return 0;
}
- if ( size - pos < sampleCount * sizeof( short ) ) {
+ if ( (unsigned int)(size - pos) < sampleCount * sizeof( short ) ) {
readSamples = ( size - pos ) / sizeof( short );
} else {
readSamples = sampleCount;
Please sign in to comment.
Something went wrong with that request. Please try again.