From: eihrul Date: Tue, 9 Dec 2014 13:30:53 +0000 (+0000) Subject: miscellaneous fixes from graphitemaster X-Git-Tag: xonotic-v0.8.0~27 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=e57627ff250e40f1858767f25c60ef65b3397587;p=xonotic%2Fdarkplaces.git miscellaneous fixes from graphitemaster git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12106 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::merge=bd8b9a2b1e5464f18a7a2e6e573201d6aa9dbcca --- diff --git a/cl_parse.c b/cl_parse.c index e8e17f1c..460ef270 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -227,7 +227,7 @@ static void CL_ParseStartSoundPacket(int largesoundindex) attenuation = MSG_ReadByte(&cl_message) / 64.0; else attenuation = DEFAULT_SOUND_PACKET_ATTENUATION; - + speed = 1.0f; ent = (channel>>3)&1023; @@ -1039,7 +1039,7 @@ static void QW_CL_ParseNails(void) { for (j = 0;j < 6;j++) bits[j] = MSG_ReadByte(&cl_message); - if (cl.qw_num_nails > 255) + if (cl.qw_num_nails >= 255) continue; v = cl.qw_nails[cl.qw_num_nails++]; v[0] = ( ( bits[0] + ((bits[1]&15)<<8) ) <<1) - 4096; diff --git a/clvm_cmds.c b/clvm_cmds.c index c9cecff3..1d3696ac 100644 --- a/clvm_cmds.c +++ b/clvm_cmds.c @@ -3560,7 +3560,7 @@ void Debug_PolygonVertex(float x, float y, float z, float s, float t, float r, f return; } - if(debugPolys.begin_vertices > VMPOLYGONS_MAXPOINTS) + if(debugPolys.begin_vertices >= VMPOLYGONS_MAXPOINTS) { Con_Printf("Debug_PolygonVertex: may have %i vertices max\n", VMPOLYGONS_MAXPOINTS); return; diff --git a/meshqueue.c b/meshqueue.c index 2ba5c518..edd85c22 100644 --- a/meshqueue.c +++ b/meshqueue.c @@ -87,14 +87,14 @@ void R_MeshQueue_RenderTransparent(void) trans_sortarraysize = r_transparent_sortarraysize.integer; if (trans_hash) Mem_Free(trans_hash); - trans_hash = (meshqueue_t **)Mem_Alloc(cls.permanentmempool, sizeof(trans_hash) * trans_sortarraysize); + trans_hash = (meshqueue_t **)Mem_Alloc(cls.permanentmempool, sizeof(meshqueue_t *) * trans_sortarraysize); if (trans_hashpointer) Mem_Free(trans_hashpointer); - trans_hashpointer = (meshqueue_t ***)Mem_Alloc(cls.permanentmempool, sizeof(trans_hashpointer) * trans_sortarraysize); + trans_hashpointer = (meshqueue_t ***)Mem_Alloc(cls.permanentmempool, sizeof(meshqueue_t **) * trans_sortarraysize); } // build index - memset(trans_hash, 0, sizeof(trans_hash) * trans_sortarraysize); + memset(trans_hash, 0, sizeof(meshqueue_t *) * trans_sortarraysize); for (i = 0; i < trans_sortarraysize; i++) trans_hashpointer[i] = &trans_hash[i]; distscale = (trans_sortarraysize - 1) / min(mqt_viewmaxdist, r_transparent_sortmaxdist.integer); diff --git a/model_brush.c b/model_brush.c index 6f2651f6..8605cbb0 100644 --- a/model_brush.c +++ b/model_brush.c @@ -2129,7 +2129,7 @@ static void Mod_Q1BSP_ParseWadsFromEntityLump(const char *data) for (i = 0;i < (int)sizeof(value);i++) if (value[i] != ';' && value[i] != '\\' && value[i] != '/' && value[i] != ':') break; - if (value[i]) + if (i < (int)sizeof(value) && value[i]) { for (;i < (int)sizeof(value);i++) { diff --git a/mvm_cmds.c b/mvm_cmds.c index 1b915c1f..d44d22c3 100644 --- a/mvm_cmds.c +++ b/mvm_cmds.c @@ -318,9 +318,9 @@ static void VM_M_setserverlistmaskstring(prvm_prog_t *prog) str = PRVM_G_STRING( OFS_PARM2 ); masknr = (int)PRVM_G_FLOAT( OFS_PARM0 ); - if( masknr >= 0 && masknr <= SERVERLIST_ANDMASKCOUNT ) + if( masknr >= 0 && masknr < SERVERLIST_ANDMASKCOUNT ) mask = &serverlist_andmasks[masknr]; - else if( masknr >= 512 && masknr - 512 <= SERVERLIST_ORMASKCOUNT ) + else if( masknr >= 512 && masknr - 512 < SERVERLIST_ORMASKCOUNT ) mask = &serverlist_ormasks[masknr - 512 ]; else { @@ -380,9 +380,9 @@ static void VM_M_setserverlistmasknumber(prvm_prog_t *prog) VM_SAFEPARMCOUNT( 4, VM_M_setserverlistmasknumber ); masknr = (int)PRVM_G_FLOAT( OFS_PARM0 ); - if( masknr >= 0 && masknr <= SERVERLIST_ANDMASKCOUNT ) + if( masknr >= 0 && masknr < SERVERLIST_ANDMASKCOUNT ) mask = &serverlist_andmasks[masknr]; - else if( masknr >= 512 && masknr - 512 <= SERVERLIST_ORMASKCOUNT ) + else if( masknr >= 512 && masknr - 512 < SERVERLIST_ORMASKCOUNT ) mask = &serverlist_ormasks[masknr - 512 ]; else { diff --git a/r_shadow.c b/r_shadow.c index 8b0106dd..c0ecf320 100644 --- a/r_shadow.c +++ b/r_shadow.c @@ -3530,7 +3530,7 @@ void R_RTLight_Compile(rtlight_t *rtlight) lighttris++; shadowtris = 0; - if (rtlight->static_numlighttrispvsbytes) + if (rtlight->static_numshadowtrispvsbytes) for (i = 0;i < rtlight->static_numshadowtrispvsbytes*8;i++) if (CHECKPVSBIT(rtlight->static_shadowtrispvs, i)) shadowtris++;