From 82f83cd092645bb7140d673fd830b5315f1d751f Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Sun, 18 Nov 2012 19:09:54 +0000 Subject: [PATCH] Fix some "> MAX_*" to be ">= MAX_*". --- code/botlib/be_ai_move.c | 2 +- code/client/snd_dma.c | 4 ++-- code/client/snd_openal.c | 4 ++-- code/game/ai_dmq3.c | 4 ++-- code/qcommon/files.c | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/code/botlib/be_ai_move.c b/code/botlib/be_ai_move.c index c808dbc6..a9e64d5d 100644 --- a/code/botlib/be_ai_move.c +++ b/code/botlib/be_ai_move.c @@ -522,7 +522,7 @@ void BotSetBrushModelTypes(void) if (model[0]) modelnum = atoi(model+1); else modelnum = 0; - if (modelnum < 0 || modelnum > MAX_MODELS) + if (modelnum < 0 || modelnum >= MAX_MODELS) { botimport.Print(PRT_MESSAGE, "entity %s model number out of range\n", classname); continue; diff --git a/code/client/snd_dma.c b/code/client/snd_dma.c index 83da804f..24024121 100644 --- a/code/client/snd_dma.c +++ b/code/client/snd_dma.c @@ -529,7 +529,7 @@ static void S_Base_StartSoundEx( vec3_t origin, int entityNum, int entchannel, s return; } - if ( !origin && ( entityNum < 0 || entityNum > MAX_GENTITIES ) ) { + if ( !origin && ( entityNum < 0 || entityNum >= MAX_GENTITIES ) ) { Com_Error( ERR_DROP, "S_StartSound: bad entitynum %i", entityNum ); } @@ -1092,7 +1092,7 @@ let the sound system know where an entity currently is ====================== */ void S_Base_UpdateEntityPosition( int entityNum, const vec3_t origin ) { - if ( entityNum < 0 || entityNum > MAX_GENTITIES ) { + if ( entityNum < 0 || entityNum >= MAX_GENTITIES ) { Com_Error( ERR_DROP, "S_UpdateEntityPosition: bad entitynum %i", entityNum ); } VectorCopy( origin, loopSounds[entityNum].origin ); diff --git a/code/client/snd_openal.c b/code/client/snd_openal.c index 4b25d69f..d2ce0e8a 100644 --- a/code/client/snd_openal.c +++ b/code/client/snd_openal.c @@ -1121,7 +1121,7 @@ void S_AL_UpdateEntityPosition( int entityNum, const vec3_t origin ) VectorCopy( origin, sanOrigin ); S_AL_SanitiseVector( sanOrigin ); - if ( entityNum < 0 || entityNum > MAX_GENTITIES ) + if ( entityNum < 0 || entityNum >= MAX_GENTITIES ) Com_Error( ERR_DROP, "S_UpdateEntityPosition: bad entitynum %i", entityNum ); VectorCopy( sanOrigin, entityList[entityNum].origin ); } @@ -1135,7 +1135,7 @@ Necessary for i.g. Western Quake3 mod which is buggy. */ static qboolean S_AL_CheckInput(int entityNum, sfxHandle_t sfx) { - if (entityNum < 0 || entityNum > MAX_GENTITIES) + if (entityNum < 0 || entityNum >= MAX_GENTITIES) Com_Error(ERR_DROP, "ERROR: S_AL_CheckInput: bad entitynum %i", entityNum); if (sfx < 0 || sfx >= numSfx) diff --git a/code/game/ai_dmq3.c b/code/game/ai_dmq3.c index 6f742534..fe224827 100644 --- a/code/game/ai_dmq3.c +++ b/code/game/ai_dmq3.c @@ -4838,7 +4838,7 @@ void BotCheckEvents(bot_state_t *bs, entityState_t *state) { } case EV_GLOBAL_SOUND: { - if (state->eventParm < 0 || state->eventParm > MAX_SOUNDS) { + if (state->eventParm < 0 || state->eventParm >= MAX_SOUNDS) { BotAI_Print(PRT_ERROR, "EV_GLOBAL_SOUND: eventParm (%d) out of range\n", state->eventParm); break; } @@ -4948,7 +4948,7 @@ void BotCheckEvents(bot_state_t *bs, entityState_t *state) { { //if this sound is played on the bot if (state->number == bs->client) { - if (state->eventParm < 0 || state->eventParm > MAX_SOUNDS) { + if (state->eventParm < 0 || state->eventParm >= MAX_SOUNDS) { BotAI_Print(PRT_ERROR, "EV_GENERAL_SOUND: eventParm (%d) out of range\n", state->eventParm); break; } diff --git a/code/qcommon/files.c b/code/qcommon/files.c index b8cf76d8..5dffc06f 100644 --- a/code/qcommon/files.c +++ b/code/qcommon/files.c @@ -395,7 +395,7 @@ static fileHandle_t FS_HandleForFile(void) { } static FILE *FS_FileForHandle( fileHandle_t f ) { - if ( f < 1 || f > MAX_FILE_HANDLES ) { + if ( f < 1 || f >= MAX_FILE_HANDLES ) { Com_Error( ERR_DROP, "FS_FileForHandle: out of range" ); } if (fsh[f].zipFile == qtrue) {