enable gcc to check arguments of printf-like functions
Check printf-like functions like conoutf, if format strings and argument lists match. This commit also fixes a lot of code parts that actually had mismatching argument lists - or did things, that this check does not like. numtime() was rewritten in an ugly but very portable fashion (it's recommended to stay away from "long long" format entries, because errors usually only come up at runtime). (some code was copied from sauer)
This commit is contained in:
@@ -249,7 +249,7 @@ void playerinfo(int *cn, const char *attr)
|
||||
if(!p)
|
||||
{
|
||||
if(!m_botmode && multiplayer(false)) // bot clientnums are still glitchy, causing this message to sometimes appear in offline/singleplayer when it shouldn't??? -Bukz 2012may
|
||||
conoutf("invalid clientnum cn: %s attr: %s", cn, attr);
|
||||
conoutf("invalid clientnum cn: %d attr: %s", clientnum, attr);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -544,8 +544,8 @@ bool showhudtimer(int maxsecs, int startmillis, const char *msg, bool flash)
|
||||
concatstring(str, sec);
|
||||
}
|
||||
}
|
||||
if(nextticks < maxticks) hudeditf(HUDMSG_TIMER|HUDMSG_OVERWRITE, flash ? str : str+2);
|
||||
else hudeditf(HUDMSG_TIMER, msg);
|
||||
if(nextticks < maxticks) hudeditf(HUDMSG_TIMER|HUDMSG_OVERWRITE, "%s", flash ? str : str+2);
|
||||
else hudeditf(HUDMSG_TIMER, "%s", msg);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user