Source-Changes-HG archive

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

[src/trunk]: src/external/bsd/fetch/dist/libfetch delint



details:   https://anonhg.NetBSD.org/src/rev/aebb0f5c5250
branches:  trunk
changeset: 766528:aebb0f5c5250
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Jun 25 20:27:01 2011 +0000

description:
delint

diffstat:

 external/bsd/fetch/dist/libfetch/common.c |   8 ++--
 external/bsd/fetch/dist/libfetch/file.c   |   9 ++++--
 external/bsd/fetch/dist/libfetch/ftp.c    |  46 ++++++++++++++++++------------
 external/bsd/fetch/dist/libfetch/http.c   |  24 ++++++++-------
 4 files changed, 50 insertions(+), 37 deletions(-)

diffs (truncated from 374 to 300 lines):

diff -r 1d92eea8ab58 -r aebb0f5c5250 external/bsd/fetch/dist/libfetch/common.c
--- a/external/bsd/fetch/dist/libfetch/common.c Sat Jun 25 20:13:03 2011 +0000
+++ b/external/bsd/fetch/dist/libfetch/common.c Sat Jun 25 20:27:01 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: common.c,v 1.1.1.9 2010/03/24 20:51:41 joerg Exp $     */
+/*     $NetBSD: common.c,v 1.2 2011/06/25 20:27:01 christos Exp $      */
 /*-
  * Copyright (c) 1998-2004 Dag-Erling Coïdan Smørgrav
  * Copyright (c) 2008, 2010 Joerg Sonnenberger <joerg%NetBSD.org@localhost>
@@ -539,7 +539,7 @@
                }
 #ifdef WITH_SSL
                if (conn->ssl != NULL)
-                       rlen = SSL_read(conn->ssl, buf, len);
+                       rlen = SSL_read(conn->ssl, buf, (int)len);
                else
 #endif
                        rlen = read(conn->sd, buf, len);
@@ -588,7 +588,7 @@
                        return (-1);
                if (len == 0)
                        break;
-               next = memchr(conn->buf + conn->buflen, '\n', len);
+               next = memchr(conn->buf + conn->buflen, '\n', (size_t)len);
                conn->buflen += len;
                if (conn->buflen == conn->bufsize && next == NULL) {
                        tmp = conn->buf;
@@ -674,7 +674,7 @@
                errno = 0;
 #ifdef WITH_SSL
                if (conn->ssl != NULL)
-                       wlen = SSL_write(conn->ssl, buf, len);
+                       wlen = SSL_write(conn->ssl, buf, (int)len);
                else
 #endif
 #ifndef MSG_NOSIGNAL
diff -r 1d92eea8ab58 -r aebb0f5c5250 external/bsd/fetch/dist/libfetch/file.c
--- a/external/bsd/fetch/dist/libfetch/file.c   Sat Jun 25 20:13:03 2011 +0000
+++ b/external/bsd/fetch/dist/libfetch/file.c   Sat Jun 25 20:27:01 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: file.c,v 1.1.1.6 2009/10/15 12:59:59 joerg Exp $       */
+/*     $NetBSD: file.c,v 1.2 2011/06/25 20:27:01 christos Exp $        */
 /*-
  * Copyright (c) 1998-2004 Dag-Erling Coïdan Smørgrav
  * Copyright (c) 2008, 2009 Joerg Sonnenberger <joerg%NetBSD.org@localhost>
@@ -204,7 +204,8 @@
 }
 
 int
-fetchStatFile(struct url *u, struct url_stat *us, const char *flags)
+/*ARGSUSED*/
+fetchStatFile(struct url *u, struct url_stat *us, const char *flags __unused)
 {
        char *path;
        int fd, rv;
@@ -229,7 +230,9 @@
 }
 
 int
