Fix all compilation errors (tested using DEBUGMODE=1 and ERRORMODE=1) that remain outstanding. Notably:

* Remove FUNCMATH from all void-returning functions, given GCC80 specifically complains about this case.
	* Extend the length of all extant buffers to the safety threshold recommended by the compiler.
	* Add void casts to WS_getaddrinfo's setting to prevent complaints about incompatible typecasts.
	* Extend the charsel, face, and superface buffer sizes and writes to include the null terminator. (I didn't really want to do this because it's not even particularily NEEDED, but there was literally zero way to get around the request that I could find with multiple online searches. I tried.)
This commit is contained in:
toaster 2018-07-07 16:52:01 +01:00
parent ba43ed5d48
commit 97348beb66
18 changed files with 46 additions and 45 deletions

View File

@ -1559,7 +1559,7 @@ static void SV_SavedGame(void)
{
size_t length;
UINT8 *savebuffer;
XBOXSTATIC char tmpsave[256];
XBOXSTATIC char tmpsave[264];
if (!cv_dumpconsistency.value)
return;
@ -1601,7 +1601,7 @@ static void CL_LoadReceivedSavegame(void)
{
UINT8 *savebuffer = NULL;
size_t length, decompressedlen;
XBOXSTATIC char tmpsave[256];
XBOXSTATIC char tmpsave[264];
sprintf(tmpsave, "%s" PATHSEP TMPSAVENAME, srb2home);
@ -2062,7 +2062,7 @@ static void CL_ConnectToServer(boolean viams)
tic_t asksent;
#endif
#ifdef JOININGAME
XBOXSTATIC char tmpsave[256];
XBOXSTATIC char tmpsave[264];
sprintf(tmpsave, "%s" PATHSEP TMPSAVENAME, srb2home);
#endif

View File

@ -41,7 +41,7 @@ void D_SRB2Main(void);
// Called by IO functions when input is detected.
void D_PostEvent(const event_t *ev);
#ifndef DOXYGEN
FUNCMATH void D_PostEvent_end(void); // delimiter for locking memory
void D_PostEvent_end(void); // delimiter for locking memory
#endif
void D_ProcessEvents(void);

View File

@ -3879,7 +3879,7 @@ static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum)
if (ncs != FS_FOUND || toomany)
{
char message[256];
char message[275];
if (toomany)
sprintf(message, M_GetText("Too many files loaded to add %s\n"), filename);

View File

@ -3081,10 +3081,11 @@ static void readmaincfg(MYFILE *f)
// Also save a time attack folder
filenamelen = strlen(gamedatafilename)-4; // Strip off the extension
strncpy(timeattackfolder, gamedatafilename, min(filenamelen, sizeof (timeattackfolder)));
filenamelen = min(filenamelen, sizeof (timeattackfolder));
strncpy(timeattackfolder, gamedatafilename, filenamelen);
timeattackfolder[min(filenamelen, sizeof (timeattackfolder) - 1)] = '\0';
strncpy(savegamename, timeattackfolder, sizeof (timeattackfolder));
strncpy(savegamename, timeattackfolder, filenamelen);
strlcat(savegamename, "%u.ssg", sizeof(savegamename));
// can't use sprintf since there is %u in savegamename
strcatbf(savegamename, srb2home, PATHSEP);
@ -8494,7 +8495,7 @@ fixed_t get_number(const char *word)
#endif
}
void FUNCMATH DEH_Check(void)
void DEH_Check(void)
{
#if defined(_DEBUG) || defined(PARANOIA)
const size_t dehstates = sizeof(STATE_LIST)/sizeof(const char*);

View File

@ -35,7 +35,7 @@ void F_CutsceneTicker(void);
void F_TitleDemoTicker(void);
// Called by main loop.
FUNCMATH void F_GameEndDrawer(void);
void F_GameEndDrawer(void);
void F_IntroDrawer(void);
void F_TitleScreenDrawer(void);

View File

@ -95,7 +95,7 @@ void HU_Init(void);
void HU_LoadGraphics(void);
// reset heads up when consoleplayer respawns.
FUNCMATH void HU_Start(void);
void HU_Start(void);
boolean HU_Responder(event_t *ev);

View File

@ -86,10 +86,10 @@ static HMODULE WS_getfunctions(HMODULE tmp)
{
if (tmp != NULL)
{
WS_getaddrinfo = (p_getaddrinfo)GetProcAddress(tmp, "getaddrinfo");
WS_getaddrinfo = (p_getaddrinfo)((void *)GetProcAddress(tmp, "getaddrinfo"));
if (WS_getaddrinfo == NULL)
return NULL;
WS_freeaddrinfo = (p_freeaddrinfo)GetProcAddress(tmp, "freeaddrinfo");
WS_freeaddrinfo = (p_freeaddrinfo)((void *)GetProcAddress(tmp, "freeaddrinfo"));
if (WS_freeaddrinfo == NULL)
{
WS_getaddrinfo = NULL;

View File

@ -1920,7 +1920,7 @@ static INT32 M_GetFirstLevelInList(void);
static void Nextmap_OnChange(void)
{
char *leveltitle;
char tabase[256];
char tabase[329];
short i;
UINT8 active;
lumpnum_t l;

View File

@ -450,7 +450,7 @@ boolean P_SupermanLook4Players(mobj_t *actor);
void P_DestroyRobots(void);
void P_SnowThinker(precipmobj_t *mobj);
void P_RainThinker(precipmobj_t *mobj);
FUNCMATH void P_NullPrecipThinker(precipmobj_t *mobj);
void P_NullPrecipThinker(precipmobj_t *mobj);
void P_RemovePrecipMobj(precipmobj_t *mobj);
void P_SetScale(mobj_t *mobj, fixed_t newscale);
void P_XYMovement(mobj_t *mo);

View File

@ -87,7 +87,7 @@ extern lighttable_t **planezlight;
extern fixed_t *yslope;
extern fixed_t distscale[MAXVIDWIDTH];
FUNCMATH void R_InitPlanes(void);
void R_InitPlanes(void);
void R_PortalStoreClipValues(INT32 start, INT32 end, INT16 *ceil, INT16 *floor, fixed_t *scale);
void R_PortalRestoreClipValues(INT32 start, INT32 end, INT16 *ceil, INT16 *floor, fixed_t *scale);
void R_ClearPlanes(void);

View File

@ -64,7 +64,7 @@ fixed_t P_SegLength(seg_t *seg);
// call at P_SetupLevel()
#if !(defined (WALLSPLATS) || defined (FLOORSPLATS))
FUNCMATH void R_ClearLevelSplats(void);
void R_ClearLevelSplats(void);
#else
void R_ClearLevelSplats(void);
#endif

View File

@ -2502,9 +2502,9 @@ static void Sk_SetDefaultValue(skin_t *skin)
strcpy(skin->realname, "Someone");
strcpy(skin->hudname, "???");
strncpy(skin->charsel, "CHRSONIC", 8);
strncpy(skin->face, "MISSING", 8);
strncpy(skin->superface, "MISSING", 8);
strncpy(skin->charsel, "CHRSONIC", 9);
strncpy(skin->face, "MISSING", 9);
strncpy(skin->superface, "MISSING", 9);
skin->starttranscolor = 160;
skin->prefcolor = SKINCOLOR_GREEN;
@ -2536,7 +2536,7 @@ static void Sk_SetDefaultValue(skin_t *skin)
for (i = 0; i < sfx_skinsoundslot0; i++)
if (S_sfx[i].skinsound != -1)
skin->soundsid[S_sfx[i].skinsound] = i;
strncpy(skin->iconprefix, "SONICICN", 8);
strncpy(skin->iconprefix, "SONICICN", 9);
}
//
@ -2569,9 +2569,9 @@ void R_InitSkins(void)
strcpy(skin->realname, "Sonic");
strcpy(skin->hudname, "SONIC");
strncpy(skin->charsel, "CHRSONIC", 8);
strncpy(skin->face, "LIVSONIC", 8);
strncpy(skin->superface, "LIVSUPER", 8);
strncpy(skin->charsel, "CHRSONIC", 9);
strncpy(skin->face, "LIVSONIC", 9);
strncpy(skin->superface, "LIVSUPER", 9);
skin->prefcolor = SKINCOLOR_BLUE;
skin->ability = CA_THOK;
@ -2591,7 +2591,7 @@ void R_InitSkins(void)
skin->spritedef.numframes = sprites[SPR_PLAY].numframes;
skin->spritedef.spriteframes = sprites[SPR_PLAY].spriteframes;
ST_LoadFaceGraphics(skin->face, skin->superface, 0);
strncpy(skin->iconprefix, "SONICICN", 8);
strncpy(skin->iconprefix, "SONICICN", 9);
K_LoadIconGraphics(skin->iconprefix, 0);
//MD2 for sonic doesn't want to load in Linux.

View File

@ -81,7 +81,7 @@ typedef struct
char realname[SKINNAMESIZE+1]; // Display name for level completion.
char hudname[SKINNAMESIZE+1]; // HUD name to display (officially exactly 5 characters long)
char charsel[8], face[8], superface[8]; // Arbitrarily named patch lumps
char charsel[9], face[9], superface[9]; // Arbitrarily named patch lumps
UINT8 ability; // ability definition
UINT8 ability2; // secondary ability definition

View File

@ -71,7 +71,7 @@ consvar_t cv_scr_depth = {"scr_depth", "16 bits", CV_SAVE, scr_depth_cons_t, NUL
consvar_t cv_renderview = {"renderview", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
#ifdef DIRECTFULLSCREEN
static FUNCMATH void SCR_ChangeFullscreen (void);
static void SCR_ChangeFullscreen (void);
#else
static void SCR_ChangeFullscreen (void);
#endif

View File

@ -12,19 +12,19 @@ consvar_t cd_volume = {"cd_volume","31",CV_SAVE,soundvolume_cons_t, NULL, 0, NUL
consvar_t cdUpdate = {"cd_update","1",CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
FUNCMATH void I_InitCD(void){}
void I_InitCD(void){}
FUNCMATH void I_StopCD(void){}
void I_StopCD(void){}
FUNCMATH void I_PauseCD(void){}
void I_PauseCD(void){}
FUNCMATH void I_ResumeCD(void){}
void I_ResumeCD(void){}
FUNCMATH void I_ShutdownCD(void){}
void I_ShutdownCD(void){}
FUNCMATH void I_UpdateCD(void){}
void I_UpdateCD(void){}
FUNCMATH void I_PlayCD(UINT8 track, UINT8 looping)
void I_PlayCD(UINT8 track, UINT8 looping)
{
(void)track;
(void)looping;

View File

@ -2552,28 +2552,28 @@ void I_StartupMouse2(void)
//
// I_Tactile
//
FUNCMATH void I_Tactile(FFType pFFType, const JoyFF_t *FFEffect)
void I_Tactile(FFType pFFType, const JoyFF_t *FFEffect)
{
// UNUSED.
(void)pFFType;
(void)FFEffect;
}
FUNCMATH void I_Tactile2(FFType pFFType, const JoyFF_t *FFEffect)
void I_Tactile2(FFType pFFType, const JoyFF_t *FFEffect)
{
// UNUSED.
(void)pFFType;
(void)FFEffect;
}
FUNCMATH void I_Tactile3(FFType pFFType, const JoyFF_t *FFEffect)
void I_Tactile3(FFType pFFType, const JoyFF_t *FFEffect)
{
// UNUSED.
(void)pFFType;
(void)FFEffect;
}
FUNCMATH void I_Tactile4(FFType pFFType, const JoyFF_t *FFEffect)
void I_Tactile4(FFType pFFType, const JoyFF_t *FFEffect)
{
// UNUSED.
(void)pFFType;
@ -2705,7 +2705,7 @@ tic_t I_GetTime (void)
//
//I_StartupTimer
//
FUNCMATH void I_StartupTimer(void)
void I_StartupTimer(void)
{
#ifdef _WIN32
// for win2k time bug
@ -2805,11 +2805,11 @@ void I_WaitVBL(INT32 count)
SDL_Delay(count);
}
FUNCMATH void I_BeginRead(void)
void I_BeginRead(void)
{
}
FUNCMATH void I_EndRead(void)
void I_EndRead(void)
{
}
@ -3557,5 +3557,5 @@ const CPUInfoFlags *I_CPUInfo(void)
}
// note CPUAFFINITY code used to reside here
FUNCMATH void I_RegisterSysCommands(void) {}
void I_RegisterSysCommands(void) {}
#endif

View File

@ -124,7 +124,7 @@ void I_ShutdownSound(void)
#endif
}
FUNCMATH void I_UpdateSound(void)
void I_UpdateSound(void)
{
}
@ -462,7 +462,7 @@ static void mix_gme(void *udata, Uint8 *stream, int len)
}
#endif
FUNCMATH void I_InitMusic(void)
void I_InitMusic(void)
{
}
@ -767,7 +767,7 @@ boolean I_SetSongTrack(int track)
// MIDI Music
//
FUNCMATH void I_InitMIDIMusic(void)
void I_InitMIDIMusic(void)
{
}

View File

@ -24,7 +24,7 @@
//
// Called by main loop.
FUNCMATH void ST_Ticker(void);
void ST_Ticker(void);
// Called by main loop.
void ST_Drawer(void);