Fixed printf format errors.

This commit is contained in:
Bruce Evans 1998-08-02 15:18:45 +00:00
parent d983fa4305
commit c513aafea1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=38022
10 changed files with 32 additions and 26 deletions

View file

@ -472,7 +472,8 @@ mod_rpt(sp)
*p++ = ' ';
tlen += 2;
}
len = snprintf(p, MAXNUM, "%lu ", sp->rptlines[cnt]);
len = snprintf(p, MAXNUM, "%lu ",
(u_long)sp->rptlines[cnt]);
p += len;
tlen += len;
t = msg_cat(sp,

View file

@ -122,7 +122,8 @@ ex_print(sp, cmdp, fp, tp, flags)
*/
if (LF_ISSET(E_C_HASH)) {
if (from <= 999999) {
snprintf(buf, sizeof(buf), "%6ld ", from);
snprintf(buf, sizeof(buf), "%6lu ",
(u_long)from);
p = buf;
} else
p = "TOOBIG ";

View file

@ -81,9 +81,10 @@ ex_visual(sp, cmdp)
if (FL_ISSET(cmdp->iflags, E_C_COUNT))
len = snprintf(buf, sizeof(buf),
"%luz%c%lu", sp->lno, pos, cmdp->count);
"%luz%c%lu", (u_long)sp->lno, pos, cmdp->count);
else
len = snprintf(buf, sizeof(buf), "%luz%c", sp->lno, pos);
len = snprintf(buf, sizeof(buf), "%luz%c",
(u_long)sp->lno, pos);
(void)v_event_push(sp, NULL, buf, len, CH_NOMAP | CH_QUOTED);
/*

View file

@ -138,8 +138,8 @@ vs_line(sp, smp, yp, xp)
if (O_ISSET(sp, O_NUMBER)) {
cols_per_screen -= O_NUMBER_LENGTH;
if ((!dne || smp->lno == 1) && skip_cols == 0) {
nlen = snprintf(cbuf,
sizeof(cbuf), O_NUMBER_FMT, smp->lno);
nlen = snprintf(cbuf, sizeof(cbuf),
O_NUMBER_FMT, (u_long)smp->lno);
(void)gp->scr_addstr(sp, cbuf, nlen);
}
}
@ -506,7 +506,8 @@ vs_number(sp)
break;
(void)gp->scr_move(sp, smp - HMAP, 0);
len = snprintf(nbuf, sizeof(nbuf), O_NUMBER_FMT, smp->lno);
len = snprintf(nbuf, sizeof(nbuf),
O_NUMBER_FMT, (u_long)smp->lno);
(void)gp->scr_addstr(sp, nbuf, len);
}
(void)gp->scr_move(sp, oldy, oldx);

View file

@ -845,8 +845,8 @@ vs_modeline(sp)
cols = sp->cols - 1;
if (O_ISSET(sp, O_RULER)) {
vs_column(sp, &curcol);
len =
snprintf(buf, sizeof(buf), "%lu,%lu", sp->lno, curcol + 1);
len = snprintf(buf, sizeof(buf), "%lu,%lu",
(u_long)sp->lno, (u_long)(curcol + 1));
midpoint = (cols - ((len + 1) / 2)) / 2;
if (curlen < midpoint) {

View file

@ -102,7 +102,7 @@ main(argc, argv)
*/
(void)snprintf(buf, sizeof(buf), "%s.db", capname ? capname : *argv);
if ((capname = strdup(buf)) == NULL)
err(1, "");
err(1, (char *)NULL);
if ((capdbp = dbopen(capname,
O_CREAT | O_TRUNC | O_RDWR, DEFFILEMODE, DB_HASH, NULL)) == NULL)
err(1, "%s", buf);
@ -159,7 +159,7 @@ db_build(ifiles)
if (bplen <= len + 2) {
bplen += MAX(256, len + 2);
if ((data.data = realloc(data.data, bplen)) == NULL)
err(1, "");
err(1, (char *)NULL);
}
/* Find the end of the name field. */

View file

@ -74,7 +74,7 @@ static void warning(cptr, msg)
char *cptr;
char *msg;
{
warnx("%s on line %d\n%s", msg, lineno, curline);
warnx("%s on line %ld\n%s", msg, lineno, curline);
if (cptr) {
char *tptr;
for (tptr = curline; tptr < cptr; ++tptr) putc(' ', stderr);
@ -877,7 +877,7 @@ FILE *fp;
errx(1, "no catalog open");
for (set = cat->first; set; set = set->next) {
fprintf(fp, "$set %d", set->setId);
fprintf(fp, "$set %ld", set->setId);
if (set->hconst)
fprintf(fp, " # %s", set->hconst);
fprintf(fp, "\n\n");
@ -885,7 +885,7 @@ FILE *fp;
for (msg = set->first; msg; msg = msg->next) {
if (msg->hconst)
fprintf(fp, "# %s\n", msg->hconst);
fprintf(fp, "%d\t%s\n", msg->msgId, msg->str);
fprintf(fp, "%ld\t%s\n", msg->msgId, msg->str);
}
fprintf(fp, "\n");
}

View file

@ -687,15 +687,15 @@ dump_tables()
if (new_locale.encoding[0])
fprintf(stderr, "ENCODING %s\n", new_locale.encoding);
if (new_locale.variable)
fprintf(stderr, "VARIABLE %s\n", new_locale.variable);
fprintf(stderr, "VARIABLE %s\n", (char *)new_locale.variable);
fprintf(stderr, "\nMAPLOWER:\n\n");
for (x = 0; x < _CACHED_RUNES; ++x) {
if (isprint(maplower.map[x]))
fprintf(stderr, " '%c'", maplower.map[x]);
fprintf(stderr, " '%c'", (int)maplower.map[x]);
else if (maplower.map[x])
fprintf(stderr, "%04x", maplower.map[x]);
fprintf(stderr, "%04lx", maplower.map[x]);
else
fprintf(stderr, "%4x", 0);
if ((x & 0xf) == 0xf)
@ -712,9 +712,9 @@ dump_tables()
for (x = 0; x < _CACHED_RUNES; ++x) {
if (isprint(mapupper.map[x]))
fprintf(stderr, " '%c'", mapupper.map[x]);
fprintf(stderr, " '%c'", (int)mapupper.map[x]);
else if (mapupper.map[x])
fprintf(stderr, "%04x", mapupper.map[x]);
fprintf(stderr, "%04lx", mapupper.map[x]);
else
fprintf(stderr, "%4x", 0);
if ((x & 0xf) == 0xf)
@ -735,9 +735,9 @@ dump_tables()
if (r) {
if (isprint(x))
fprintf(stderr, " '%c': %2d", x, r & 0xff);
fprintf(stderr, " '%c': %2d", x, (int)(r & 0xff));
else
fprintf(stderr, "%04x: %2d", x, r & 0xff);
fprintf(stderr, "%04x: %2d", x, (int)(r & 0xff));
fprintf(stderr, " %4s", (r & _A) ? "alph" : "");
fprintf(stderr, " %4s", (r & _C) ? "ctrl" : "");
@ -761,7 +761,8 @@ dump_tables()
if (list->map && list->min + 3 < list->max) {
unsigned long r = list->map;
fprintf(stderr, "%04x: %2d", list->min, r & 0xff);
fprintf(stderr, "%04lx: %2d",
(unsigned long)list->min, (int)(r & 0xff));
fprintf(stderr, " %4s", (r & _A) ? "alph" : "");
fprintf(stderr, " %4s", (r & _C) ? "ctrl" : "");
@ -779,7 +780,8 @@ dump_tables()
fprintf(stderr, " %4s", (r & _Q) ? "phon" : "");
fprintf(stderr, "\n...\n");
fprintf(stderr, "%04x: %2d", list->max, r & 0xff);
fprintf(stderr, "%04lx: %2d",
(unsigned long)list->max, (int)(r & 0xff));
fprintf(stderr, " %4s", (r & _A) ? "alph" : "");
fprintf(stderr, " %4s", (r & _C) ? "ctrl" : "");
@ -801,7 +803,7 @@ dump_tables()
unsigned long r = ntohl(list->types[x - list->min]);
if (r) {
fprintf(stderr, "%04x: %2d", x, r & 0xff);
fprintf(stderr, "%04x: %2d", x, (int)(r & 0xff));
fprintf(stderr, " %4s", (r & _A) ? "alph" : "");
fprintf(stderr, " %4s", (r & _C) ? "ctrl" : "");

View file

@ -221,7 +221,7 @@ write_sample_server(def)
else
f_print(fout, "char *");
/* cannot have void type */
f_print(fout, " result;\n", proc->res_type);
f_print(fout, " result;\n");
}
else
f_print(fout, "\tbool_t retval;\n");

View file

@ -196,7 +196,7 @@ write_netid_register(transp)
f_print(fout, "%s\t\texit(1);\n", sp);
f_print(fout, "%s\t}\n", sp);
f_print(fout, "%s\t%s = svc_tli_create(RPC_ANYFD, nconf, 0, 0, 0);\n",
sp, TRANSP, transp);
sp, TRANSP);
f_print(fout, "%s\tif (%s == NULL) {\n", sp, TRANSP);
(void) sprintf(_errbuf, "cannot create %s service.", transp);
print_err_message(tmpbuf);