From cd89fce9aa406e6ea2a324261df1adcb62d1e2ba Mon Sep 17 00:00:00 2001 From: helixhorned Date: Thu, 19 Jan 2012 21:57:46 +0000 Subject: [PATCH] less trivial stuff - fix one bound-checking line - rewrite two lines in astub.c to potentially not overflow an int16 - make tiletovox[] an array of int16's git-svn-id: https://svn.eduke32.com/eduke32@2266 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/include/build.h | 2 +- polymer/eduke32/build/src/engine.c | 2 +- polymer/eduke32/source/astub.c | 4 ++-- polymer/eduke32/source/game.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/polymer/eduke32/build/include/build.h b/polymer/eduke32/build/include/build.h index 316b7c525..7ced7c17f 100644 --- a/polymer/eduke32/build/include/build.h +++ b/polymer/eduke32/build/include/build.h @@ -387,7 +387,7 @@ extern int32_t dommxoverlay, novoxmips; extern float debug1, debug2; -extern int32_t tiletovox[MAXTILES]; +extern int16_t tiletovox[MAXTILES]; extern int32_t usevoxels, voxscale[MAXVOXELS]; #ifdef USE_OPENGL diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index ce3812aac..ce2e0ad61 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -77,7 +77,7 @@ static void drawpixel_safe(void *s, char a) } //void loadvoxel(int32_t voxindex) { UNREFERENCED_PARAMATER(voxindex); } -int32_t tiletovox[MAXTILES]; +int16_t tiletovox[MAXTILES]; int32_t usevoxels = 1; //#define kloadvoxel loadvoxel diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index 17f4b5a6e..9755060ab 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -5723,8 +5723,8 @@ static void Keys3d(void) while (!tilesizx[AIMED_SELOVR_PICNUM] || !tilesizy[AIMED_SELOVR_PICNUM] || j) { - AIMED_SELOVR_PICNUM += i+MAXTILES; - AIMED_SELOVR_PICNUM %= MAXTILES; + i += AIMED_SELOVR_PICNUM + MAXTILES; + AIMED_SELOVR_PICNUM = i % MAXTILES; j = 0; } diff --git a/polymer/eduke32/source/game.h b/polymer/eduke32/source/game.h index 8151b9f99..95e2505c9 100644 --- a/polymer/eduke32/source/game.h +++ b/polymer/eduke32/source/game.h @@ -309,7 +309,7 @@ static inline int32_t G_GetTeamPalette(int32_t team) { int8_t pal[] = { 3, 10, 11, 12 }; - if (team > (int32_t)(sizeof(pal)/sizeof(pal[0])) || team < 0) + if ((unsigned)team >= (sizeof(pal)/sizeof(pal[0]))) return 0; return pal[team];