-fetchListFile(struct url_list *ue, struct url *u, const char *pattern, const char *flags)
+/*ARGSUSED*/
+fetchListFile(struct url_list *ue, struct url *u, const char *pattern,
+    const char *flags __unused)
 {
        char *path;
        struct dirent *de;
diff -r 1d92eea8ab58 -r aebb0f5c5250 external/bsd/fetch/dist/libfetch/ftp.c
--- a/external/bsd/fetch/dist/libfetch/ftp.c    Sat Jun 25 20:13:03 2011 +0000
+++ b/external/bsd/fetch/dist/libfetch/ftp.c    Sat Jun 25 20:27:01 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ftp.c,v 1.3 2011/06/25 20:13:03 christos Exp $ */
+/*     $NetBSD: ftp.c,v 1.4 2011/06/25 20:27:01 christos Exp $ */
 /*-
  * Copyright (c) 1998-2004 Dag-Erling Coïdan Smørgrav
  * Copyright (c) 2008, 2009, 2010 Joerg Sonnenberger <joerg%NetBSD.org@localhost>
@@ -202,7 +202,7 @@
        va_list ap;
        size_t len;
        char *msg;
-       int r;
+       ssize_t r;
 
        va_start(ap, fmt);
        len = vasprintf(&msg, fmt, ap);
@@ -229,7 +229,7 @@
  * Return a pointer to the filename part of a path
  */
 static const char *
-ftp_filename(const char *file, int *len, int *type, int subdir)
+ftp_filename(const char *file, size_t *len, int *type, int subdir)
 {
        const char *s;
 
@@ -256,6 +256,7 @@
 {
        char *src, *dst, *end;
        int q;
+       size_t len;
 
        if (conn->err != FTP_WORKING_DIRECTORY &&
            conn->err != FTP_FILE_ACTION_OK)
@@ -264,7 +265,8 @@
        src = conn->buf + 4;
        if (src >= end || *src++ != '"')
                return (FTP_PROTOCOL_ERROR);
-       *pwd = malloc(end - src + 1);
+       len = end - src + 1;
+       *pwd = malloc(len);
        if (*pwd == NULL)
                return (FTP_PROTOCOL_ERROR);
        for (q = 0, dst = *pwd; src < end; ++src) {
@@ -295,7 +297,8 @@
 {
        const char *beg, *end;
        char *pwd, *dst;
-       int e, i, len;
+       int e;
+       size_t i, len;
 
        if (*path != '/') {
                ftp_seterr(501);
@@ -342,7 +345,7 @@
                len = strlen(pwd);
 
                /* Look for a common prefix between PWD and dir to fetch. */
-               for (i = 0; i <= len && i <= end - dst; ++i)
+               for (i = 0; i <= len && i <= (size_t)(end - dst); ++i)
                        if (pwd[i] != dst[i])
                                break;
                /* Keep going up a dir until we have a matching prefix. */
@@ -409,6 +412,7 @@
        case 0:
        case 's':
                mode = 'S';
+               /*FALLTHROUGH*/
        case 'S':
                break;
        default:
@@ -437,14 +441,17 @@
        case 0:
        case 'i':
                type = 'I';
+               /*FALLTHROUGH*/
        case 'I':
                break;
        case 'a':
                type = 'A';
+               /*FALLTHROUGH*/
        case 'A':
                break;
        case 'd':
                type = 'D';
+               /*FALLTHROUGH*/
        case 'D':
                /* can't handle yet */
        default:
@@ -464,7 +471,8 @@
 {
        char *ln;
        const char *filename;
-       int filenamelen, type;
+       size_t filenamelen;
+       int type;
        struct tm tm;
        time_t t;
        int e;
@@ -552,7 +560,7 @@
 ftp_readfn(void *v, void *buf, size_t len)
 {
        struct ftpio *io;
-       int r;
+       ssize_t r;
 
        io = (struct ftpio *)v;
        if (io == NULL) {
@@ -585,7 +593,7 @@
 ftp_writefn(void *v, const void *buf, size_t len)
 {
        struct ftpio *io;
-       int w;
+       ssize_t w;
 
        io = (struct ftpio *)v;
        if (io == NULL) {
@@ -619,7 +627,6 @@
 ftp_closefn(void *v)
 {
        struct ftpio *io;
-       int r;
 
        io = (struct ftpio *)v;
        if (io == NULL) {
@@ -635,7 +642,7 @@
        fetch_close(io->dconn);
        io->dconn = NULL;
        io->dir = -1;
-       r = ftp_chkerr(io->cconn);
+       (void)ftp_chkerr(io->cconn);
        fetch_cache_put(io->cconn, ftp_disconnect);
        free(io);
        return;
@@ -676,7 +683,8 @@
        } u;
        const char *bindaddr;
        const char *filename;
-       int filenamelen, type;
+       size_t filenamelen;
+       int type;
        int low, pasv, verbose;
        int e, sd = -1;
        socklen_t l;
@@ -759,7 +767,7 @@
                        }
                        l = (e == FTP_PASSIVE_MODE ? 6 : 21);
                        for (i = 0; *p && i < l; i++, p++)
-                               addr[i] = strtol(p, &p, 10);
+                               addr[i] = (unsigned char)strtol(p, &p, 10);
                        if (i < l) {
                                e = FTP_PROTOCOL_ERROR;
                                goto ouch;
@@ -861,7 +869,7 @@
 #ifdef IPV6_PORTRANGE
                        arg = low ? IPV6_PORTRANGE_DEFAULT : IPV6_PORTRANGE_HIGH;
                        if (setsockopt(sd, IPPROTO_IPV6, IPV6_PORTRANGE,
-                               (char *)&arg, sizeof(arg)) == -1)
+                               &arg, (socklen_t)sizeof(arg)) == -1)
                                goto sysouch;
 #endif
                        break;
@@ -870,7 +878,7 @@
 #ifdef IP_PORTRANGE
                        arg = low ? IP_PORTRANGE_DEFAULT : IP_PORTRANGE_HIGH;
                        if (setsockopt(sd, IPPROTO_IP, IP_PORTRANGE,
-                               (char *)&arg, sizeof(arg)) == -1)
+                               &arg, (socklen_t)sizeof(arg)) == -1)
                                goto sysouch;
 #endif
                        break;
@@ -892,14 +900,14 @@
                        e = ftp_cmd(conn, "PORT %d,%d,%d,%d,%d,%d\r\n",
                            (a >> 24) & 0xff, (a >> 16) & 0xff,
                            (a >> 8) & 0xff, a & 0xff,
-                           (p >> 8) & 0xff, p & 0xff);
+                           ((unsigned int)p >> 8) & 0xff, p & 0xff);
                        break;
                case AF_INET6:
 #define UC(b)  (((int)b)&0xff)
                        e = -1;
                        u.sin6.sin6_scope_id = 0;
                        if (getnameinfo(&u.sa, l,
-                               hname, sizeof(hname),
+                               hname, (socklen_t)sizeof(hname),
                                NULL, 0, NI_NUMERICHOST) == 0) {
                                e = ftp_cmd(conn, "EPRT |%d|%s|%d|\r\n", 2, hname,
                                    htons(u.sin6.sin6_port));
@@ -907,7 +915,7 @@
                                        goto ouch;
                        }
                        if (e != FTP_OK) {
-                               ap = (char *)&u.sin6.sin6_addr;
+                               ap = (char *)(void *)&u.sin6.sin6_addr;
                                e = ftp_cmd(conn,
                                    "LPRT %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\r\n",
                                    6, 16,
@@ -916,7 +924,7 @@
                                    UC(ap[8]), UC(ap[9]), UC(ap[10]), UC(ap[11]),
                                    UC(ap[12]), UC(ap[13]), UC(ap[14]), UC(ap[15]),
                                    2,
-                                   (ntohs(u.sin6.sin6_port) >> 8) & 0xff,
+                                   ((unsigned int)ntohs(u.sin6.sin6_port) >> 8) & 0xff,
                                    ntohs(u.sin6.sin6_port)        & 0xff);
                        }
                        break;
diff -r 1d92eea8ab58 -r aebb0f5c5250 external/bsd/fetch/dist/libfetch/http.c
--- a/external/bsd/fetch/dist/libfetch/http.c   Sat Jun 25 20:13:03 2011 +0000
+++ b/external/bsd/fetch/dist/libfetch/http.c   Sat Jun 25 20:27:01 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: http.c,v 1.1.1.7 2010/01/30 21:26:14 joerg Exp $       */
+/*     $NetBSD: http.c,v 1.2 2011/06/25 20:27:01 christos Exp $        */
 /*-
  * Copyright (c) 2000-2004 Dag-Erling Coïdan Smørgrav
  * Copyright (c) 2003 Thomas Klausner <wiz%NetBSD.org@localhost>
@@ -146,7 +146,7 @@
        char            *buf;           /* chunk buffer */
        size_t           bufsize;       /* size of chunk buffer */
        ssize_t          buflen;        /* amount of data currently in buffer */
-       int              bufpos;        /* current read offset in buffer */
+       size_t           bufpos;        /* current read offset in buffer */
        int              eof;           /* end-of-file flag */
        int              error;         /* error flag */
        size_t           chunksize;     /* remaining size of current chunk */
@@ -156,7 +156,7 @@
 /*
  * Get next chunk header
  */
-static int
+static ssize_t
 http_new_chunk(struct httpio *io)
 {
        char *p;



Home | Main Index | Thread Index | Old Index