fix more warnings emerged by Travis CI

This commit is contained in:
Fabian Greffrath 2020-01-08 14:51:30 +01:00
parent 7b413032e7
commit 229dc77170
5 changed files with 18 additions and 5 deletions

View File

@ -1829,7 +1829,7 @@ void deh_procPointer(DEHFILE *fpin, FILE* fpout, char *line) // done
states[indexnum].action = deh_codeptr[value]; states[indexnum].action = deh_codeptr[value];
if (fpout) fprintf(fpout," - applied %p from codeptr[%ld] to states[%d]\n",deh_codeptr[value],value,indexnum); if (fpout) fprintf(fpout," - applied %p from codeptr[%ld] to states[%d]\n",deh_codeptr[value],value,indexnum);
// Write BEX-oriented line to match: // Write BEX-oriented line to match:
for (i=0;i<NUMSTATES;i++) for (i=0;i<arrlen(deh_bexptrs);i++)
{ {
if (deh_bexptrs[i].cptr == deh_codeptr[value]) if (deh_bexptrs[i].cptr == deh_codeptr[value])
{ {

View File

@ -978,7 +978,11 @@ void FindResponseFile (void)
size = ftell(handle); size = ftell(handle);
fseek(handle,0,SEEK_SET); fseek(handle,0,SEEK_SET);
file = malloc (size); file = malloc (size);
fread(file,size,1,handle); if (!fread(file,size,1,handle))
{
free(file);
return;
}
fclose(handle); fclose(handle);
// KEEP ALL CMDLINE ARGS FOLLOWING @RESPONSEFILE ARG // KEEP ALL CMDLINE ARGS FOLLOWING @RESPONSEFILE ARG

View File

@ -64,7 +64,7 @@ __inline__ static fixed_t FixedMul(fixed_t a, fixed_t b)
__inline__ static fixed_t FixedDiv(fixed_t a, fixed_t b) __inline__ static fixed_t FixedDiv(fixed_t a, fixed_t b)
{ {
return (abs(a)>>14) >= abs(b) ? ((a^b)>>31) ^ D_MAXINT : return (abs(a)>>14) >= abs(b) ? ((unsigned)(a^b)>>31) ^ D_MAXINT :
(fixed_t)(((Long64) a << FRACBITS) / b); (fixed_t)(((Long64) a << FRACBITS) / b);
} }

View File

@ -852,7 +852,12 @@ void M_ReadSaveStrings(void)
LoadMenu[i].status = 0; LoadMenu[i].status = 0;
continue; continue;
} }
fread(&savegamestrings[i], SAVESTRINGSIZE, 1, fp); if (!fread(&savegamestrings[i], SAVESTRINGSIZE, 1, fp))
{
strcpy(&savegamestrings[i][0],s_EMPTYSTRING);
LoadMenu[i].status = 0;
continue;
}
fclose(fp); fclose(fp);
LoadMenu[i].status = 1; LoadMenu[i].status = 1;
} }

View File

@ -758,7 +758,11 @@ int main(int argc,char **argv)
musst = fopen(musfile,"rb"); musst = fopen(musfile,"rb");
if (musst) if (musst)
{ {
fread(&MUSh,sizeof(MUSheader),1,musst); if(!fread(&MUSh,sizeof(MUSheader),1,musst))
{
printf("Error reading MUS file\n");
exit(1);
}
mus = malloc(MUSh.ScoreLength+MUSh.ScoreStart); mus = malloc(MUSh.ScoreLength+MUSh.ScoreStart);
if (mus) if (mus)
{ {