kill sprintf

This commit is contained in:
christos 2014-03-26 17:54:46 +00:00
parent 42391ab57b
commit 1c9d295ac5
8 changed files with 25 additions and 24 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: kbms_sbdio.c,v 1.10 2012/10/13 06:08:30 tsutsui Exp $ */
/* $NetBSD: kbms_sbdio.c,v 1.11 2014/03/26 17:56:18 christos Exp $ */
/*-
* Copyright (c) 2004, 2005 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kbms_sbdio.c,v 1.10 2012/10/13 06:08:30 tsutsui Exp $");
__KERNEL_RCSID(0, "$NetBSD: kbms_sbdio.c,v 1.11 2014/03/26 17:56:18 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -503,7 +503,7 @@ mouse_debug_print(u_int buttons, int x, int y)
__y = MINMAX(__y + y, 0, FB_HEIGHT);
*(uint8_t *)(fb.fb_addr + __x + __y * FB_LINEBYTES) = 0xff;
sprintf(buf, "%8d %8d", x, y);
snprintf(buf, sizeof(buf), "%8d %8d", x, y);
for (i = 0; i < 64 && buf[i]; i++)
fb_drawchar(480 + i * 12, k, buf[i]);

View File

@ -1,4 +1,4 @@
/* $NetBSD: disk.c,v 1.7 2009/02/04 15:22:13 tsutsui Exp $ */
/* $NetBSD: disk.c,v 1.8 2014/03/26 17:56:18 christos Exp $ */
/*-
* Copyright (c) 2004, 2005 The NetBSD Foundation, Inc.
@ -285,9 +285,8 @@ __fd_progress_msg(int pos)
{
char msg[16];
memset(msg, 0, sizeof msg);
sprintf(msg, "C%d H%d S%d \r", (pos >> 16) & 0xff, (pos >> 8) & 0xff,
pos & 0xff);
snprintf(msg, sizeof(msg), "C%d H%d S%d \r",
(pos >> 16) & 0xff, (pos >> 8) & 0xff, pos & 0xff);
printf("%s", msg);
}
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: dio.c,v 1.38 2011/03/06 14:51:21 tsutsui Exp $ */
/* $NetBSD: dio.c,v 1.39 2014/03/26 17:55:26 christos Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: dio.c,v 1.38 2011/03/06 14:51:21 tsutsui Exp $");
__KERNEL_RCSID(0, "$NetBSD: dio.c,v 1.39 2014/03/26 17:55:26 christos Exp $");
#define _HP300_INTR_H_PRIVATE
@ -263,7 +263,8 @@ dio_devinfo(struct dio_attach_args *da, char *buf, size_t buflen)
}
} else {
foundit:
sprintf(buf, "%s", dio_devdescs[i].dd_desc);
snprintf(buf, buflen, "%s",
dio_devdescs[i].dd_desc);
return buf;
}
}
@ -273,7 +274,7 @@ dio_devinfo(struct dio_attach_args *da, char *buf, size_t buflen)
/*
* Device is unknown. Construct something reasonable.
*/
sprintf(buf, "device id = 0x%x secid = 0x%x",
snprintf(buf, buflen, "device id = 0x%x secid = 0x%x",
da->da_id, da->da_secid);
return buf;
}

View File

@ -1,5 +1,5 @@
%{
/* $NetBSD: gram.y,v 1.4 2011/09/23 14:14:38 nonaka Exp $ */
/* $NetBSD: gram.y,v 1.5 2014/03/26 17:54:46 christos Exp $ */
/*-
* Copyright (c) 1999
@ -184,7 +184,7 @@ dump_node(prefix, n)
char prefix2[1024];
node_t *np;
sprintf(prefix2, "%s ", prefix);
snprintf(prefix2, sizeof(prefix2), "%s ", prefix);
switch (n->type) {
case N_LABEL:

View File

@ -1,4 +1,4 @@
/* $NetBSD: platid_gen.c,v 1.10 2011/09/23 14:14:38 nonaka Exp $ */
/* $NetBSD: platid_gen.c,v 1.11 2014/03/26 17:54:46 christos Exp $ */
/*-
* Copyright (c) 1999
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: platid_gen.c,v 1.10 2011/09/23 14:14:38 nonaka Exp $");
__KERNEL_RCSID(0, "$NetBSD: platid_gen.c,v 1.11 2014/03/26 17:54:46 christos Exp $");
#include <stdio.h>
#include <stdlib.h>
@ -307,7 +307,7 @@ gen_list(node_t* np)
case N_ENTRY:
if (np->ptr2 == NULL) {
char buf[MAXLEN];
sprintf(buf, "%s%s",
snprintf(buf, sizeof(buf), "%s%s",
nest == 0 ? "" : " ",
np->ptr1);
np->ptr2 = strdup(buf);

View File

@ -1,4 +1,4 @@
/* $NetBSD: mongoose.c,v 1.1 2014/02/24 07:23:42 skrll Exp $ */
/* $NetBSD: mongoose.c,v 1.2 2014/03/26 17:57:17 christos Exp $ */
/* $OpenBSD: mongoose.c,v 1.19 2010/01/01 20:28:42 kettenis Exp $ */
@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mongoose.c,v 1.1 2014/02/24 07:23:42 skrll Exp $");
__KERNEL_RCSID(0, "$NetBSD: mongoose.c,v 1.2 2014/03/26 17:57:17 christos Exp $");
#define MONGOOSE_DEBUG 9
@ -259,7 +259,7 @@ mg_intr_string(void *v, int irq)
{
static char buf[16];
sprintf (buf, "isa irq %d", irq);
snprintf (buf, sizeof(buf), "isa irq %d", irq);
return buf;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: autoconf.c,v 1.1 2014/02/24 07:23:43 skrll Exp $ */
/* $NetBSD: autoconf.c,v 1.2 2014/03/26 17:57:17 christos Exp $ */
/* $OpenBSD: autoconf.c,v 1.15 2001/06/25 00:43:10 mickey Exp $ */
@ -86,7 +86,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.1 2014/02/24 07:23:43 skrll Exp $");
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.2 2014/03/26 17:57:17 christos Exp $");
#include "opt_kgdb.h"
#include "opt_useleds.h"
@ -654,7 +654,7 @@ hppa_mod_info(int type, int sv)
}
if (i == __arraycount(hppa_knownmods)) {
sprintf(fakeid, "type %x, sv %x", type, sv);
snprintf(fakeid, sizeof(fakeid), "type %x, sv %x", type, sv);
return fakeid;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: dev_hppa.c,v 1.1 2014/02/24 07:23:43 skrll Exp $ */
/* $NetBSD: dev_hppa.c,v 1.2 2014/03/26 17:57:17 christos Exp $ */
/* $OpenBSD: dev_hppa.c,v 1.5 1999/04/20 20:01:01 mickey Exp $ */
@ -250,7 +250,8 @@ char ttyname_buf[8];
char *
ttyname(int fd)
{
sprintf(ttyname_buf, "%s%d", cdevs[major(cn_tab->cn_dev)],
snprintf(ttyname_buf, sizeof(ttyname_buf), "%s%d",
cdevs[major(cn_tab->cn_dev)],
minor(cn_tab->cn_dev));
return (ttyname_buf);
}