and yet more warning fixes uncovered by Travis CI

This commit is contained in:
Fabian Greffrath 2020-01-08 15:01:20 +01:00
parent 229dc77170
commit 960c30c342
3 changed files with 6 additions and 3 deletions

View File

@ -980,6 +980,7 @@ void FindResponseFile (void)
file = malloc (size); file = malloc (size);
if (!fread(file,size,1,handle)) if (!fread(file,size,1,handle))
{ {
fclose(handle);
free(file); free(file);
return; return;
} }

View File

@ -791,7 +791,7 @@ void ST_loadGraphics(void)
{ {
sprintf(namebuf, "STTNUM%d", i); sprintf(namebuf, "STTNUM%d", i);
tallnum[i] = (patch_t *) W_CacheLumpName(namebuf, PU_STATIC); tallnum[i] = (patch_t *) W_CacheLumpName(namebuf, PU_STATIC);
sprintf(namebuf, "STYSNUM%d", i); snprintf(namebuf, sizeof(namebuf), "STYSNUM%d", i);
shortnum[i] = (patch_t *) W_CacheLumpName(namebuf, PU_STATIC); shortnum[i] = (patch_t *) W_CacheLumpName(namebuf, PU_STATIC);
} }

View File

@ -177,7 +177,8 @@ static void W_AddFile(const char *name) // killough 1/31/98: static, const
else else
{ {
// WAD file // WAD file
read(handle, &header, sizeof(header)); if (!read(handle, &header, sizeof(header)))
I_Error("Wad file %s doesn't have IWAD or PWAD id\n", filename);
if (strncmp(header.identification,"IWAD",4) && if (strncmp(header.identification,"IWAD",4) &&
strncmp(header.identification,"PWAD",4)) strncmp(header.identification,"PWAD",4))
I_Error("Wad file %s doesn't have IWAD or PWAD id\n", filename); I_Error("Wad file %s doesn't have IWAD or PWAD id\n", filename);
@ -186,7 +187,8 @@ static void W_AddFile(const char *name) // killough 1/31/98: static, const
length = header.numlumps*sizeof(filelump_t); length = header.numlumps*sizeof(filelump_t);
fileinfo2free = fileinfo = malloc(length); // killough fileinfo2free = fileinfo = malloc(length); // killough
lseek(handle, header.infotableofs, SEEK_SET); lseek(handle, header.infotableofs, SEEK_SET);
read(handle, fileinfo, length); if (!read(handle, fileinfo, length))
I_Error("Error reading lump directory from %s\n", filename);
numlumps += header.numlumps; numlumps += header.numlumps;
} }