Source-Changes-HG archive

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

[src/trunk]: src/lib/libc/stdio revert some of dsl's changes to make things b...



details:   https://anonhg.NetBSD.org/src/rev/131c656d30c2
branches:  trunk
changeset: 748498:131c656d30c2
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Oct 25 20:44:13 2009 +0000

description:
revert some of dsl's changes to make things build on i386; he can undo what
he wants when he comes back.

diffstat:

 lib/libc/stdio/asprintf.c     |   8 ++++----
 lib/libc/stdio/fgets.c        |  10 +++++-----
 lib/libc/stdio/fgetwc.c       |   6 +++---
 lib/libc/stdio/fread.c        |   6 +++---
 lib/libc/stdio/fvwrite.c      |  11 ++++++-----
 lib/libc/stdio/getdelim.c     |   8 ++++----
 lib/libc/stdio/setbuffer.c    |   8 ++++----
 lib/libc/stdio/stdio.c        |   8 ++++----
 lib/libc/stdio/tempnam.c      |  14 +++++++-------
 lib/libc/stdio/ungetc.c       |  10 +++++-----
 lib/libc/stdio/vasprintf.c    |   6 +++---
 lib/libc/stdio/vfwprintf.c    |   8 ++++----
 lib/libc/stdio/vsnprintf_ss.c |   8 ++++----
 13 files changed, 56 insertions(+), 55 deletions(-)

diffs (truncated from 471 to 300 lines):

diff -r 16b5068fba2d -r 131c656d30c2 lib/libc/stdio/asprintf.c
--- a/lib/libc/stdio/asprintf.c Sun Oct 25 20:39:45 2009 +0000
+++ b/lib/libc/stdio/asprintf.c Sun Oct 25 20:44:13 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: asprintf.c,v 1.17 2009/10/25 17:09:34 dsl Exp $        */
+/*     $NetBSD: asprintf.c,v 1.18 2009/10/25 20:44:13 christos Exp $   */
 
 /*
  * Copyright (c) 1997 Todd C. Miller <Todd.Miller%courtesan.com@localhost>
@@ -29,7 +29,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: asprintf.c,v 1.17 2009/10/25 17:09:34 dsl Exp $");
+__RCSID("$NetBSD: asprintf.c,v 1.18 2009/10/25 20:44:13 christos Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -60,7 +60,7 @@
        _FILEEXT_SETUP(&f, &fext);
        f._file = -1;
        f._flags = __SWR | __SSTR | __SALC;
-       f._bf._base = f._p = malloc(128);
+       f._bf._base = f._p = malloc((size_t)128);
        if (f._bf._base == NULL)
                goto err;
        f._bf._size = f._w = 127;               /* Leave room for the NUL */
@@ -70,7 +70,7 @@
        if (ret < 0)
                goto err;
        *f._p = '\0';
-       _base = realloc(f._bf._base, ret + 1u);
+       _base = realloc(f._bf._base, (size_t)ret + 1);
        if (_base == NULL)
                goto err;
        *str = (char *)_base;
