Use size_t instead of int where appropriate.

This commit is contained in:
lukem 2005-05-19 03:05:04 +00:00
parent 947172fa2b
commit dc6635b518
5 changed files with 37 additions and 29 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cmds.c,v 1.113 2005/05/19 02:55:37 lukem Exp $ */ /* $NetBSD: cmds.c,v 1.114 2005/05/19 03:05:04 lukem Exp $ */
/*- /*-
* Copyright (c) 1996-2005 The NetBSD Foundation, Inc. * Copyright (c) 1996-2005 The NetBSD Foundation, Inc.
@ -103,7 +103,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)cmds.c 8.6 (Berkeley) 10/9/94"; static char sccsid[] = "@(#)cmds.c 8.6 (Berkeley) 10/9/94";
#else #else
__RCSID("$NetBSD: cmds.c,v 1.113 2005/05/19 02:55:37 lukem Exp $"); __RCSID("$NetBSD: cmds.c,v 1.114 2005/05/19 03:05:04 lukem Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -1331,7 +1331,7 @@ ls(int argc, char *argv[])
if (pagecmd) { if (pagecmd) {
char *p; char *p;
int len; size_t len;
p = getoptionvalue("pager"); p = getoptionvalue("pager");
if (EMPTYSTRING(p)) if (EMPTYSTRING(p))
@ -2525,7 +2525,7 @@ newer(int argc, char *argv[])
void void
lpage(int argc, char *argv[]) lpage(int argc, char *argv[])
{ {
int len; size_t len;
char *p, *pager, *locfile; char *p, *pager, *locfile;
if (argc == 0 || argc > 2 || if (argc == 0 || argc > 2 ||
@ -2558,7 +2558,8 @@ lpage(int argc, char *argv[])
void void
page(int argc, char *argv[]) page(int argc, char *argv[])
{ {
int ohash, orestart_point, overbose, len; int ohash, orestart_point, overbose;
size_t len;
char *p, *pager; char *p, *pager;
if (argc == 0 || argc > 2 || if (argc == 0 || argc > 2 ||

View File

@ -1,4 +1,4 @@
/* $NetBSD: fetch.c,v 1.158 2005/05/14 15:26:43 lukem Exp $ */ /* $NetBSD: fetch.c,v 1.159 2005/05/19 03:05:04 lukem Exp $ */
/*- /*-
* Copyright (c) 1997-2004 The NetBSD Foundation, Inc. * Copyright (c) 1997-2004 The NetBSD Foundation, Inc.
@ -41,7 +41,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: fetch.c,v 1.158 2005/05/14 15:26:43 lukem Exp $"); __RCSID("$NetBSD: fetch.c,v 1.159 2005/05/19 03:05:04 lukem Exp $");
#endif /* not lint */ #endif /* not lint */
/* /*
@ -1300,7 +1300,7 @@ void
aborthttp(int notused) aborthttp(int notused)
{ {
char msgbuf[100]; char msgbuf[100];
int len; size_t len;
sigint_raised = 1; sigint_raised = 1;
alarmtimer(0); alarmtimer(0);
@ -1760,7 +1760,8 @@ int
auto_put(int argc, char **argv, const char *uploadserver) auto_put(int argc, char **argv, const char *uploadserver)
{ {
char *uargv[4], *path, *pathsep; char *uargv[4], *path, *pathsep;
int uargc, rval, len; int uargc, rval;
size_t len;
uargc = 0; uargc = 0;
uargv[uargc++] = "mput"; uargv[uargc++] = "mput";
@ -1779,8 +1780,6 @@ auto_put(int argc, char **argv, const char *uploadserver)
* make sure we always pass a directory to auto_fetch * make sure we always pass a directory to auto_fetch
*/ */
if (argc > 1) { /* more than one file to upload */ if (argc > 1) { /* more than one file to upload */
int len;
len = strlen(uploadserver) + 2; /* path + "/" + "\0" */ len = strlen(uploadserver) + 2; /* path + "/" + "\0" */
free(path); free(path);
path = (char *)xmalloc(len); path = (char *)xmalloc(len);

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.94 2005/05/13 05:03:49 lukem Exp $ */ /* $NetBSD: main.c,v 1.95 2005/05/19 03:05:04 lukem Exp $ */
/*- /*-
* Copyright (c) 1996-2004 The NetBSD Foundation, Inc. * Copyright (c) 1996-2004 The NetBSD Foundation, Inc.
@ -104,7 +104,7 @@ __COPYRIGHT("@(#) Copyright (c) 1985, 1989, 1993, 1994\n\
#if 0 #if 0
static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 10/9/94"; static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 10/9/94";
#else #else
__RCSID("$NetBSD: main.c,v 1.94 2005/05/13 05:03:49 lukem Exp $"); __RCSID("$NetBSD: main.c,v 1.95 2005/05/19 03:05:04 lukem Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -143,7 +143,8 @@ main(int argc, char *argv[])
int ch, rval; int ch, rval;
struct passwd *pw; struct passwd *pw;
char *cp, *ep, *anonuser, *anonpass, *upload_path; char *cp, *ep, *anonuser, *anonpass, *upload_path;
int dumbterm, s, len, isupload; int dumbterm, s, isupload;
size_t len;
socklen_t slen; socklen_t slen;
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");
@ -630,7 +631,8 @@ cmdscanner(void)
{ {
struct cmd *c; struct cmd *c;
char *p; char *p;
int num; int ch;
size_t num;
for (;;) { for (;;) {
#ifndef NO_EDITCOMPLETE #ifndef NO_EDITCOMPLETE
@ -658,7 +660,7 @@ cmdscanner(void)
} else if (num == sizeof(line) - 2) { } else if (num == sizeof(line) - 2) {
fputs("Sorry, input line is too long.\n", fputs("Sorry, input line is too long.\n",
ttyout); ttyout);
while ((num = getchar()) != '\n' && num != EOF) while ((ch = getchar()) != '\n' && ch != EOF)
/* void */; /* void */;
break; break;
} /* else it was a line without a newline */ } /* else it was a line without a newline */

