Use gcc function attribute `format' to catch bad format strings. Fix

them.  From Marc Olzheim.
Type modifier 'l' was missing in many places, probably rendering the
server useless on 64-bit hosts.
(ef_flush, ef_write, ef_extend, lwpCreate, lwpDestroy): Use conversion
specifier 'p' to print pointers.
(check_market): Fix display of loan amount.
(doland): Fix unescaped '%' (undefined behavior).
(ldump, ndump, pdump, sdump): Don't use flag '0' with conversion
specifier 's' (undefined behavior).
(dump, ldump, lost, ndump, pdump, sdump, empth_create, update_sched):
Cast time_t and pthread_t to long for printing.
(lwpStackCheck, lwpStackCheckUsed, finish_sects): Insert cast to fix
argument type on all platforms.
(prod): Remove extra argument.
(perform_mission, airdamage, retreat_land1, lwpReschedule): Format
string missed arguments.
This commit is contained in:
Markus Armbruster 2004-03-09 12:27:40 +00:00
parent 735adbf41b
commit e7d75b2279
38 changed files with 106 additions and 93 deletions

View file

@ -68,6 +68,12 @@ struct mob_acc_globals {
time_t starttime; /* When we should start updating mobility again. */
};
#ifdef __GNUC__
#define ATTRIBUTE(attrs) __attribute__ (attrs)
#else
#define ATTRIBUTE(attrs)
#endif
#define ANNO_KEEP_DAYS 7 /* Keep announcements around for this many days */
/* This uses a lot of thread stack with some versions of GNU libc,
which can lead to nasty heap smashes (observed with 2.2.93).
@ -132,7 +138,8 @@ extern s_char *iesplur(int n);
extern s_char *plur(int n, s_char *no, s_char *yes);
extern s_char *getstarg(s_char *input, s_char *prompt, s_char buf[]);
extern s_char *getstring(s_char *prompt, s_char buf[]);
extern s_char *prbuf(s_char *format, ...);
extern s_char *prbuf(s_char *format, ...)
ATTRIBUTE((format (printf, 1, 2)));
#define MAXCHRNV 12