From 715bc289e8913d451a4e76a650fc8910a958ff40 Mon Sep 17 00:00:00 2001 From: terminx Date: Sun, 19 Nov 2006 08:24:46 +0000 Subject: [PATCH] Fix "array subscript has type 'char'" warnings git-svn-id: https://svn.eduke32.com/eduke32@352 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/build/include/editor.h | 6 ++-- polymer/build/src/build.c | 6 ++-- polymer/eduke32/Makefile | 4 +-- polymer/eduke32/Makefile.deps | 2 +- polymer/eduke32/source/actors.c | 2 +- polymer/eduke32/source/astub.c | 20 ++++++------ polymer/eduke32/source/game.c | 36 ++++++++++----------- polymer/eduke32/source/gameexec.c | 2 +- polymer/eduke32/source/jaudiolib/mpu401.c | 6 ++-- polymer/eduke32/source/mapster32.h | 38 ++++++++++------------- polymer/eduke32/source/menus.c | 2 +- polymer/eduke32/source/premap.c | 16 +++++----- polymer/eduke32/source/savegame.c | 2 +- polymer/eduke32/source/sounds.c | 2 +- 14 files changed, 70 insertions(+), 74 deletions(-) diff --git a/polymer/build/include/editor.h b/polymer/build/include/editor.h index 6120e4e43..5b6265703 100644 --- a/polymer/build/include/editor.h +++ b/polymer/build/include/editor.h @@ -17,10 +17,10 @@ extern long zmode, kensplayerheight; extern short defaultspritecstat; extern short temppicnum, tempcstat, templotag, temphitag, tempextra; -extern char tempshade, temppal, tempxrepeat, tempyrepeat; -extern char somethingintab; +extern unsigned char tempshade, temppal, tempxrepeat, tempyrepeat; +extern unsigned char somethingintab; -extern char buildkeys[NUMBUILDKEYS]; +extern unsigned char buildkeys[NUMBUILDKEYS]; extern long ydim16, xdimgame, ydimgame, bppgame, xdim2d, ydim2d, forcesetup; diff --git a/polymer/build/src/build.c b/polymer/build/src/build.c index 992412841..2f4f724b9 100644 --- a/polymer/build/src/build.c +++ b/polymer/build/src/build.c @@ -56,7 +56,7 @@ void _printmessage16(char name[82]); long vel, svel, angvel; -char buildkeys[NUMBUILDKEYS] = +unsigned char buildkeys[NUMBUILDKEYS] = { 0xc8,0xd0,0xcb,0xcd,0x2a,0x9d,0x1d,0x39, 0x1e,0x2c,0xd1,0xc9,0x33,0x34, @@ -118,8 +118,8 @@ extern char textfont[128][8]; static char pskysearch[MAXSECTORS]; short temppicnum, tempcstat, templotag, temphitag, tempextra; -char tempshade, temppal, tempvis, tempxrepeat, tempyrepeat; -char somethingintab = 255; +unsigned char tempshade, temppal, tempvis, tempxrepeat, tempyrepeat; +unsigned char somethingintab = 255; char mlook = 0; diff --git a/polymer/eduke32/Makefile b/polymer/eduke32/Makefile index 0b5ee9992..be0fa6ffc 100644 --- a/polymer/eduke32/Makefile +++ b/polymer/eduke32/Makefile @@ -33,8 +33,8 @@ endif CC=gcc CXX=g++ -# -Werror-implicit-function-declaration -OURCFLAGS=$(debug) -W -Wall -Wimplicit -Wno-char-subscripts -Wunused \ + +OURCFLAGS=$(debug) -W -Wall -Wimplicit -Werror-implicit-function-declaration -Wno-unused \ -fno-pic -funsigned-char -fno-strict-aliasing -DNO_GCC_BUILTINS -DNOCOPYPROTECT \ -I$(INC) -I$(EINC) -I$(SRC)/jmact -I$(SRC)/jaudiolib -I../jfaud/inc OURCXXFLAGS=-fno-exceptions -fno-rtti diff --git a/polymer/eduke32/Makefile.deps b/polymer/eduke32/Makefile.deps index 84b2f5b09..6749b77de 100644 --- a/polymer/eduke32/Makefile.deps +++ b/polymer/eduke32/Makefile.deps @@ -22,7 +22,7 @@ $(OBJ)/winbits.$o: $(SRC)/winbits.c $(OBJ)/osdfuncs.$o: $(SRC)/names.h $(EINC)/build.h $(OBJ)/osdcmds.$o: $(SRC)/osdcmds.c $(INC)/osdcmds.h $(EINC)/osd.h $(duke3d_h) -$(OBJ)/astub.$o: $(SRC)/astub.c $(EINC)/build.h $(EINC)/pragmas.h $(EINC)/compat.h $(EINC)/editor.h +$(OBJ)/astub.$o: $(SRC)/astub.c $(SRC)/mapster32.h $(EINC)/build.h $(EINC)/pragmas.h $(EINC)/compat.h $(EINC)/editor.h $(OBJ)/game_icon.$o: $(RSRC)/game_icon.c $(OBJ)/build_icon.$o: $(RSRC)/build_icon.c diff --git a/polymer/eduke32/source/actors.c b/polymer/eduke32/source/actors.c index 2ed7d3256..9b99f2193 100644 --- a/polymer/eduke32/source/actors.c +++ b/polymer/eduke32/source/actors.c @@ -384,7 +384,7 @@ SKIPWALLCHECK: for (x = 0;x<7;x++) { - j = headspritestat[statlist[x]]; + j = headspritestat[(unsigned char)statlist[x]]; while (j >= 0) { nextj = nextspritestat[j]; diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index 8d60174fb..4e1c71dfb 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -1064,7 +1064,7 @@ void ExtShowWallData(short wallnum) //F6 void Show2dText(char *name) { int fp,t; - char x=0,y=4,xmax=0,xx=0,col=0; + unsigned char x=0,y=4,xmax=0,xx=0,col=0; clearmidstatbar16(); if ((fp=kopen4load(name,0)) == -1) { @@ -1110,7 +1110,7 @@ void Show2dText(char *name) void Show3dText(char *name) { int fp,t; - char x=0,y=4,xmax=0,xx=0,col=0; + unsigned char x=0,y=4,xmax=0,xx=0,col=0; if ((fp=kopen4load(name,0)) == -1) { @@ -4948,10 +4948,10 @@ void EditSectorData(short sectnum) { char disptext[80]; char edittext[80]; - char col=1, row=0, rowmax = 6, dispwidth = 24; + unsigned char col=1, row=0, rowmax = 6, dispwidth = 24, editval = 0; long xpos = 200, ypos = ydim-STATUS2DSIZ+48; int i = -1; - char editval = 0; + disptext[dispwidth] = 0; clearmidstatbar16(); showsectordata(sectnum); @@ -5186,10 +5186,10 @@ void EditWallData(short wallnum) { char disptext[80]; char edittext[80]; - char row=0, dispwidth = 24; + unsigned char row=0, dispwidth = 24, editval = 0; long xpos = 200, ypos = ydim-STATUS2DSIZ+48; int i = -1; - char editval = 0; + disptext[dispwidth] = 0; clearmidstatbar16(); showwalldata(wallnum); @@ -5319,10 +5319,10 @@ void EditSpriteData(short spritenum) { char disptext[80]; char edittext[80]; - char col=0, row=0, rowmax=4, dispwidth = 24; + unsigned char col=0, row=0, rowmax=4, dispwidth = 24, editval = 0; long xpos = 8, ypos = ydim-STATUS2DSIZ+48; int i = -1; - char editval = 0; + disptext[dispwidth] = 0; clearmidstatbar16(); showspritedata(spritenum); @@ -5729,10 +5729,10 @@ void FuncMenuOpts(void) void FuncMenu(void) { char disptext[80]; - char col=0, row=0, rowmax=7, dispwidth = 24; + unsigned char col=0, row=0, rowmax=7, dispwidth = 24, editval = 0; long xpos = 8, ypos = ydim-STATUS2DSIZ+48; int i = -1, j; - char editval = 0; + disptext[dispwidth] = 0; clearmidstatbar16(); diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index d81f1ba35..ba96216cf 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -560,11 +560,11 @@ void getpackets(void) switch (packbuf[1]) { case 0: - if (voting == myconnectindex && gotvote[packbuf[2]] == 0) + if (voting == myconnectindex && gotvote[(unsigned char)packbuf[2]] == 0) { - gotvote[packbuf[2]] = 1; - votes[packbuf[2]] = packbuf[3]; - Bsprintf(tempbuf,"GOT VOTE FROM %s",ud.user_name[packbuf[2]]); + gotvote[(unsigned char)packbuf[2]] = 1; + votes[(unsigned char)packbuf[2]] = packbuf[3]; + Bsprintf(tempbuf,"GOT VOTE FROM %s",ud.user_name[(unsigned char)packbuf[2]]); adduserquote(tempbuf); } break; @@ -573,7 +573,7 @@ void getpackets(void) voting = packbuf[2]; vote_episode = packbuf[3]; vote_map = packbuf[4]; - Bsprintf(tempbuf,"%s HAS CALLED A VOTE TO CHANGE MAP TO %s (E%dL%d)",ud.user_name[packbuf[2]],level_names[packbuf[3]*11 + packbuf[4]],packbuf[3]+1,packbuf[4]+1); + Bsprintf(tempbuf,"%s HAS CALLED A VOTE TO CHANGE MAP TO %s (E%dL%d)",ud.user_name[(unsigned char)packbuf[2]],level_names[(unsigned char)(packbuf[3]*11 + packbuf[4])],packbuf[3]+1,packbuf[4]+1); adduserquote(tempbuf); Bsprintf(tempbuf,"PRESS F1 TO VOTE YES, F2 TO VOTE NO"); adduserquote(tempbuf); @@ -591,7 +591,7 @@ void getpackets(void) i += gotvote[j]; if (i != numplayers) - Bsprintf(tempbuf,"%s HAS CANCELED THE VOTE",ud.user_name[packbuf[2]]); + Bsprintf(tempbuf,"%s HAS CANCELED THE VOTE",ud.user_name[(unsigned char)packbuf[2]]); else Bsprintf(tempbuf,"VOTE FAILED"); Bmemset(votes,0,sizeof(votes)); Bmemset(gotvote,0,sizeof(gotvote)); @@ -2639,8 +2639,8 @@ short strget_(int small,short x,short y,char *t,short dalen,short c) { char b[91],ii; for (ii=0;ii= 0 && numplayers < 2 && ud.recstat == 0) ps[myconnectindex].cheat_phase = -1; } - if (KB_KeyPressed(cheatkey[1])) + if (KB_KeyPressed((unsigned char)cheatkey[1])) { if (ps[myconnectindex].cheat_phase == -1) { @@ -7637,8 +7637,8 @@ FOUNDCHEAT: else if (ps[myconnectindex].cheat_phase != 0) { ps[myconnectindex].cheat_phase = 0; - KB_ClearKeyDown(cheatkey[0]); - KB_ClearKeyDown(cheatkey[1]); + KB_ClearKeyDown((unsigned char)cheatkey[0]); + KB_ClearKeyDown((unsigned char)cheatkey[1]); } } } @@ -7809,13 +7809,13 @@ void nonsharedkeys(void) { i = (VOLUMEALL?num_volumes*11:6); music_select++; - while (!music_fn[0][music_select][0] && music_select < i) + while (!music_fn[0][(unsigned char)music_select][0] && music_select < i) music_select++; if (music_select == i) music_select = 0; - Bsprintf(fta_quotes[26],"PLAYING %s",&music_fn[0][music_select][0]); + Bsprintf(fta_quotes[26],"PLAYING %s",&music_fn[0][(unsigned char)music_select][0]); FTA(26,&ps[myconnectindex]); - playmusic(&music_fn[0][music_select][0]); + playmusic(&music_fn[0][(unsigned char)music_select][0]); return; } @@ -8031,7 +8031,7 @@ FAKE_F3: if (KB_KeyPressed(sc_F5) && MusicDevice >= 0) { KB_ClearKeyDown(sc_F5); - Bstrcpy(fta_quotes[26],&music_fn[0][music_select][0]); + Bstrcpy(fta_quotes[26],&music_fn[0][(unsigned char)music_select][0]); Bstrcat(fta_quotes[26],". USE SHIFT-F5 TO CHANGE."); FTA(26,&ps[myconnectindex]); } diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index 751086d83..b68305b5f 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -6524,7 +6524,7 @@ good: { insptr++; music_select=*insptr++; - playmusic(&music_fn[ud.volume_number][music_select][0]); + playmusic(&music_fn[ud.volume_number][(unsigned char)music_select][0]); break; } diff --git a/polymer/eduke32/source/jaudiolib/mpu401.c b/polymer/eduke32/source/jaudiolib/mpu401.c index ebef3c153..0dab155cd 100644 --- a/polymer/eduke32/source/jaudiolib/mpu401.c +++ b/polymer/eduke32/source/jaudiolib/mpu401.c @@ -120,7 +120,7 @@ void CALLBACK MPU_MIDICallback(HMIDIOUT handle, UINT uMsg, DWORD dwInstance, DWO midiOutUnprepareHeader((HMIDIOUT)handle, (MIDIHDR*)dwParam1, sizeof(MIDIHDR)); for (i=0;i>3] & pow2char[i&7])) precachecount++; gotpic[i>>3] |= pow2char[i&7]; - precachehightile[type][i>>3] |= pow2char[i&7]; + precachehightile[(unsigned char)type][i>>3] |= pow2char[i&7]; } } else { if (!(gotpic[tilenume>>3] & pow2char[tilenume&7])) precachecount++; gotpic[tilenume>>3] |= pow2char[tilenume&7]; - precachehightile[type][tilenume>>3] |= pow2char[tilenume&7]; + precachehightile[(unsigned char)type][tilenume>>3] |= pow2char[tilenume&7]; } } @@ -1263,11 +1263,11 @@ void resetpspritevars(char g) firsty = ps[0].posy; } - po[numplayersprites].ox = s->x; - po[numplayersprites].oy = s->y; - po[numplayersprites].oz = s->z; - po[numplayersprites].oa = s->ang; - po[numplayersprites].os = s->sectnum; + po[(unsigned char)numplayersprites].ox = s->x; + po[(unsigned char)numplayersprites].oy = s->y; + po[(unsigned char)numplayersprites].oz = s->z; + po[(unsigned char)numplayersprites].oa = s->ang; + po[(unsigned char)numplayersprites].os = s->sectnum; numplayersprites++; if (j >= 0) @@ -1715,7 +1715,7 @@ int enterlevel(char g) if (ud.recstat != 2) { music_select = (ud.volume_number*11) + ud.level_number; - playmusic(&music_fn[0][music_select][0]); + playmusic(&music_fn[0][(unsigned char)music_select][0]); } if ((g&MODE_GAME) || (g&MODE_EOL)) diff --git a/polymer/eduke32/source/savegame.c b/polymer/eduke32/source/savegame.c index dfd1cfeae..2741317f3 100644 --- a/polymer/eduke32/source/savegame.c +++ b/polymer/eduke32/source/savegame.c @@ -354,7 +354,7 @@ int loadplayer(signed char spot) cacheit(); music_select = (ud.volume_number*11) + ud.level_number; - playmusic(&music_fn[0][music_select][0]); + playmusic(&music_fn[0][(unsigned char)music_select][0]); ps[myconnectindex].gm = MODE_GAME; ud.recstat = 0; diff --git a/polymer/eduke32/source/sounds.c b/polymer/eduke32/source/sounds.c index 244600f9a..1dd617f6e 100644 --- a/polymer/eduke32/source/sounds.c +++ b/polymer/eduke32/source/sounds.c @@ -174,7 +174,7 @@ int USRHOOKS_FreeMem(char *ptr) return(USRHOOKS_Ok); } -char menunum=0; +unsigned char menunum=0; void intomenusounds(void) {