Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch kill sprintf



details:   https://anonhg.NetBSD.org/src/rev/60164382a39f
branches:  trunk
changeset: 328114:60164382a39f
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Mar 26 17:54:46 2014 +0000

description:
kill sprintf

diffstat:

 sys/arch/ews4800mips/sbd/kbms_sbdio.c    |  6 +++---
 sys/arch/ews4800mips/stand/common/disk.c |  7 +++----
 sys/arch/hp300/dev/dio.c                 |  9 +++++----
 sys/arch/hpc/hpc/platid_gen/gram.y       |  4 ++--
 sys/arch/hpc/hpc/platid_gen/platid_gen.c |  6 +++---
 sys/arch/hppa/dev/mongoose.c             |  6 +++---
 sys/arch/hppa/hppa/autoconf.c            |  6 +++---
 sys/arch/hppa/stand/common/dev_hppa.c    |  5 +++--
 8 files changed, 25 insertions(+), 24 deletions(-)

diffs (204 lines):

diff -r e4ef3ac18a5e -r 60164382a39f sys/arch/ews4800mips/sbd/kbms_sbdio.c
--- a/sys/arch/ews4800mips/sbd/kbms_sbdio.c     Wed Mar 26 17:53:36 2014 +0000
+++ b/sys/arch/ews4800mips/sbd/kbms_sbdio.c     Wed Mar 26 17:54:46 2014 +0000
@@ -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 @@
        __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]);
 
diff -r e4ef3ac18a5e -r 60164382a39f sys/arch/ews4800mips/stand/common/disk.c
--- a/sys/arch/ews4800mips/stand/common/disk.c  Wed Mar 26 17:53:36 2014 +0000
+++ b/sys/arch/ews4800mips/stand/common/disk.c  Wed Mar 26 17:54:46 2014 +0000
@@ -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 @@
 {
        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
diff -r e4ef3ac18a5e -r 60164382a39f sys/arch/hp300/dev/dio.c
--- a/sys/arch/hp300/dev/dio.c  Wed Mar 26 17:53:36 2014 +0000
+++ b/sys/arch/hp300/dev/dio.c  Wed Mar 26 17:54:46 2014 +0000
@@ -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 @@
                                }
                        } 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 @@
        /*
         * 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;
 }
diff -r e4ef3ac18a5e -r 60164382a39f sys/arch/hpc/hpc/platid_gen/gram.y
--- a/sys/arch/hpc/hpc/platid_gen/gram.y        Wed Mar 26 17:53:36 2014 +0000
+++ b/sys/arch/hpc/hpc/platid_gen/gram.y        Wed Mar 26 17:54:46 2014 +0000
@@ -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 @@
        char prefix2[1024];
        node_t *np;
 
-       sprintf(prefix2, "%s    ", prefix);
+       snprintf(prefix2, sizeof(prefix2), "%s    ", prefix);
 
        switch (n->type) {
        case N_LABEL:
diff -r e4ef3ac18a5e -r 60164382a39f sys/arch/hpc/hpc/platid_gen/platid_gen.c
--- a/sys/arch/hpc/hpc/platid_gen/platid_gen.c  Wed Mar 26 17:53:36 2014 +0000
+++ b/sys/arch/hpc/hpc/platid_gen/platid_gen.c  Wed Mar 26 17:54:46 2014 +0000
@@ -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 @@
                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);
diff -r e4ef3ac18a5e -r 60164382a39f sys/arch/hppa/dev/mongoose.c
--- a/sys/arch/hppa/dev/mongoose.c      Wed Mar 26 17:53:36 2014 +0000
+++ b/sys/arch/hppa/dev/mongoose.c      Wed Mar 26 17:54:46 2014 +0000
@@ -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 @@
 {
        static char buf[16];
 
-       sprintf (buf, "isa irq %d", irq);
+       snprintf (buf, sizeof(buf), "isa irq %d", irq);
        return buf;
 }
 
diff -r e4ef3ac18a5e -r 60164382a39f sys/arch/hppa/hppa/autoconf.c
--- a/sys/arch/hppa/hppa/autoconf.c     Wed Mar 26 17:53:36 2014 +0000
+++ b/sys/arch/hppa/hppa/autoconf.c     Wed Mar 26 17:54:46 2014 +0000
@@ -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 @@
        }
 
        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;
        }
 
diff -r e4ef3ac18a5e -r 60164382a39f sys/arch/hppa/stand/common/dev_hppa.c
--- a/sys/arch/hppa/stand/common/dev_hppa.c     Wed Mar 26 17:53:36 2014 +0000
+++ b/sys/arch/hppa/stand/common/dev_hppa.c     Wed Mar 26 17:54:46 2014 +0000
@@ -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(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);
 }



Home | Main Index | Thread Index | Old Index