Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev sprintf -> snprintf
details: https://anonhg.NetBSD.org/src/rev/724c0e4eb37c
branches: trunk
changeset: 565859:724c0e4eb37c
user: itojun <itojun%NetBSD.org@localhost>
date: Thu Apr 22 00:17:10 2004 +0000
description:
sprintf -> snprintf
diffstat:
sys/dev/acpi/acpi_ec.c | 6 +-
sys/dev/ata/ld_ataraid.c | 7 ++-
sys/dev/cardbus/ehci_cardbus.c | 11 ++---
sys/dev/cardbus/ohci_cardbus.c | 11 ++---
sys/dev/eisa/eisa.c | 18 ++++----
sys/dev/i2o/dpti.c | 7 ++-
sys/dev/i2o/iop.c | 16 ++++----
sys/dev/i2o/iopl.c | 6 +-
sys/dev/ic/bha.c | 10 ++--
sys/dev/ic/cs4231.c | 7 ++-
sys/dev/ic/daic.c | 10 +++--
sys/dev/ic/dpt.c | 7 ++-
sys/dev/ic/hd64570.c | 6 +-
sys/dev/ic/interwave.c | 7 ++-
sys/dev/ic/midway.c | 30 ++++++++------
sys/dev/ic/mlx.c | 10 ++--
sys/dev/ic/nslm7x.c | 34 +++++++++-------
sys/dev/ic/opl.c | 7 ++-
sys/dev/ic/rrunner.c | 22 +++++-----
sys/dev/ic/sl811hs.c | 7 ++-
sys/dev/ic/tms320av110.c | 11 +++--
sys/dev/isa/aria.c | 6 +-
sys/dev/isa/ess.c | 10 +++--
sys/dev/isa/gus.c | 7 ++-
sys/dev/isa/if_ai.c | 8 ++--
sys/dev/isa/if_ef.c | 6 +-
sys/dev/isa/if_lc_isa.c | 7 ++-
sys/dev/isa/opl_ym.c | 7 ++-
sys/dev/isa/pas.c | 10 +++--
sys/dev/isa/sb.c | 15 +++----
sys/dev/isa/ym.c | 10 ++--
sys/dev/mca/mca.c | 6 +-
sys/dev/mca/mca_subr.c | 11 +++--
sys/dev/mca/mcavar.h | 4 +-
sys/dev/mvme/memc.c | 11 +++--
sys/dev/mvme/mvmebus.c | 28 +++++++-------
sys/dev/ofisa/ofisa.c | 7 ++-
sys/dev/ofw/ofbus.c | 12 +++--
sys/dev/ofw/ofw_subr.c | 12 ++---
sys/dev/pci/amr.c | 9 ++--
sys/dev/pci/auvia.c | 9 ++--
sys/dev/pci/ehci_pci.c | 11 ++---
sys/dev/pci/if_dge.c | 7 ++-
sys/dev/pci/ld_twe.c | 18 +++++----
sys/dev/pci/ohci_pci.c | 11 ++---
sys/dev/pci/uhci_pci.c | 11 ++---
sys/dev/podulebus/hcsc.c | 7 ++-
sys/dev/podulebus/oak.c | 7 ++-
sys/dev/raidframe/rf_disks.c | 13 +++---
sys/dev/raidframe/rf_driver.c | 10 ++--
sys/dev/raidframe/rf_netbsdkintf.c | 15 ++++---
sys/dev/scsipi/scsipi_verbose.c | 33 +++++++++-------
sys/dev/scsipi/ss_scanjet.c | 54 +++++++++++++++-------------
sys/dev/sun/kbd.c | 6 +-
sys/dev/tc/tc.c | 15 ++++---
sys/dev/usb/uaudio.c | 73 +++++++++++++++++++------------------
sys/dev/usb/umass.c | 11 +++--
sys/dev/usb/usb_subr.c | 25 +++++++-----
58 files changed, 412 insertions(+), 360 deletions(-)
diffs (truncated from 2498 to 300 lines):
diff -r 140308faf090 -r 724c0e4eb37c sys/dev/acpi/acpi_ec.c
--- a/sys/dev/acpi/acpi_ec.c Wed Apr 21 23:19:49 2004 +0000
+++ b/sys/dev/acpi/acpi_ec.c Thu Apr 22 00:17:10 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_ec.c,v 1.28 2004/04/11 15:41:50 kochi Exp $ */
+/* $NetBSD: acpi_ec.c,v 1.29 2004/04/22 00:17:10 itojun Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@@ -172,7 +172,7 @@
*****************************************************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_ec.c,v 1.28 2004/04/11 15:41:50 kochi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_ec.c,v 1.29 2004/04/22 00:17:10 itojun Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -661,7 +661,7 @@
/*
* Evaluate _Qxx to respond to the controller.
*/
- sprintf(qxx, "_Q%02X", Data);
+ snprintf(qxx, sizeof(qxx), "_Q%02X", Data);
rv = AcpiEvaluateObject(sc->sc_handle, qxx,
NULL, NULL);
diff -r 140308faf090 -r 724c0e4eb37c sys/dev/ata/ld_ataraid.c
--- a/sys/dev/ata/ld_ataraid.c Wed Apr 21 23:19:49 2004 +0000
+++ b/sys/dev/ata/ld_ataraid.c Thu Apr 22 00:17:10 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ld_ataraid.c,v 1.10 2004/01/25 18:06:48 hannken Exp $ */
+/* $NetBSD: ld_ataraid.c,v 1.11 2004/04/22 00:17:10 itojun Exp $ */
/*
* Copyright (c) 2003 Wasabi Systems, Inc.
@@ -45,7 +45,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ld_ataraid.c,v 1.10 2004/01/25 18:06:48 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld_ataraid.c,v 1.11 2004/04/22 00:17:10 itojun Exp $");
#include "rnd.h"
@@ -161,7 +161,8 @@
break;
default:
- sprintf(unklev, "<unknown level 0x%x>", aai->aai_level);
+ snprintf(unklev, sizeof(unklev), "<unknown level 0x%x>",
+ aai->aai_level);
level = unklev;
}
diff -r 140308faf090 -r 724c0e4eb37c sys/dev/cardbus/ehci_cardbus.c
--- a/sys/dev/cardbus/ehci_cardbus.c Wed Apr 21 23:19:49 2004 +0000
+++ b/sys/dev/cardbus/ehci_cardbus.c Thu Apr 22 00:17:10 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ehci_cardbus.c,v 1.6 2002/10/02 16:33:41 thorpej Exp $ */
+/* $NetBSD: ehci_cardbus.c,v 1.7 2004/04/22 00:17:10 itojun Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ehci_cardbus.c,v 1.6 2002/10/02 16:33:41 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci_cardbus.c,v 1.7 2004/04/22 00:17:10 itojun Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -171,11 +171,10 @@
vendor = cardbus_findvendor(ca->ca_id);
sc->sc.sc_id_vendor = CARDBUS_VENDOR(ca->ca_id);
if (vendor)
- strncpy(sc->sc.sc_vendor, vendor,
- sizeof(sc->sc.sc_vendor) - 1);
+ strlcpy(sc->sc.sc_vendor, vendor, sizeof(sc->sc.sc_vendor));
else
- sprintf(sc->sc.sc_vendor, "vendor 0x%04x",
- CARDBUS_VENDOR(ca->ca_id));
+ snprintf(sc->sc.sc_vendor, sizeof(sc->sc.sc_vendor),
+ "vendor 0x%04x", CARDBUS_VENDOR(ca->ca_id));
/*
* Find companion controllers. According to the spec they always
diff -r 140308faf090 -r 724c0e4eb37c sys/dev/cardbus/ohci_cardbus.c
--- a/sys/dev/cardbus/ohci_cardbus.c Wed Apr 21 23:19:49 2004 +0000
+++ b/sys/dev/cardbus/ohci_cardbus.c Thu Apr 22 00:17:10 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ohci_cardbus.c,v 1.15 2003/03/11 11:59:31 drochner Exp $ */
+/* $NetBSD: ohci_cardbus.c,v 1.16 2004/04/22 00:17:10 itojun Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -45,7 +45,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ohci_cardbus.c,v 1.15 2003/03/11 11:59:31 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci_cardbus.c,v 1.16 2004/04/22 00:17:10 itojun Exp $");
#include "ehci_cardbus.h"
@@ -170,11 +170,10 @@
vendor = cardbus_findvendor(ca->ca_id);
sc->sc.sc_id_vendor = CARDBUS_VENDOR(ca->ca_id);
if (vendor)
- strncpy(sc->sc.sc_vendor, vendor,
- sizeof(sc->sc.sc_vendor) - 1);
+ strlcpy(sc->sc.sc_vendor, vendor, sizeof(sc->sc.sc_vendor));
else
- sprintf(sc->sc.sc_vendor, "vendor 0x%04x",
- CARDBUS_VENDOR(ca->ca_id));
+ snprintf(sc->sc.sc_vendor, sizeof(sc->sc.sc_vendor),
+ "vendor 0x%04x", CARDBUS_VENDOR(ca->ca_id));
r = ohci_init(&sc->sc);
if (r != USBD_NORMAL_COMPLETION) {
diff -r 140308faf090 -r 724c0e4eb37c sys/dev/eisa/eisa.c
--- a/sys/dev/eisa/eisa.c Wed Apr 21 23:19:49 2004 +0000
+++ b/sys/dev/eisa/eisa.c Thu Apr 22 00:17:10 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: eisa.c,v 1.31 2003/01/01 00:10:17 thorpej Exp $ */
+/* $NetBSD: eisa.c,v 1.32 2004/04/22 00:17:10 itojun Exp $ */
/*
* Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: eisa.c,v 1.31 2003/01/01 00:10:17 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: eisa.c,v 1.32 2004/04/22 00:17:10 itojun Exp $");
#include "opt_eisaverbose.h"
@@ -61,7 +61,7 @@
int eisasubmatch(struct device *, struct cfdata *, void *);
int eisaprint(void *, const char *);
-void eisa_devinfo(const char *, char *);
+void eisa_devinfo(const char *, char *, size_t);
int
eisamatch(struct device *parent, struct cfdata *cf, void *aux)
@@ -83,7 +83,7 @@
char devinfo[256];
if (pnp) {
- eisa_devinfo(ea->ea_idstring, devinfo);
+ eisa_devinfo(ea->ea_idstring, devinfo, sizeof(devinfo));
aprint_normal("%s at %s", devinfo, pnp);
}
aprint_normal(" slot %d", ea->ea_slot);
@@ -211,7 +211,7 @@
#endif /* EISAVEBSOSE */
void
-eisa_devinfo(const char *id, char *cp)
+eisa_devinfo(const char *id, char *cp, size_t l)
{
#ifdef EISAVERBOSE
const char *name;
@@ -235,13 +235,13 @@
}
if (name == NULL)
- sprintf(cp, "unknown device %s", id);
+ snprintf(cp, l, "unknown device %s", id);
else if (onlyvendor)
- sprintf(cp, "unknown %s device %s", name, id);
+ snprintf(cp, l, "unknown %s device %s", name, id);
else
- sprintf(cp, "%s", name);
+ snprintf(cp, l, "%s", name);
#else /* EISAVERBOSE */
- sprintf(cp, "device %s", id);
+ snprintf(cp, l, "device %s", id);
#endif /* EISAVERBOSE */
}
diff -r 140308faf090 -r 724c0e4eb37c sys/dev/i2o/dpti.c
--- a/sys/dev/i2o/dpti.c Wed Apr 21 23:19:49 2004 +0000
+++ b/sys/dev/i2o/dpti.c Thu Apr 22 00:17:10 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dpti.c,v 1.17 2003/12/09 19:51:23 ad Exp $ */
+/* $NetBSD: dpti.c,v 1.18 2004/04/22 00:17:10 itojun Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dpti.c,v 1.17 2003/12/09 19:51:23 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dpti.c,v 1.18 2004/04/22 00:17:10 itojun Exp $");
#include "opt_i2o.h"
@@ -193,7 +193,8 @@
* must be no more than 46 bytes long (see dptivar.h).
*/
printf(": DPT/Adaptec RAID management interface\n");
- sprintf(dpti_sig.dsDescription, "NetBSD %s I2O OSM", osrelease);
+ snprintf(dpti_sig.dsDescription, sizeof(dpti_sig.dsDescription),
+ "NetBSD %s I2O OSM", osrelease);
rv = iop_field_get_all(iop, I2O_TID_IOP,
I2O_DPT_PARAM_EXEC_IOP_BUFFERS, ¶m,
diff -r 140308faf090 -r 724c0e4eb37c sys/dev/i2o/iop.c
--- a/sys/dev/i2o/iop.c Wed Apr 21 23:19:49 2004 +0000
+++ b/sys/dev/i2o/iop.c Thu Apr 22 00:17:10 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: iop.c,v 1.42 2003/12/09 19:43:54 ad Exp $ */
+/* $NetBSD: iop.c,v 1.43 2004/04/22 00:17:10 itojun Exp $ */
/*-
* Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: iop.c,v 1.42 2003/12/09 19:43:54 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: iop.c,v 1.43 2004/04/22 00:17:10 itojun Exp $");
#include "opt_i2o.h"
#include "iop.h"
@@ -223,7 +223,7 @@
static void iop_config_interrupts(struct device *);
static void iop_configure_devices(struct iop_softc *, int, int);
-static void iop_devinfo(int, char *);
+static void iop_devinfo(int, char *, size_t);
static int iop_print(void *, const char *);
static void iop_shutdown(void *);
static int iop_submatch(struct device *, struct cfdata *, void *);
@@ -854,7 +854,7 @@
}
static void
-iop_devinfo(int class, char *devinfo)
+iop_devinfo(int class, char *devinfo, size_t l)
{
#ifdef I2OVERBOSE
int i;
@@ -864,12 +864,12 @@
break;
if (i == sizeof(iop_class) / sizeof(iop_class[0]))
- sprintf(devinfo, "device (class 0x%x)", class);
+ snprintf(devinfo, l, "device (class 0x%x)", class);
else
- strcpy(devinfo, iop_class[i].ic_caption);
+ strlcpy(devinfo, iop_class[i].ic_caption, l);
#else
- sprintf(devinfo, "device (class 0x%x)", class);
+ snprintf(devinfo, l, "device (class 0x%x)", class);
#endif
}
@@ -882,7 +882,7 @@
ia = aux;
if (pnp != NULL) {
- iop_devinfo(ia->ia_class, devinfo);
+ iop_devinfo(ia->ia_class, devinfo, sizeof(devinfo));
aprint_normal("%s at %s", devinfo, pnp);
}
aprint_normal(" tid %d", ia->ia_tid);
diff -r 140308faf090 -r 724c0e4eb37c sys/dev/i2o/iopl.c
--- a/sys/dev/i2o/iopl.c Wed Apr 21 23:19:49 2004 +0000
+++ b/sys/dev/i2o/iopl.c Thu Apr 22 00:17:10 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: iopl.c,v 1.11 2002/10/02 16:33:51 thorpej Exp $ */
+/* $NetBSD: iopl.c,v 1.12 2004/04/22 00:17:11 itojun Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -46,7 +46,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: iopl.c,v 1.11 2002/10/02 16:33:51 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: iopl.c,v 1.12 2004/04/22 00:17:11 itojun Exp $");
#include "opt_i2o.h"
#include "opt_inet.h"
@@ -277,7 +277,7 @@
case I2O_LAN_TYPE_FIBRECHANNEL:
typestr = "fibre channel";
addrstr = wwn;
- sprintf(wwn, "%08x%08x",
+ snprintf(wwn, sizeof(wwn), "%08x%08x",
((u_int32_t *)param.p.ldi.hwaddr)[0],
((u_int32_t *)param.p.ldi.hwaddr)[1]);
iff = IFF_BROADCAST | IFF_MULTICAST;
Home |
Main Index |
Thread Index |
Old Index