Fix "array subscript has type 'char'" warnings

git-svn-id: https://svn.eduke32.com/eduke32@352 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2006-11-19 08:24:46 +00:00
parent 504ff2e8a4
commit 715bc289e8
14 changed files with 70 additions and 74 deletions

View file

@ -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;

View file

@ -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;

View file

@ -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

View file

@ -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

View file

@ -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];

View file

@ -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();

View file

@ -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<inputloc;ii++)
b[ii] = '*';
b[ii] = 0;
b[(unsigned char)ii] = '*';
b[(unsigned char)ii] = 0;
if (ps[myconnectindex].gm&MODE_TYPE)
x = mpgametext(y,b,c,2+8+16);
else x = gametext(x,y,b,c,2+8+16);
@ -7132,7 +7132,7 @@ void CheatGetInventory(void)
}
}
char cheatbuf[MAXCHEATLEN],cheatbuflen;
signed char cheatbuf[MAXCHEATLEN],cheatbuflen;
void cheats(void)
{
@ -7594,7 +7594,7 @@ FOUNDCHEAT:
actor_tog++;
if (actor_tog == 3) actor_tog = 0;
ps[screenpeek].cheat_phase = 0;
Bsprintf(fta_quotes[122],"MONSTERS: %s",s[actor_tog]);
Bsprintf(fta_quotes[122],"MONSTERS: %s",s[(unsigned char)actor_tog]);
FTA(122,&ps[myconnectindex]);
KB_FlushKeyBoardQueue();
return;
@ -7611,13 +7611,13 @@ FOUNDCHEAT:
}
else
{
if (KB_KeyPressed(cheatkey[0]))
if (KB_KeyPressed((unsigned char)cheatkey[0]))
{
if (ps[myconnectindex].cheat_phase >= 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]);
}

View file

@ -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;
}

View file

@ -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<NUMBUFFERS;i++)
{
if (dwParam1 == (long)&bufferheaders[i])
if (dwParam1 == (unsigned long)&bufferheaders[i])
{
eventcnt[i] = 0; // marks the buffer as free
// printf("Finished buffer %d\n",i);
@ -273,7 +273,7 @@ int MPU_Init
if (midiOutGetDevCaps(mididevice, &midicaps, sizeof(MIDIOUTCAPS)) != MMSYSERR_NOERROR) return MPU_Error;
if (midiStreamOpen(&hmido,&mididevice,1,(DWORD)MPU_MIDICallback,0L,CALLBACK_FUNCTION) != MMSYSERR_NOERROR) return(MPU_Error);
if (midiStreamOpen(&hmido,(LPUINT)&mididevice,1,(DWORD)MPU_MIDICallback,0L,CALLBACK_FUNCTION) != MMSYSERR_NOERROR) return(MPU_Error);
return(MPU_Ok);
}
@ -482,7 +482,7 @@ void MPU_SetVolume(int volume)
int MPU_GetVolume(void)
{
if (mididevice < 0) return 0;
// if (mididevice < 0) return 0;
return 0;
}

View file

@ -42,7 +42,7 @@ extern long searchx, searchy, osearchx, osearchy; //search input
extern short searchsector, searchwall, searchstat; //search output
extern short temppicnum, tempcstat, templotag, temphitag, tempextra;
extern char tempshade, temppal, tempvis, tempxrepeat, tempyrepeat, somethingintab;
extern unsigned char tempshade, temppal, tempvis, tempxrepeat, tempyrepeat, somethingintab;
static long ototalclock = 0, clockval[16], clockcnt = 0;
@ -50,7 +50,7 @@ static long ototalclock = 0, clockval[16], clockcnt = 0;
#define NUMKEYS 19
char option[NUMOPTIONS] = {0,0,0,0,0,0,1,0,0};
char keys[NUMBUILDKEYS] =
unsigned char keys[NUMBUILDKEYS] =
{
0xc8,0xd0,0xcb,0xcd,0x2a,0x9d,0x1d,0x39,
0x1e,0x2c,0xd1,0xc9,0x47,0x49,
@ -74,27 +74,23 @@ char autospritehelp=0,autosecthelp=0;
short MinRate=24, MinD=3;
long xoldtimerhandler, lastmessagetime;
static char tempbuf[1024]; //1024
static int numsprite[MAXSPRITES];
static int multisprite[MAXSPRITES];
static char lo[32];
char tempbuf[1024]; //1024
int numsprite[MAXSPRITES];
int multisprite[MAXSPRITES];
char lo[32];
char levelname[255];
static short curwall=0,curwallnum=0;
static short cursearchsprite=0,cursearchspritenum=0,cursector_lotag=0,cursectornum=0;
static short search_lotag=0,search_hitag=0;
static char wallsprite=0;
static char helpon=0;
short curwall=0,curwallnum=0;
short cursearchsprite=0,cursearchspritenum=0,cursector_lotag=0,cursectornum=0;
short search_lotag=0,search_hitag=0;
char wallsprite=0;
char helpon=0;
//static char onwater=0;
static char onnames=4;
static char usedcount=1;
static short cursprite;
long mousxplc,mousyplc;
long ppointhighlight;
static int counter=0;
char nosprites=0,purpleon=0,skill=4;
char framerateon=1,tabgraphic=2,shadepreview=0,autosave=1;
static char sidemode=0;
unsigned char onnames=4, usedcount=1;
short cursprite;
long mousxplc, mousyplc, ppointhighlight;
int counter=0;
unsigned char nosprites=0,purpleon=0,skill=4;
unsigned char framerateon=1,tabgraphic=2,shadepreview=0,autosave=1,sidemode=0;
extern long vel, svel, hvel, angvel;
long xvel, yvel, timoff;

View file

@ -3975,7 +3975,7 @@ cheat_for_port_credits:
else
{
if (ud.recstat != 2 && ps[myconnectindex].gm&MODE_GAME)
playmusic(&music_fn[0][music_select][0]);
playmusic(&music_fn[0][(unsigned char)music_select][0]);
else playmusic(&env_music_fn[0][0]);
MUSIC_Continue();

View file

@ -53,14 +53,14 @@ static void tloadtile(short tilenume, char type)
{
if (!(gotpic[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))

View file

@ -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;

View file

@ -174,7 +174,7 @@ int USRHOOKS_FreeMem(char *ptr)
return(USRHOOKS_Ok);
}
char menunum=0;
unsigned char menunum=0;
void intomenusounds(void)
{