diff -r 16b5068fba2d -r 131c656d30c2 lib/libc/stdio/fgets.c
--- a/lib/libc/stdio/fgets.c    Sun Oct 25 20:39:45 2009 +0000
+++ b/lib/libc/stdio/fgets.c    Sun Oct 25 20:44:13 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fgets.c,v 1.26 2009/10/25 17:09:34 dsl Exp $   */
+/*     $NetBSD: fgets.c,v 1.27 2009/10/25 20:44:13 christos Exp $      */
 
 /*-
  * Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)fgets.c    8.2 (Berkeley) 12/22/93";
 #else
-__RCSID("$NetBSD: fgets.c,v 1.26 2009/10/25 17:09:34 dsl Exp $");
+__RCSID("$NetBSD: fgets.c,v 1.27 2009/10/25 20:44:13 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -112,19 +112,19 @@
                        }
                        len = n;
                }
-               t = memchr(p, '\n', len + 0u);
+               t = memchr(p, '\n', (size_t)len);
                if (t != NULL) {
                        len = (int)(++t - p);
                        fp->_r -= len;
                        fp->_p = t;
-                       (void)memcpy(s, p, len + 0u);
+                       (void)memcpy(s, p, (size_t)len);
                        s[len] = 0;
                        FUNLOCKFILE(fp);
                        return (buf);
                }
                fp->_r -= len;
                fp->_p += len;
-               (void)memcpy(s, p, len + 0u);
+               (void)memcpy(s, p, (size_t)len);
                s += len;
                n -= len;
        } while (n != 0);
diff -r 16b5068fba2d -r 131c656d30c2 lib/libc/stdio/fgetwc.c
--- a/lib/libc/stdio/fgetwc.c   Sun Oct 25 20:39:45 2009 +0000
+++ b/lib/libc/stdio/fgetwc.c   Sun Oct 25 20:44:13 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fgetwc.c,v 1.10 2009/10/25 17:09:34 dsl Exp $ */
+/* $NetBSD: fgetwc.c,v 1.11 2009/10/25 20:44:13 christos Exp $ */
 
 /*-
  * Copyright (c)2001 Citrus Project,
@@ -30,7 +30,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: fgetwc.c,v 1.10 2009/10/25 17:09:34 dsl Exp $");
+__RCSID("$NetBSD: fgetwc.c,v 1.11 2009/10/25 20:44:13 christos Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include <assert.h>
@@ -63,7 +63,7 @@
                        return WEOF;
        }
        nr = mbrtowc(&wc, (const char *)fp->_p,
-           fp->_r + 0u, &wcio->wcio_mbstate_in);
+           (size_t)fp->_r, &wcio->wcio_mbstate_in);
        if (nr == (size_t)-1) {
                fp->_flags |= __SERR;
                return WEOF;
diff -r 16b5068fba2d -r 131c656d30c2 lib/libc/stdio/fread.c
--- a/lib/libc/stdio/fread.c    Sun Oct 25 20:39:45 2009 +0000
+++ b/lib/libc/stdio/fread.c    Sun Oct 25 20:44:13 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fread.c,v 1.19 2009/10/25 17:09:34 dsl Exp $   */
+/*     $NetBSD: fread.c,v 1.20 2009/10/25 20:44:13 christos Exp $      */
 
 /*-
  * Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)fread.c    8.2 (Berkeley) 12/11/93";
 #else
-__RCSID("$NetBSD: fread.c,v 1.19 2009/10/25 17:09:34 dsl Exp $");
+__RCSID("$NetBSD: fread.c,v 1.20 2009/10/25 20:44:13 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -76,7 +76,7 @@
        total = resid;
        p = buf;
        while (resid > (size_t)(r = fp->_r)) {
-               (void)memcpy(p, fp->_p, r + 0u);
+               (void)memcpy(p, fp->_p, (size_t)r);
                fp->_p += r;
                /* fp->_r = 0 ... done in __srefill */
                p += r;
diff -r 16b5068fba2d -r 131c656d30c2 lib/libc/stdio/fvwrite.c
--- a/lib/libc/stdio/fvwrite.c  Sun Oct 25 20:39:45 2009 +0000
+++ b/lib/libc/stdio/fvwrite.c  Sun Oct 25 20:44:13 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fvwrite.c,v 1.20 2009/10/25 17:09:34 dsl Exp $ */
+/*     $NetBSD: fvwrite.c,v 1.21 2009/10/25 20:44:13 christos Exp $    */
 
 /*-
  * Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)fvwrite.c  8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: fvwrite.c,v 1.20 2009/10/25 17:09:34 dsl Exp $");
+__RCSID("$NetBSD: fvwrite.c,v 1.21 2009/10/25 20:44:13 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -84,7 +84,7 @@
        }
 
 #define        MIN(a, b) ((a) < (b) ? (a) : (b))
-#define        COPY(n)   (void)memcpy(fp->_p, p, (n) + 0u)
+#define        COPY(n)   (void)memcpy(fp->_p, p, (size_t)(n))
 
        iov = uio->uio_iov;
        p = iov->iov_base;
@@ -135,7 +135,8 @@
                                do {
                                        _size = (_size << 1) + 1;
                                } while (_size < blen + len);
-                               _base = realloc(fp->_bf._base, _size + 1u);
+                               _base = realloc(fp->_bf._base,
+                                   (size_t)(_size + 1));
                                if (_base == NULL)
                                        goto err;
                                fp->_w += _size - fp->_bf._size;
@@ -186,7 +187,7 @@
                do {
                        GETIOV(nlknown = 0);
                        if (!nlknown) {
-                               nl = memchr(p, '\n', len + 0u);
+                               nl = memchr(p, '\n', (size_t)len);
                                nldist = nl ? nl + 1 - p : len + 1;
                                nlknown = 1;
                        }
diff -r 16b5068fba2d -r 131c656d30c2 lib/libc/stdio/getdelim.c
--- a/lib/libc/stdio/getdelim.c Sun Oct 25 20:39:45 2009 +0000
+++ b/lib/libc/stdio/getdelim.c Sun Oct 25 20:44:13 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: getdelim.c,v 1.6 2009/10/25 17:09:34 dsl Exp $ */
+/* $NetBSD: getdelim.c,v 1.7 2009/10/25 20:44:13 christos Exp $ */
 
 /*
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: getdelim.c,v 1.6 2009/10/25 17:09:34 dsl Exp $");
+__RCSID("$NetBSD: getdelim.c,v 1.7 2009/10/25 20:44:13 christos Exp $");
 
 #include "namespace.h"
 
@@ -83,7 +83,7 @@
                }
 
                /* Scan through looking for the separator */
