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

@ -316,7 +316,7 @@ prnat(natid n)
pr("Connected: %d\n", np->nat_connected);
pr("Representative <r>: %-20s\n", np->nat_pnam);
pr("BTUs <b>: %3d\t\t\t", np->nat_btu);
pr("Reserves <m>: %5d\n", np->nat_reserve);
pr("Reserves <m>: %5ld\n", np->nat_reserve);
pr("Capital <c>: %s\t\t",
xyas(np->nat_xcap, np->nat_ycap, player->cnum));
pr("Origin <o>: %3s\n",
@ -327,7 +327,7 @@ prnat(natid n)
pr("Research <R>: %.2f\n", np->nat_level[NAT_RLEV]);
pr("Education <E>: %.2f\t\t", np->nat_level[NAT_ELEV]);
pr("Happiness <H>: %.2f\n", np->nat_level[NAT_HLEV]);
pr("Money <M>: $%6d\n", np->nat_money);
pr("Money <M>: $%6ld\n", np->nat_money);
pr("Telegrams <t>: %6d\n", np->nat_tgms);
if (opt_DEMANDUPDATE)
pr("Updates missed <U>: %d\n", np->nat_missed);
@ -598,14 +598,14 @@ doland(s_char op, int arg, s_char *p, struct sctstr *sect)
case 'p':
old = sect->sct_pstage;
new = errcheck(arg, 0, PLG_EXPOSED);
pr("Plague stage of %s changed from %d to %d%\n",
pr("Plague stage of %s changed from %d to %d%%\n",
xyas(sect->sct_x, sect->sct_y, player->cnum), old, new);
sect->sct_pstage = new;
break;
case 't':
old = sect->sct_ptime;
new = errcheck(arg, 0, 255);
pr("Plague time of %s changed from %d to %d%\n",
pr("Plague time of %s changed from %d to %d%%\n",
xyas(sect->sct_x, sect->sct_y, player->cnum), old, new);
sect->sct_ptime = new;
break;
@ -717,11 +717,11 @@ docountry(s_char op, int arg, s_char *p, float farg, natid nat,
break;
case 'm':
benefit(nat, np->nat_reserve < arg);
pr("Military Reserves changed from %d to %d\n",
pr("Military Reserves changed from %ld to %d\n",
np->nat_reserve, arg);
if (np->nat_stat == STAT_NORM)
wu(player->cnum, nat,
"Military Reserves changed from %d to %d by divine intervention.\n",
"Military Reserves changed from %ld to %d by divine intervention.\n",
np->nat_reserve, arg);
np->nat_reserve = arg;
break;
@ -753,9 +753,9 @@ docountry(s_char op, int arg, s_char *p, float farg, natid nat,
np->nat_minused = arg;
break;
case 'M':
pr("Money changed from %d to %d\n", np->nat_money, arg);
pr("Money changed from %ld to %d\n", np->nat_money, arg);
wu(player->cnum, nat,
"Money changed from %d to %d by divine intervention.\n",
"Money changed from %ld to %d by divine intervention.\n",
np->nat_money, arg);
np->nat_money = arg;
break;