From 198c6cf51167a9bc60fc9a12c29bdced0df8c37a Mon Sep 17 00:00:00 2001 From: tholo Date: Sat, 14 Dec 1996 06:49:36 +0000 Subject: [PATCH] Clean up lint and compile warnings --- lib/libc/crypt/md5crypt.c | 36 ++++++++++++++++++------------------ lib/libc/net/res_mkquery.c | 4 ++-- lib/libc/rpc/auth_unix.c | 9 ++++++--- lib/libc/rpc/clnt_raw.c | 4 ++-- lib/libc/rpc/xdr.c | 20 ++++++++++---------- lib/libc/stdio/vfprintf.c | 15 ++++++--------- lib/libc/yp/xdr_ypstat.c | 4 ++-- lib/libc/yp/yp_all.c | 4 ++-- lib/libc/yp/ypprot_err.c | 4 ++-- 9 files changed, 50 insertions(+), 50 deletions(-) diff --git a/lib/libc/crypt/md5crypt.c b/lib/libc/crypt/md5crypt.c index 4b99360f105..e8af0cb08ca 100644 --- a/lib/libc/crypt/md5crypt.c +++ b/lib/libc/crypt/md5crypt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: md5crypt.c,v 1.6 1996/10/15 09:25:32 deraadt Exp $ */ +/* $OpenBSD: md5crypt.c,v 1.7 1996/12/14 06:49:36 tholo Exp $ */ /* * ---------------------------------------------------------------------------- @@ -13,7 +13,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: md5crypt.c,v 1.6 1996/10/15 09:25:32 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: md5crypt.c,v 1.7 1996/12/14 06:49:36 tholo Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -54,21 +54,21 @@ md5crypt(pw, salt) * This string is magic for this algorithm. Having * it this way, we can get get better later on */ - static char *magic = "$1$"; + static unsigned char *magic = (unsigned char *)"$1$"; static char passwd[120], *p; - static const char *sp,*ep; + static const unsigned char *sp,*ep; unsigned char final[16]; - int sl,pl,i,j; + int sl,pl,i; MD5_CTX ctx,ctx1; unsigned long l; /* Refine the Salt first */ - sp = salt; + sp = (const unsigned char *)salt; /* If it starts with the magic string, then skip that */ - if(!strncmp(sp,magic,strlen(magic))) - sp += strlen(magic); + if(!strncmp((const char *)sp,(const char *)magic,strlen((const char *)magic))) + sp += strlen((const char *)magic); /* It stops at the first '$', max 8 chars */ for(ep=sp;*ep && *ep != '$' && ep < (sp+8);ep++) @@ -80,19 +80,19 @@ md5crypt(pw, salt) MD5Init(&ctx); /* The password first, since that is what is most unknown */ - MD5Update(&ctx,pw,strlen(pw)); + MD5Update(&ctx,(const unsigned char *)pw,strlen(pw)); /* Then our magic string */ - MD5Update(&ctx,magic,strlen(magic)); + MD5Update(&ctx,magic,strlen((const char *)magic)); /* Then the raw salt */ MD5Update(&ctx,sp,sl); /* Then just as many characters of the MD5(pw,salt,pw) */ MD5Init(&ctx1); - MD5Update(&ctx1,pw,strlen(pw)); + MD5Update(&ctx1,(const unsigned char *)pw,strlen(pw)); MD5Update(&ctx1,sp,sl); - MD5Update(&ctx1,pw,strlen(pw)); + MD5Update(&ctx1,(const unsigned char *)pw,strlen(pw)); MD5Final(final,&ctx1); for(pl = strlen(pw); pl > 0; pl -= 16) MD5Update(&ctx,final,pl>16 ? 16 : pl); @@ -105,11 +105,11 @@ md5crypt(pw, salt) if(i&1) MD5Update(&ctx, final, 1); else - MD5Update(&ctx, pw, 1); + MD5Update(&ctx, (const unsigned char *)pw, 1); /* Now make the output string */ - strcpy(passwd,magic); - strncat(passwd,sp,sl); + strcpy(passwd,(const char *)magic); + strncat(passwd,(const char *)sp,sl); strcat(passwd,"$"); MD5Final(final,&ctx); @@ -122,7 +122,7 @@ md5crypt(pw, salt) for(i=0;i<1000;i++) { MD5Init(&ctx1); if(i & 1) - MD5Update(&ctx1,pw,strlen(pw)); + MD5Update(&ctx1,(const unsigned char *)pw,strlen(pw)); else MD5Update(&ctx1,final,16); @@ -130,12 +130,12 @@ md5crypt(pw, salt) MD5Update(&ctx1,sp,sl); if(i % 7) - MD5Update(&ctx1,pw,strlen(pw)); + MD5Update(&ctx1,(const unsigned char *)pw,strlen(pw)); if(i & 1) MD5Update(&ctx1,final,16); else - MD5Update(&ctx1,pw,strlen(pw)); + MD5Update(&ctx1,(const unsigned char *)pw,strlen(pw)); MD5Final(final,&ctx1); } diff --git a/lib/libc/net/res_mkquery.c b/lib/libc/net/res_mkquery.c index 02b64e98865..6fbd6a38599 100644 --- a/lib/libc/net/res_mkquery.c +++ b/lib/libc/net/res_mkquery.c @@ -52,7 +52,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: res_mkquery.c,v 1.4 1996/09/15 09:31:20 tholo Exp $"; +static char rcsid[] = "$OpenBSD: res_mkquery.c,v 1.5 1996/12/14 06:49:39 tholo Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -132,7 +132,7 @@ res_mkquery(op, dname, class, type, data, datalen, newrr_in, buf, buflen) * Make an additional record for completion domain. */ buflen -= RRFIXEDSZ; - if ((n = dn_comp(data, cp, buflen, dnptrs, lastdnptr)) < 0) + if ((n = dn_comp((const char *)data, cp, buflen, dnptrs, lastdnptr)) < 0) return (-1); cp += n; buflen -= n; diff --git a/lib/libc/rpc/auth_unix.c b/lib/libc/rpc/auth_unix.c index 47273617f8a..56c4e2eb204 100644 --- a/lib/libc/rpc/auth_unix.c +++ b/lib/libc/rpc/auth_unix.c @@ -28,7 +28,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: auth_unix.c,v 1.6 1996/11/14 05:45:16 etheisen Exp $"; +static char *rcsid = "$OpenBSD: auth_unix.c,v 1.7 1996/12/14 06:49:40 tholo Exp $"; #endif /* LIBC_SCCS and not lint */ /* @@ -170,11 +170,12 @@ authunix_create(machname, uid, gid, len, aup_gids) AUTH * authunix_create_default() { - register int len; + register int len, i; char machname[MAX_MACHINE_NAME + 1]; register uid_t uid; register gid_t gid; gid_t gids[NGRPS]; + int gids2[NGRPS]; if (gethostname(machname, MAX_MACHINE_NAME) == -1) abort(); @@ -183,7 +184,9 @@ authunix_create_default() gid = getegid(); if ((len = getgroups(NGRPS, gids)) < 0) abort(); - return (authunix_create(machname, uid, gid, len, gids)); + for (i = 0; i < len; i++) + gids2[i] = gids[i]; + return (authunix_create(machname, uid, gid, len, gids2)); } /* diff --git a/lib/libc/rpc/clnt_raw.c b/lib/libc/rpc/clnt_raw.c index 9c3a75135df..e9cf2455f89 100644 --- a/lib/libc/rpc/clnt_raw.c +++ b/lib/libc/rpc/clnt_raw.c @@ -28,7 +28,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: clnt_raw.c,v 1.4 1996/09/15 09:31:32 tholo Exp $"; +static char *rcsid = "$OpenBSD: clnt_raw.c,v 1.5 1996/12/14 06:49:41 tholo Exp $"; #endif /* LIBC_SCCS and not lint */ /* @@ -149,7 +149,7 @@ call_again: XDR_SETPOS(xdrs, 0); ((struct rpc_msg *)clp->mashl_callmsg)->rm_xid ++ ; if ((! XDR_PUTBYTES(xdrs, clp->mashl_callmsg, clp->mcnt)) || - (! XDR_PUTLONG(xdrs, &proc)) || + (! XDR_PUTLONG(xdrs, (long *)&proc)) || (! AUTH_MARSHALL(h->cl_auth, xdrs)) || (! (*xargs)(xdrs, argsp))) { return (RPC_CANTENCODEARGS); diff --git a/lib/libc/rpc/xdr.c b/lib/libc/rpc/xdr.c index 6272a1dbb92..989efb30c19 100644 --- a/lib/libc/rpc/xdr.c +++ b/lib/libc/rpc/xdr.c @@ -28,7 +28,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: xdr.c,v 1.3 1996/08/19 08:32:01 tholo Exp $"; +static char *rcsid = "$OpenBSD: xdr.c,v 1.4 1996/12/14 06:49:42 tholo Exp $"; #endif /* LIBC_SCCS and not lint */ /* @@ -131,10 +131,10 @@ xdr_u_int(xdrs, up) case XDR_ENCODE: l = (u_long) *up; - return (XDR_PUTLONG(xdrs, &l)); + return (XDR_PUTLONG(xdrs, (long *)&l)); case XDR_DECODE: - if (!XDR_GETLONG(xdrs, &l)) { + if (!XDR_GETLONG(xdrs, (long *)&l)) { return (FALSE); } *up = (u_int) l; @@ -234,10 +234,10 @@ xdr_u_int32_t(xdrs, u_int32_p) case XDR_ENCODE: l = (u_long) *u_int32_p; - return (XDR_PUTLONG(xdrs, &l)); + return (XDR_PUTLONG(xdrs, (long *)&l)); case XDR_DECODE: - if (!XDR_GETLONG(xdrs, &l)) { + if (!XDR_GETLONG(xdrs, (long *)&l)) { return (FALSE); } *u_int32_p = (u_int32_t) l; @@ -293,10 +293,10 @@ xdr_u_short(xdrs, usp) case XDR_ENCODE: l = (u_long) *usp; - return (XDR_PUTLONG(xdrs, &l)); + return (XDR_PUTLONG(xdrs, (long *)&l)); case XDR_DECODE: - if (!XDR_GETLONG(xdrs, &l)) { + if (!XDR_GETLONG(xdrs, (long *)&l)) { return (FALSE); } *usp = (u_short) l; @@ -352,10 +352,10 @@ xdr_u_int16_t(xdrs, u_int16_p) case XDR_ENCODE: l = (u_long) *u_int16_p; - return (XDR_PUTLONG(xdrs, &l)); + return (XDR_PUTLONG(xdrs, (long *)&l)); case XDR_DECODE: - if (!XDR_GETLONG(xdrs, &l)) { + if (!XDR_GETLONG(xdrs, (long *)&l)) { return (FALSE); } *u_int16_p = (u_int16_t) l; @@ -458,7 +458,7 @@ xdr_enum(xdrs, ep) } #else (void) (xdr_short(xdrs, (short *)ep)); - (void) (xdr_int(xdrs, (short *)ep)); + (void) (xdr_int(xdrs, (int *)ep)); return (xdr_long(xdrs, (long *)ep)); #endif } diff --git a/lib/libc/stdio/vfprintf.c b/lib/libc/stdio/vfprintf.c index 623c754b88c..ecd7bb3910f 100644 --- a/lib/libc/stdio/vfprintf.c +++ b/lib/libc/stdio/vfprintf.c @@ -35,7 +35,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: vfprintf.c,v 1.5 1996/11/13 18:46:29 niklas Exp $"; +static char *rcsid = "$OpenBSD: vfprintf.c,v 1.6 1996/12/14 06:49:43 tholo Exp $"; #endif /* LIBC_SCCS and not lint */ /* @@ -61,7 +61,7 @@ static char *rcsid = "$OpenBSD: vfprintf.c,v 1.5 1996/11/13 18:46:29 niklas Exp #include "fvwrite.h" static void __find_arguments(const char *fmt0, va_list ap, va_list **argtable); -static void __grow_type_table(int nextarg, unsigned char **typetable, +static int __grow_type_table(unsigned char **typetable, int *tablesize); /* @@ -808,7 +808,6 @@ __find_arguments (fmt0, ap, argtable) register int n, n2; /* handy integer (short term usage) */ register char *cp; /* handy char pointer (short term usage) */ register int flags; /* flags as above */ - int width; /* width from format (%8d), or 0 */ unsigned char *typetable; /* table of types */ unsigned char stattypetable[STATIC_ARG_TBL_SIZE]; int tablesize; /* current size of type table */ @@ -820,7 +819,7 @@ __find_arguments (fmt0, ap, argtable) */ #define ADDTYPE(type) \ ((nextarg >= tablesize) ? \ - __grow_type_table(nextarg, &typetable, &tablesize) : 0, \ + __grow_type_table(&typetable, &tablesize) : 0, \ typetable[nextarg++] = type, \ (nextarg > tablemax) ? tablemax = nextarg : 0) @@ -869,7 +868,6 @@ __find_arguments (fmt0, ap, argtable) fmt++; /* skip over '%' */ flags = 0; - width = 0; rflag: ch = *fmt++; reswitch: switch (ch) { @@ -904,7 +902,6 @@ reswitch: switch (ch) { nextarg = n; goto rflag; } - width = n; goto reswitch; #ifdef FLOATING_POINT case 'L': @@ -1070,9 +1067,8 @@ done: /* * Increase the size of the type table. */ -static void -__grow_type_table (nextarg, typetable, tablesize) - int nextarg; +static int +__grow_type_table (typetable, tablesize) unsigned char **typetable; int *tablesize; { @@ -1091,6 +1087,7 @@ __grow_type_table (nextarg, typetable, tablesize) memset (&typetable [*tablesize], T_UNUSED, (newsize - *tablesize)); *tablesize = newsize; + return(0); } diff --git a/lib/libc/yp/xdr_ypstat.c b/lib/libc/yp/xdr_ypstat.c index a596e579dbb..9e1bb85fc03 100644 --- a/lib/libc/yp/xdr_ypstat.c +++ b/lib/libc/yp/xdr_ypstat.c @@ -30,7 +30,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: xdr_ypstat.c,v 1.3 1996/08/19 08:35:07 tholo Exp $"; +static char *rcsid = "$OpenBSD: xdr_ypstat.c,v 1.4 1996/12/14 06:49:45 tholo Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -50,5 +50,5 @@ xdr_ypstat(xdrs, objp) XDR *xdrs; ypstat *objp; { - return xdr_enum(xdrs, objp); + return xdr_enum(xdrs, (enum_t *)objp); } diff --git a/lib/libc/yp/yp_all.c b/lib/libc/yp/yp_all.c index 923a5f50719..a858c0415ed 100644 --- a/lib/libc/yp/yp_all.c +++ b/lib/libc/yp/yp_all.c @@ -30,7 +30,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: yp_all.c,v 1.4 1996/08/19 08:35:07 tholo Exp $"; +static char *rcsid = "$OpenBSD: yp_all.c,v 1.5 1996/12/14 06:49:46 tholo Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -64,7 +64,7 @@ u_long *objp; while(1) { if( !xdr_ypresp_all(xdrs, &out)) { xdr_free(xdr_ypresp_all, (char *)&out); - *objp = YP_YPERR; + *objp = (u_long)YP_YPERR; return FALSE; } if(out.more == 0) { diff --git a/lib/libc/yp/ypprot_err.c b/lib/libc/yp/ypprot_err.c index 89682a471f3..20873ffc1a1 100644 --- a/lib/libc/yp/ypprot_err.c +++ b/lib/libc/yp/ypprot_err.c @@ -30,7 +30,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: ypprot_err.c,v 1.3 1996/08/19 08:35:13 tholo Exp $"; +static char *rcsid = "$OpenBSD: ypprot_err.c,v 1.4 1996/12/14 06:49:47 tholo Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -52,7 +52,7 @@ int ypprot_err(incode) unsigned int incode; { - switch (incode) { + switch ((int)incode) { case YP_TRUE: return 0; case YP_FALSE: -- 2.20.1