View File

@ -1,4 +1,4 @@
/* $NetBSD: progressbar.c,v 1.7 2005/04/11 01:49:31 lukem Exp $ */ /* $NetBSD: progressbar.c,v 1.8 2005/05/19 03:05:04 lukem Exp $ */
/*- /*-
* Copyright (c) 1997-2003 The NetBSD Foundation, Inc. * Copyright (c) 1997-2003 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: progressbar.c,v 1.7 2005/04/11 01:49:31 lukem Exp $"); __RCSID("$NetBSD: progressbar.c,v 1.8 2005/05/19 03:05:04 lukem Exp $");
#endif /* not lint */ #endif /* not lint */
/* /*
@ -121,7 +121,8 @@ progressmeter(int flag)
struct timeval td; struct timeval td;
off_t abbrevsize, bytespersec; off_t abbrevsize, bytespersec;
double elapsed; double elapsed;
int ratio, barlength, i, remaining; int ratio, i, remaining;
size_t barlength;
/* /*
* Work variables for progress bar. * Work variables for progress bar.
@ -132,7 +133,7 @@ progressmeter(int flag)
* these appropriately. * these appropriately.
*/ */
#endif #endif
int len; size_t len;
char buf[256]; /* workspace for progress bar */ char buf[256]; /* workspace for progress bar */
#ifndef NO_PROGRESS #ifndef NO_PROGRESS
#define BAROVERHEAD 43 /* non `*' portion of progress bar */ #define BAROVERHEAD 43 /* non `*' portion of progress bar */
@ -296,7 +297,8 @@ ptransfer(int siginfo)
struct timeval now, td, wait; struct timeval now, td, wait;
double elapsed; double elapsed;
off_t bytespersec; off_t bytespersec;
int remaining, hh, i, len; int remaining, hh, i;
size_t len;
char buf[256]; /* Work variable for transfer status. */ char buf[256]; /* Work variable for transfer status. */

View File

@ -1,4 +1,4 @@
/* $NetBSD: util.c,v 1.124 2005/05/19 02:55:37 lukem Exp $ */ /* $NetBSD: util.c,v 1.125 2005/05/19 03:05:04 lukem Exp $ */
/*- /*-
* Copyright (c) 1997-2005 The NetBSD Foundation, Inc. * Copyright (c) 1997-2005 The NetBSD Foundation, Inc.
@ -71,7 +71,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: util.c,v 1.124 2005/05/19 02:55:37 lukem Exp $"); __RCSID("$NetBSD: util.c,v 1.125 2005/05/19 03:05:04 lukem Exp $");
#endif /* not lint */ #endif /* not lint */
/* /*
@ -427,7 +427,7 @@ ftp_login(const char *host, const char *user, const char *pass)
if (gatemode) { if (gatemode) {
char *nuser; char *nuser;
int len; size_t len;
len = strlen(user) + 1 + strlen(host) + 1; len = strlen(user) + 1 + strlen(host) + 1;
nuser = xmalloc(len); nuser = xmalloc(len);
@ -500,8 +500,10 @@ ftp_login(const char *host, const char *user, const char *pass)
int int
another(int *pargc, char ***pargv, const char *prompt) another(int *pargc, char ***pargv, const char *prompt)
{ {
int len = strlen(line), ret; int ret;
size_t len;
len = strlen(line);
if (len >= sizeof(line) - 3) { if (len >= sizeof(line) - 3) {
fputs("sorry, arguments too long.\n", ttyout); fputs("sorry, arguments too long.\n", ttyout);
intr(0); intr(0);
@ -530,12 +532,13 @@ another(int *pargc, char ***pargv, const char *prompt)
char * char *
remglob(char *argv[], int doswitch, const char **errbuf) remglob(char *argv[], int doswitch, const char **errbuf)
{ {
char temp[MAXPATHLEN];
static char buf[MAXPATHLEN]; static char buf[MAXPATHLEN];
static FILE *ftemp = NULL; static FILE *ftemp = NULL;
static char **args; static char **args;
int oldverbose, oldhash, oldprogress, fd, len; char temp[MAXPATHLEN];
int oldverbose, oldhash, oldprogress, fd;
char *cp, *mode; char *cp, *mode;
size_t len;
if (!mflag || !connected) { if (!mflag || !connected) {
if (!doglob) if (!doglob)
@ -856,9 +859,10 @@ printf("file %s realfile %s dir %s [%d]\n", file, realfile, dir, dirlen);
void void
list_vertical(StringList *sl) list_vertical(StringList *sl)
{ {
int i, j, w; int i, j;
int columns, width, lines; int columns, lines;
char *p; char *p;
size_t w, width;
width = 0; width = 0;