-               p = memchr(fp->_p, sep, fp->_r + 0u);
+               p = memchr(fp->_p, sep, (size_t)fp->_r);
                if (p == NULL)
                        len = fp->_r;
                else
@@ -119,7 +119,7 @@
                        *buflen = newlen;
                }
 
-               (void)memcpy(*buf + off, fp->_p, len);
+               (void)memcpy((*buf + off), fp->_p, len);
                /* Safe, len is never greater than what fp->_r can fit. */
                fp->_r -= (int)len;
                fp->_p += (int)len;
diff -r 16b5068fba2d -r 131c656d30c2 lib/libc/stdio/setbuffer.c
--- a/lib/libc/stdio/setbuffer.c        Sun Oct 25 20:39:45 2009 +0000
+++ b/lib/libc/stdio/setbuffer.c        Sun Oct 25 20:44:13 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: setbuffer.c,v 1.11 2009/10/24 15:20:15 dsl Exp $       */
+/*     $NetBSD: setbuffer.c,v 1.12 2009/10/25 20:44:13 christos Exp $  */
 
 /*-
  * Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)setbuffer.c        8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: setbuffer.c,v 1.11 2009/10/24 15:20:15 dsl Exp $");
+__RCSID("$NetBSD: setbuffer.c,v 1.12 2009/10/25 20:44:13 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -55,7 +55,7 @@
        _DIAGASSERT(fp != NULL);
        /* buf may be NULL */
 
-       (void)setvbuf(fp, buf, buf ? _IOFBF : _IONBF, size);
+       (void)setvbuf(fp, buf, buf ? _IOFBF : _IONBF, (size_t)size);
 }
 
 /*
@@ -68,5 +68,5 @@
 
        _DIAGASSERT(fp != NULL);
 
-       return (setvbuf(fp, NULL, _IOLBF, 0));
+       return (setvbuf(fp, NULL, _IOLBF, (size_t)0));
 }
diff -r 16b5068fba2d -r 131c656d30c2 lib/libc/stdio/stdio.c
--- a/lib/libc/stdio/stdio.c    Sun Oct 25 20:39:45 2009 +0000
+++ b/lib/libc/stdio/stdio.c    Sun Oct 25 20:44:13 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: stdio.c,v 1.15 2009/10/24 15:20:15 dsl Exp $   */
+/*     $NetBSD: stdio.c,v 1.16 2009/10/25 20:44:13 christos Exp $      */
 
 /*-
  * Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)stdio.c    8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: stdio.c,v 1.15 2009/10/24 15:20:15 dsl Exp $");
+__RCSID("$NetBSD: stdio.c,v 1.16 2009/10/25 20:44:13 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -68,7 +68,7 @@
        _DIAGASSERT(fp != NULL);
        _DIAGASSERT(buf != NULL);
 
-       ret = read(__sfileno(fp), buf, n);
+       ret = read(__sfileno(fp), buf, (size_t)n);
        /* if the read succeeded, update the current offset */
        if (ret >= 0)
                fp->_offset += ret;
@@ -91,7 +91,7 @@
        if (fp->_flags & __SAPP)
                (void) lseek(__sfileno(fp), (off_t)0, SEEK_END);
        fp->_flags &= ~__SOFF;  /* in case FAPPEND mode is set */
-       return write(__sfileno(fp), buf, n);
+       return write(__sfileno(fp), buf, (size_t)n);
 }
 
 fpos_t
diff -r 16b5068fba2d -r 131c656d30c2 lib/libc/stdio/tempnam.c
--- a/lib/libc/stdio/tempnam.c  Sun Oct 25 20:39:45 2009 +0000
+++ b/lib/libc/stdio/tempnam.c  Sun Oct 25 20:44:13 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tempnam.c,v 1.20 2009/10/24 15:20:15 dsl Exp $ */
+/*     $NetBSD: tempnam.c,v 1.21 2009/10/25 20:44:13 christos Exp $    */
 
 /*
  * Copyright (c) 1988, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)tempnam.c  8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: tempnam.c,v 1.20 2009/10/24 15:20:15 dsl Exp $");
+__RCSID("$NetBSD: tempnam.c,v 1.21 2009/10/25 20:44:13 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */



Home | Main Index | Thread Index | Old Index