From 229dc77170ddabe3a6d9fffc8920fec813a240e2 Mon Sep 17 00:00:00 2001 From: Fabian Greffrath Date: Wed, 8 Jan 2020 14:51:30 +0100 Subject: [PATCH] fix more warnings emerged by Travis CI --- Source/d_deh.c | 2 +- Source/d_main.c | 6 +++++- Source/m_fixed.h | 2 +- Source/m_menu.c | 7 ++++++- Source/mmus2mid.c | 6 +++++- 5 files changed, 18 insertions(+), 5 deletions(-) diff --git a/Source/d_deh.c b/Source/d_deh.c index 1d983ee4..b503a20b 100644 --- a/Source/d_deh.c +++ b/Source/d_deh.c @@ -1829,7 +1829,7 @@ void deh_procPointer(DEHFILE *fpin, FILE* fpout, char *line) // done states[indexnum].action = deh_codeptr[value]; if (fpout) fprintf(fpout," - applied %p from codeptr[%ld] to states[%d]\n",deh_codeptr[value],value,indexnum); // Write BEX-oriented line to match: - for (i=0;i>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); } diff --git a/Source/m_menu.c b/Source/m_menu.c index bd5554d1..2bd26e17 100644 --- a/Source/m_menu.c +++ b/Source/m_menu.c @@ -852,7 +852,12 @@ void M_ReadSaveStrings(void) LoadMenu[i].status = 0; 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); LoadMenu[i].status = 1; } diff --git a/Source/mmus2mid.c b/Source/mmus2mid.c index 903c15a9..2f9852a8 100644 --- a/Source/mmus2mid.c +++ b/Source/mmus2mid.c @@ -758,7 +758,11 @@ int main(int argc,char **argv) musst = fopen(musfile,"rb"); 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); if (mus) {