This commit is contained in:
christos 1998-11-13 15:46:52 +00:00
parent 36b0b72f6f
commit 2c89343c25
34 changed files with 316 additions and 274 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: getusershell.c,v 1.11 1998/11/13 10:26:19 christos Exp $ */
/* $NetBSD: getusershell.c,v 1.12 1998/11/13 15:49:29 christos Exp $ */
/*
* Copyright (c) 1985, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)getusershell.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: getusershell.c,v 1.11 1998/11/13 10:26:19 christos Exp $");
__RCSID("$NetBSD: getusershell.c,v 1.12 1998/11/13 15:49:29 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -78,8 +78,10 @@ getusershell()
if (curshell == NULL)
curshell = initshells();
/* LINTED (auditing puproses only */
ret = (__aconst char *)*curshell;
if (ret != NULL)
curshell++;
return (ret);

View File

@ -1,4 +1,4 @@
/* $NetBSD: psignal.c,v 1.15 1998/11/13 12:31:50 christos Exp $ */
/* $NetBSD: psignal.c,v 1.16 1998/11/13 15:49:29 christos Exp $ */
/*
* Copyright (c) 1983, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)psignal.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: psignal.c,v 1.15 1998/11/13 12:31:50 christos Exp $");
__RCSID("$NetBSD: psignal.c,v 1.16 1998/11/13 15:49:29 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -78,7 +78,8 @@ psignal(sig, s)
v++;
}
/* LINTED iov_base is not written to */
v->iov_base = (void *)__strsignal(sig, buf, sizeof(buf));
v->iov_base = (void *)__strsignal((int)sig, buf, sizeof(buf));
v->iov_len = strlen(v->iov_base);
v++;
v->iov_base = "\n";

View File

@ -1,4 +1,4 @@
/* $NetBSD: vis.c,v 1.10 1998/11/13 12:31:53 christos Exp $ */
/* $NetBSD: vis.c,v 1.11 1998/11/13 15:49:29 christos Exp $ */
/*-
* Copyright (c) 1989, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)vis.c 8.1 (Berkeley) 7/19/93";
#else
__RCSID("$NetBSD: vis.c,v 1.10 1998/11/13 12:31:53 christos Exp $");
__RCSID("$NetBSD: vis.c,v 1.11 1998/11/13 15:49:29 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -127,8 +127,8 @@ vis(dst, c, flag, nextc)
}
if (((c & 0177) == ' ') || (flag & VIS_OCTAL)) {
*dst++ = '\\';
*dst++ = ((u_char)(((u_char)c) >> 6) & 07) + '0';
*dst++ = ((u_char)(((u_char)c) >> 3) & 07) + '0';
*dst++ = ((((u_int32_t)c) >> 6) & 07) + '0';
*dst++ = ((((u_int32_t)c) >> 3) & 07) + '0';
*dst++ = (((u_char)c) & 07) + '0';
goto done;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: gmon.c,v 1.13 1998/08/10 02:43:10 perry Exp $ */
/* $NetBSD: gmon.c,v 1.14 1998/11/13 15:47:09 christos Exp $ */
/*-
* Copyright (c) 1983, 1992, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)gmon.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: gmon.c,v 1.13 1998/08/10 02:43:10 perry Exp $");
__RCSID("$NetBSD: gmon.c,v 1.14 1998/11/13 15:47:09 christos Exp $");
#endif
#endif
@ -59,7 +59,7 @@ extern char *minbrk __asm ("minbrk");
struct gmonparam _gmonparam = { GMON_PROF_OFF };
static int s_scale;
static u_int s_scale;
/* see profil(2) where this is describe (incorrectly) */
#define SCALE_1_TO_1 0x10000L
@ -75,7 +75,7 @@ monstartup(lowpc, highpc)
u_long lowpc;
u_long highpc;
{
int o;
long o;
char *cp;
struct gmonparam *p = &_gmonparam;
@ -96,7 +96,7 @@ monstartup(lowpc, highpc)
p->tolimit = MAXARCS;
p->tossize = p->tolimit * sizeof(struct tostruct);
cp = sbrk(p->kcountsize + p->fromssize + p->tossize);
cp = sbrk((int)(p->kcountsize + p->fromssize + p->tossize));
if (cp == (char *)-1) {
ERR("monstartup: out of memory\n");
return;
@ -104,11 +104,11 @@ monstartup(lowpc, highpc)
#ifdef notdef
memset(cp, 0, p->kcountsize + p->fromssize + p->tossize);
#endif
p->tos = (struct tostruct *)cp;
cp += p->tossize;
p->kcount = (u_short *)cp;
cp += p->kcountsize;
p->froms = (u_short *)cp;
p->tos = (struct tostruct *)(void *)cp;
cp += (size_t)p->tossize;
p->kcount = (u_short *)(void *)cp;
cp += (size_t)p->kcountsize;
p->froms = (u_short *)(void *)cp;
minbrk = sbrk(0);
p->tos[0].link = 0;
@ -211,8 +211,8 @@ _mcleanup()
divisor=10000;
while (divisor > pid) divisor /= 10; /* skip leading zeros */
do {
*t++ = (pid/divisor) + '0';
pid %= divisor;
*t++ = (char)((pid/divisor) + '0');
pid %= (pid_t)divisor;
} while (divisor /= 10);
*t++ = '.';
@ -243,12 +243,12 @@ _mcleanup()
hdr = (struct gmonhdr *)&gmonhdr;
hdr->lpc = p->lowpc;
hdr->hpc = p->highpc;
hdr->ncnt = p->kcountsize + sizeof(gmonhdr);
hdr->ncnt = (int)(p->kcountsize + sizeof(gmonhdr));
hdr->version = GMONVERSION;
hdr->profrate = clockinfo.profhz;
write(fd, (char *)hdr, sizeof *hdr);
write(fd, p->kcount, p->kcountsize);
endfrom = p->fromssize / sizeof(*p->froms);
(void)write(fd, hdr, sizeof *hdr);
(void)write(fd, p->kcount, (size_t)p->kcountsize);
endfrom = (int)(p->fromssize / sizeof(*p->froms));
for (fromindex = 0; fromindex < endfrom; fromindex++) {
if (p->froms[fromindex] == 0)
continue;
@ -286,12 +286,12 @@ moncontrol(mode)
if (mode) {
/* start */
profil((char *)p->kcount, p->kcountsize, p->lowpc,
s_scale);
profil((char *)(void *)p->kcount, (size_t)p->kcountsize,
p->lowpc, s_scale);
p->state = GMON_PROF_ON;
} else {
/* stop */
profil((char *)0, 0, 0, 0);
profil(NULL, 0, (u_long)0, 0);
p->state = GMON_PROF_OFF;
}
}
@ -313,5 +313,5 @@ hertz()
setitimer(ITIMER_REAL, 0, &tim);
if (tim.it_interval.tv_usec < 2)
return(0);
return (1000000 / tim.it_interval.tv_usec);
return (int)(1000000 / tim.it_interval.tv_usec);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: mcount.c,v 1.10 1998/03/26 23:52:38 cgd Exp $ */
/* $NetBSD: mcount.c,v 1.11 1998/11/13 15:47:09 christos Exp $ */
/*-
* Copyright (c) 1983, 1992, 1993
@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)mcount.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: mcount.c,v 1.10 1998/03/26 23:52:38 cgd Exp $");
__RCSID("$NetBSD: mcount.c,v 1.11 1998/11/13 15:47:09 christos Exp $");
#endif
#endif
@ -99,11 +99,13 @@ _MCOUNT_DECL(frompc, selfpc) /* _mcount; may be static, inline, etc */
#if (HASHFRACTION & (HASHFRACTION - 1)) == 0
if (p->hashfraction == HASHFRACTION)
frompcindex =
&p->froms[frompc / (HASHFRACTION * sizeof(*p->froms))];
&p->froms[
(size_t)(frompc / (HASHFRACTION * sizeof(*p->froms)))];
else
#endif
frompcindex =
&p->froms[frompc / (p->hashfraction * sizeof(*p->froms))];
&p->froms[
(size_t)(frompc / (p->hashfraction * sizeof(*p->froms)))];
toindex = *frompcindex;
if (toindex == 0) {
/*
@ -114,14 +116,14 @@ _MCOUNT_DECL(frompc, selfpc) /* _mcount; may be static, inline, etc */
/* halt further profiling */
goto overflow;
*frompcindex = toindex;
top = &p->tos[toindex];
*frompcindex = (u_short)toindex;
top = &p->tos[(size_t)toindex];
top->selfpc = selfpc;
top->count = 1;
top->link = 0;
goto done;
}
top = &p->tos[toindex];
top = &p->tos[(size_t)toindex];
if (top->selfpc == selfpc) {
/*
* arc at front of chain; usual case.
@ -147,11 +149,11 @@ _MCOUNT_DECL(frompc, selfpc) /* _mcount; may be static, inline, etc */
if (toindex >= p->tolimit)
goto overflow;
top = &p->tos[toindex];
top = &p->tos[(size_t)toindex];
top->selfpc = selfpc;
top->count = 1;
top->link = *frompcindex;
*frompcindex = toindex;
*frompcindex = (u_short)toindex;
goto done;
}
/*
@ -169,7 +171,7 @@ _MCOUNT_DECL(frompc, selfpc) /* _mcount; may be static, inline, etc */
toindex = prevtop->link;
prevtop->link = top->link;
top->link = *frompcindex;
*frompcindex = toindex;
*frompcindex = (u_short)toindex;
goto done;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: ctypeio.c,v 1.1 1997/06/02 09:52:47 kleink Exp $ */
/* $NetBSD: ctypeio.c,v 1.2 1998/11/13 15:49:03 christos Exp $ */
/*
* Copyright (c) 1997 Christos Zoulas. All rights reserved.
@ -96,14 +96,20 @@ __loadctype(name)
#endif
(void) fclose(fp);
if (_ctype_ != _C_ctype_)
if (_ctype_ != _C_ctype_) {
/* LINTED const castaway ok */
free((void *) _ctype_);
}
_ctype_ = new_ctype;
if (_toupper_tab_ != _C_toupper_)
if (_toupper_tab_ != _C_toupper_) {
/* LINTED const castaway ok */
free((void *) _toupper_tab_);
}
_toupper_tab_ = new_toupper;
if (_tolower_tab_ != _C_tolower_)
if (_tolower_tab_ != _C_tolower_) {
/* LINTED const castaway ok */
free((void *) _tolower_tab_);
}
_tolower_tab_ = new_tolower;
return 1;

View File

@ -1,4 +1,4 @@
/* $NetBSD: localeconv.c,v 1.8 1997/07/13 19:54:55 christos Exp $ */
/* $NetBSD: localeconv.c,v 1.9 1998/11/13 15:49:03 christos Exp $ */
/*
* Written by J.T. Conklin <jtc@netbsd.org>.
@ -7,7 +7,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: localeconv.c,v 1.8 1997/07/13 19:54:55 christos Exp $");
__RCSID("$NetBSD: localeconv.c,v 1.9 1998/11/13 15:49:03 christos Exp $");
#endif /* LIBC_SCCS and not lint */
#include <sys/localedef.h>
@ -55,8 +55,11 @@ localeconv()
if (__nlocale_changed) {
/* LC_NUMERIC */
/* LINTED const castaway */
ret.decimal_point = (char *) _CurrentNumericLocale->decimal_point;
/* LINTED const castaway */
ret.thousands_sep = (char *) _CurrentNumericLocale->thousands_sep;
/* LINTED const castaway */
ret.grouping = (char *) _CurrentNumericLocale->grouping;
__nlocale_changed = 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: nl_langinfo.c,v 1.5 1997/07/13 19:54:56 christos Exp $ */
/* $NetBSD: nl_langinfo.c,v 1.6 1998/11/13 15:49:04 christos Exp $ */
/*
* Written by J.T. Conklin <jtc@netbsd.org>.
@ -7,7 +7,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: nl_langinfo.c,v 1.5 1997/07/13 19:54:56 christos Exp $");
__RCSID("$NetBSD: nl_langinfo.c,v 1.6 1998/11/13 15:49:04 christos Exp $");
#endif /* LIBC_SCCS and not lint */
#include <sys/localedef.h>
@ -36,7 +36,7 @@ nl_langinfo(item)
break;
case AM_STR:
case PM_STR:
s = _CurrentTimeLocale->am_pm[item - AM_STR];
s = _CurrentTimeLocale->am_pm[(size_t)(item - AM_STR)];
break;
case DAY_1:
case DAY_2:
@ -45,7 +45,7 @@ nl_langinfo(item)
case DAY_5:
case DAY_6:
case DAY_7:
s = _CurrentTimeLocale->day[item - DAY_1];
s = _CurrentTimeLocale->day[(size_t)(item - DAY_1)];
break;
case ABDAY_1:
case ABDAY_2:
@ -54,7 +54,7 @@ nl_langinfo(item)
case ABDAY_5:
case ABDAY_6:
case ABDAY_7:
s = _CurrentTimeLocale->abday[item - ABDAY_1];
s = _CurrentTimeLocale->abday[(size_t)(item - ABDAY_1)];
break;
case MON_1:
case MON_2:
@ -68,7 +68,7 @@ nl_langinfo(item)
case MON_10:
case MON_11:
case MON_12:
s = _CurrentTimeLocale->mon[item - MON_1];
s = _CurrentTimeLocale->mon[(size_t)(item - MON_1)];
break;
case ABMON_1:
case ABMON_2:
@ -82,7 +82,7 @@ nl_langinfo(item)
case ABMON_10:
case ABMON_11:
case ABMON_12:
s = _CurrentTimeLocale->abmon[item - ABMON_1];
s = _CurrentTimeLocale->abmon[(size_t)(item - ABMON_1)];
break;
case RADIXCHAR:
s = _CurrentNumericLocale->decimal_point;
@ -110,5 +110,7 @@ nl_langinfo(item)
break;
}
/* The return value should be really const, but the interface says OW */
/* LINTED const castaway. */
return (char *) s;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: setlocale.c,v 1.15 1998/10/23 09:44:34 kleink Exp $ */
/* $NetBSD: setlocale.c,v 1.16 1998/11/13 15:49:04 christos Exp $ */
/*
* Copyright (c) 1991, 1993
@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)setlocale.c 8.1 (Berkeley) 7/4/93";
#else
__RCSID("$NetBSD: setlocale.c,v 1.15 1998/10/23 09:44:34 kleink Exp $");
__RCSID("$NetBSD: setlocale.c,v 1.16 1998/11/13 15:49:04 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -100,7 +100,8 @@ setlocale(category, locale)
int category;
const char *locale;
{
int i, len;
int i;
size_t len;
char *env, *r;
/*
@ -223,14 +224,17 @@ loadlocale(category)
switch (category) {
case LC_CTYPE:
if (_ctype_ != _C_ctype_) {
/* LINTED const castaway */
free((void *)_ctype_);
_ctype_ = _C_ctype_;
}
if (_toupper_tab_ != _C_toupper_) {
/* LINTED const castaway */
free((void *)_toupper_tab_);
_toupper_tab_ = _C_toupper_;
}
if (_tolower_tab_ != _C_tolower_) {
/* LINTED const castaway */
free((void *)_tolower_tab_);
_tolower_tab_ = _C_tolower_;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md4c.c,v 1.4 1998/10/20 17:04:45 kleink Exp $ */
/* $NetBSD: md4c.c,v 1.5 1998/11/13 15:48:29 christos Exp $ */
/*
* This file is derived from the RSA Data Security, Inc. MD4 Message-Digest
@ -130,10 +130,10 @@ MD4Update (context, input, inputLen)
const unsigned char *input; /* input block */
unsigned int inputLen; /* length of input block */
{
unsigned int i, index, partLen;
unsigned int i, idx, partLen;
/* Compute number of bytes mod 64 */
index = (unsigned int)((context->count[0] >> 3) & 0x3F);
idx = (unsigned int)((context->count[0] >> 3) & 0x3F);
/* Update number of bits */
if ((context->count[0] += ((UINT4)inputLen << 3))
@ -141,24 +141,22 @@ MD4Update (context, input, inputLen)
context->count[1]++;
context->count[1] += ((UINT4)inputLen >> 29);
partLen = 64 - index;
partLen = 64 - idx;
/* Transform as many times as possible. */
if (inputLen >= partLen) {
memcpy((POINTER)&context->buffer[index],
(POINTER)input, partLen);
memcpy(&context->buffer[idx], input, partLen);
MD4Transform(context->state, context->buffer);
for (i = partLen; i + 63 < inputLen; i += 64)
MD4Transform(context->state, &input[i]);
index = 0;
idx = 0;
} else
i = 0;
/* Buffer remaining input */
memcpy((POINTER)&context->buffer[index], (POINTER)&input[i],
inputLen - i);
memcpy(&context->buffer[idx], &input[i], inputLen - i);
}
/*
@ -171,14 +169,14 @@ MD4Final (digest, context)
MD4_CTX *context; /* context */
{
unsigned char bits[8];
unsigned int index, padLen;
unsigned int idx, padLen;
/* Save number of bits */
Encode(bits, context->count, 8);
/* Pad out to 56 mod 64. */
index = (unsigned int)((context->count[0] >> 3) & 0x3f);
padLen = (index < 56) ? (56 - index) : (120 - index);
idx = (unsigned int)((context->count[0] >> 3) & 0x3f);
padLen = (idx < 56) ? (56 - idx) : (120 - idx);
MD4Update(context, PADDING, padLen);
/* Append length (before padding) */
@ -188,7 +186,7 @@ MD4Final (digest, context)
Encode(digest, context->state, 16);
/* Zeroize sensitive information. */
memset((POINTER)context, 0, sizeof(*context));
memset(context, 0, sizeof(*context));
}
/*
@ -263,7 +261,7 @@ MD4Transform (state, block)
state[3] += d;
/* Zeroize sensitive information. */
memset((POINTER)x, 0, sizeof (x));
memset(x, 0, sizeof (x));
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: md5c.c,v 1.6 1998/10/20 17:04:45 kleink Exp $ */
/* $NetBSD: md5c.c,v 1.7 1998/11/13 15:48:29 christos Exp $ */
/*
* This file is derived from the RSA Data Security, Inc. MD5 Message-Digest
@ -192,10 +192,10 @@ MD5Update(context, input, inputLen)
const unsigned char *input; /* input block */
unsigned int inputLen; /* length of input block */
{
unsigned int i, index, partLen;
unsigned int i, idx, partLen;
/* Compute number of bytes mod 64 */
index = (unsigned int)((context->count[0] >> 3) & 0x3F);
idx = (unsigned int)((context->count[0] >> 3) & 0x3F);
/* Update number of bits */
if ((context->count[0] += ((UINT4)inputLen << 3))
@ -203,24 +203,22 @@ MD5Update(context, input, inputLen)
context->count[1]++;
context->count[1] += ((UINT4)inputLen >> 29);
partLen = 64 - index;
partLen = 64 - idx;
/* Transform as many times as possible. */
if (inputLen >= partLen) {
memcpy((POINTER)&context->buffer[index],
(POINTER)input, partLen);
memcpy(&context->buffer[idx], input, partLen);
MD5Transform(context->state, context->buffer);
for (i = partLen; i + 63 < inputLen; i += 64)
MD5Transform(context->state, &input[i]);
index = 0;
idx = 0;
} else
i = 0;
/* Buffer remaining input */
memcpy((POINTER)&context->buffer[index], (POINTER)&input[i],
inputLen - i);
memcpy(&context->buffer[idx], &input[i], inputLen - i);
}
/*
@ -233,14 +231,14 @@ MD5Final(digest, context)
MD5_CTX *context; /* context */
{
unsigned char bits[8];
unsigned int index, padLen;
unsigned int idx, padLen;
/* Save number of bits */
Encode(bits, context->count, 8);
/* Pad out to 56 mod 64. */
index = (unsigned int)((context->count[0] >> 3) & 0x3f);
padLen = (index < 56) ? (56 - index) : (120 - index);
idx = (unsigned int)((context->count[0] >> 3) & 0x3f);
padLen = (idx < 56) ? (56 - idx) : (120 - idx);
MD5Update (context, PADDING, padLen);
/* Append length (before padding) */
@ -250,7 +248,7 @@ MD5Final(digest, context)
Encode(digest, context->state, 16);
/* Zeroize sensitive information. */
ZEROIZE((POINTER)context, sizeof(*context));
ZEROIZE(context, sizeof(*context));
}
/*
@ -343,5 +341,5 @@ MD5Transform(state, block)
state[3] += d;
/* Zeroize sensitive information. */
ZEROIZE((POINTER)x, sizeof (x));
ZEROIZE(x, sizeof (x));
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: mdXhl.c,v 1.2 1997/04/30 00:40:47 thorpej Exp $ */
/* $NetBSD: mdXhl.c,v 1.3 1998/11/13 15:48:30 christos Exp $ */
/*
* ----------------------------------------------------------------------------
@ -43,7 +43,7 @@ MDNAME(End)(ctx, buf)
MDNAME(Final)(digest, ctx);
for (i = 0; i < 16; i++) {
buf[i+i] = hex[digest[i] >> 4];
buf[i+i] = hex[(u_int32_t)digest[i] >> 4];
buf[i+i+1] = hex[digest[i] & 0x0f];
}
@ -66,7 +66,7 @@ MDNAME(File)(filename, buf)
return NULL;
while ((i = read(f, buffer, sizeof(buffer))) > 0)
MDNAME(Update)(&ctx, buffer, i);
MDNAME(Update)(&ctx, buffer, (unsigned int)i);
j = errno;
close(f);

View File

@ -1,4 +1,4 @@
/* $NetBSD: base64.c,v 1.3 1997/07/13 19:57:30 christos Exp $ */
/* $NetBSD: base64.c,v 1.4 1998/11/13 15:46:52 christos Exp $ */
/*
* Copyright (c) 1996 by Internet Software Consortium.
@ -44,7 +44,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: base64.c,v 1.3 1997/07/13 19:57:30 christos Exp $");
__RCSID("$NetBSD: base64.c,v 1.4 1998/11/13 15:46:52 christos Exp $");
#endif /* LIBC_SCCS and not lint */
@ -153,9 +153,11 @@ b64_ntop(src, srclength, target, targsize)
input[2] = *src++;
srclength -= 3;
output[0] = input[0] >> 2;
output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
output[0] = (u_int32_t)input[0] >> 2;
output[1] = ((u_int32_t)(input[0] & 0x03) << 4) +
((u_int32_t)input[1] >> 4);
output[2] = ((u_int32_t)(input[1] & 0x0f) << 2) +
((u_int32_t)input[2] >> 6);
output[3] = input[2] & 0x3f;
Assert(output[0] < 64);
Assert(output[1] < 64);
@ -177,9 +179,11 @@ b64_ntop(src, srclength, target, targsize)
for (i = 0; i < srclength; i++)
input[i] = *src++;
output[0] = input[0] >> 2;
output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
output[0] = (u_int32_t)input[0] >> 2;
output[1] = ((u_int32_t)(input[0] & 0x03) << 4) +
((u_int32_t)input[1] >> 4);
output[2] = ((u_int32_t)(input[1] & 0x0f) << 2) +
((u_int32_t)input[2] >> 6);
Assert(output[0] < 64);
Assert(output[1] < 64);
Assert(output[2] < 64);
@ -242,7 +246,8 @@ b64_pton(src, target, targsize)
if (target) {
if (tarindex + 1 >= targsize)
return (-1);
target[tarindex] |= (pos - Base64) >> 4;
target[tarindex] |=
(u_int32_t)(pos - Base64) >> 4;
target[tarindex+1] = ((pos - Base64) & 0x0f)
<< 4 ;
}
@ -253,8 +258,9 @@ b64_pton(src, target, targsize)
if (target) {
if (tarindex + 1 >= targsize)
return (-1);
target[tarindex] |= (pos - Base64) >> 2;
target[tarindex+1] = ((pos - Base64) & 0x03)
target[tarindex] |=
(u_int32_t)(pos - Base64) >> 2;
target[tarindex+1] = ((pos - Base64) & 0x03)
<< 6;
}
tarindex++;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ethers.c,v 1.13 1998/07/26 13:14:04 mycroft Exp $ */
/* $NetBSD: ethers.c,v 1.14 1998/11/13 15:46:53 christos Exp $ */
/*
* ethers(3N) a la Sun.
@ -116,7 +116,7 @@ ether_ntohost(hostname, e)
}
#endif
if (ether_line(p, &try, hostname) == 0 &&
memcmp((char *)&try, (char *)e, sizeof try) == 0) {
memcmp(&try, e, sizeof try) == 0) {
(void)fclose(f);
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: gethnamaddr.c,v 1.7 1998/10/15 10:22:23 kleink Exp $ */
/* $NetBSD: gethnamaddr.c,v 1.8 1998/11/13 15:46:53 christos Exp $ */
/*
* ++Copyright++ 1985, 1988, 1993
@ -61,7 +61,7 @@
static char sccsid[] = "@(#)gethostnamadr.c 8.1 (Berkeley) 6/4/93";
static char rcsid[] = "Id: gethnamaddr.c,v 8.21 1997/06/01 20:34:37 vixie Exp ";
#else
__RCSID("$NetBSD: gethnamaddr.c,v 1.7 1998/10/15 10:22:23 kleink Exp $");
__RCSID("$NetBSD: gethnamaddr.c,v 1.8 1998/11/13 15:46:53 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -409,7 +409,7 @@ getanswer(answer, anslen, qname, qtype)
buflen -= nn;
}
bp += sizeof(align) - ((u_long)bp % sizeof(align));
bp += sizeof(align) - (size_t)((u_long)bp % sizeof(align));
if (bp + n >= &hostbuf[sizeof hostbuf]) {
dprintf("size (%d) too big\n", n);
@ -676,7 +676,7 @@ gethostbyaddr(addr, len, af)
for (n = IN6ADDRSZ - 1; n >= 0; n--) {
qp += sprintf(qp, "%x.%x.",
uaddr[n] & 0xf,
(uaddr[n] >> 4) & 0xf);
((u_int32_t)uaddr[n] >> 4) & 0xf);
}
strcpy(qp, "ip6.int");
break;
@ -697,7 +697,7 @@ gethostbyaddr(addr, len, af)
break;
#endif
case 'b':
n = res_query(qbuf, C_IN, T_PTR, (u_char *)&buf,
n = res_query(qbuf, C_IN, T_PTR, (u_char *)(void *)&buf,
sizeof(buf));
if (n < 0) {
dprintf("res_query failed (%d)\n", n);
@ -898,7 +898,7 @@ map_v4v6_hostent(hp, bpp, lenp)
hp->h_addrtype = AF_INET6;
hp->h_length = IN6ADDRSZ;
for (ap = hp->h_addr_list; *ap; ap++) {
int i = sizeof(align) - ((u_long)*bpp % sizeof(align));
int i = sizeof(align) - (size_t)((u_long)*bpp % sizeof(align));
if (*lenp < (i + IN6ADDRSZ)) {
/* Out of memory. Truncate address list here. XXX */
@ -929,7 +929,7 @@ addrsort(ap, num)
for (i = 0; i < num; i++, p++) {
for (j = 0 ; (unsigned)j < _res.nsort; j++)
if (_res.sort_list[j].addr.s_addr ==
(((struct in_addr *)(*p))->s_addr & _res.sort_list[j].mask))
(((struct in_addr *)(void *)(*p))->s_addr & _res.sort_list[j].mask))
break;
aval[i] = j;
if (needsort == 0 && i > 0 && j < aval[i-1])
@ -1040,7 +1040,7 @@ nextline:
}
*cp++ = '\0';
*hap++ = (char *)buf;
*hap++ = (char *)(void *)buf;
(void) inet_aton(p, buf++);
while (*cp == ' ' || *cp == '\t')
@ -1083,6 +1083,7 @@ done:
return (&host);
}
/* ARGSUSED */
struct hostent *
_yp_gethtbyaddr(addr, len, type)
const char *addr;
@ -1106,7 +1107,7 @@ _yp_gethtbyaddr(addr, len, type)
free(__ypcurrent);
__ypcurrent = NULL;
r = yp_match(__ypdomain, "hosts.byaddr", name,
strlen(name), &__ypcurrent, &__ypcurrentlen);
(int)strlen(name), &__ypcurrent, &__ypcurrentlen);
if (r==0)
hp = _yphostent(__ypcurrent);
if (hp==NULL)
@ -1130,7 +1131,7 @@ _yp_gethtbyname(name)
free(__ypcurrent);
__ypcurrent = NULL;
r = yp_match(__ypdomain, "hosts.byname", name,
strlen(name), &__ypcurrent, &__ypcurrentlen);
(int)strlen(name), &__ypcurrent, &__ypcurrentlen);
if (r==0)
hp = _yphostent(__ypcurrent);
if (hp==NULL)

View File

@ -1,4 +1,4 @@
/* $NetBSD: getnetnamadr.c,v 1.5 1998/01/06 05:01:19 perry Exp $ */
/* $NetBSD: getnetnamadr.c,v 1.6 1998/11/13 15:46:53 christos Exp $ */
/* Copyright (c) 1993 Carlos Leandro and Rui Salgueiro
* Dep. Matematica Universidade de Coimbra, Portugal, Europe
@ -47,7 +47,7 @@ static char sccsid[] = "@(#)getnetbyaddr.c 8.1 (Berkeley) 6/4/93";
static char sccsid_[] = "from getnetnamadr.c 1.4 (Coimbra) 93/06/03";
static char rcsid[] = "Id: getnetnamadr.c,v 8.8 1997/06/01 20:34:37 vixie Exp ";
#else
__RCSID("$NetBSD: getnetnamadr.c,v 1.5 1998/01/06 05:01:19 perry Exp $");
__RCSID("$NetBSD: getnetnamadr.c,v 1.6 1998/11/13 15:46:53 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -197,8 +197,8 @@ static char *net_aliases[MAXALIASES], netbuf[PACKETSZ];
if (nchar != 1 || *in != '0' || flag) {
flag = 1;
(void)strncpy(paux1,
(i==0) ? in : in-1,
(i==0) ?nchar : nchar+1);
(i==0) ? in : in-1,
(size_t)((i==0) ? nchar : nchar+1));
paux1[(i==0) ? nchar : nchar+1] = '\0';
pauxt = paux2;
paux2 = strcat(paux1, paux2);
@ -246,7 +246,7 @@ getnetbyaddr(net, net_type)
switch (lookups[i]) {
case 'b':
for (nn = 4, net2 = net; net2; net2 >>= 8)
netbr[--nn] = net2 & 0xff;
netbr[--nn] = (unsigned int)(net2 & 0xff);
switch (nn) {
case 3: /* Class A */
sprintf(qbuf, "0.0.0.%u.in-addr.arpa",
@ -265,8 +265,8 @@ getnetbyaddr(net, net_type)
netbr[3], netbr[2], netbr[1], netbr[0]);
break;
}
anslen = res_query(qbuf, C_IN, T_PTR, (u_char *)&buf,
sizeof(buf));
anslen = res_query(qbuf, C_IN, T_PTR,
(u_char *)(void *)&buf, sizeof(buf));
if (anslen < 0) {
#ifdef DEBUG
if (_res.options & RES_DEBUG)
@ -277,7 +277,7 @@ getnetbyaddr(net, net_type)
net_entry = getnetanswer(&buf, anslen, BYADDR);
if (net_entry) {
/* maybe net should be unsigned? */
unsigned u_net = net;
unsigned long u_net = net;
/* Strip trailing zeros */
while ((u_net & 0xff) == 0 && u_net != 0)
@ -320,8 +320,8 @@ getnetbyname(net)
switch (lookups[i]) {
case 'b':
strcpy(&qbuf[0], net);
anslen = res_search(qbuf, C_IN, T_PTR, (u_char *)&buf,
sizeof(buf));
anslen = res_search(qbuf, C_IN, T_PTR,
(u_char *)(void *)&buf, sizeof(buf));
if (anslen < 0) {
#ifdef DEBUG
if (_res.options & RES_DEBUG)

View File

@ -1,4 +1,4 @@
/* $NetBSD: herror.c,v 1.12 1998/10/16 20:26:03 kleink Exp $ */
/* $NetBSD: herror.c,v 1.13 1998/11/13 15:46:53 christos Exp $ */
/*-
* Copyright (c) 1987, 1993
@ -59,7 +59,7 @@
static char rcsid[] = "Id: herror.c,v 8.3 1996/08/05 08:31:35 vixie Exp ";
static char sccsid[] = "@(#)herror.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: herror.c,v 1.12 1998/10/16 20:26:03 kleink Exp $");
__RCSID("$NetBSD: herror.c,v 1.13 1998/11/13 15:46:53 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -97,6 +97,7 @@ herror(s)
register struct iovec *v = iov;
if (s && *s) {
/* LINTED base does not get written */
v->iov_base = (char *)s;
v->iov_len = strlen(s);
v++;
@ -104,6 +105,7 @@ herror(s)
v->iov_len = 2;
v++;
}
/* LINTED base does not get written */
v->iov_base = (char *)hstrerror(h_errno);
v->iov_len = strlen(v->iov_base);
v++;

View File

@ -1,4 +1,4 @@
/* $NetBSD: inet_makeaddr.c,v 1.6 1997/07/21 14:08:02 jtc Exp $ */
/* $NetBSD: inet_makeaddr.c,v 1.7 1998/11/13 15:46:53 christos Exp $ */
/*
* Copyright (c) 1983, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)inet_makeaddr.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: inet_makeaddr.c,v 1.6 1997/07/21 14:08:02 jtc Exp $");
__RCSID("$NetBSD: inet_makeaddr.c,v 1.7 1998/11/13 15:46:53 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -69,6 +69,6 @@ inet_makeaddr(net, host)
addr = (net << IN_CLASSC_NSHIFT) | (host & IN_CLASSC_HOST);
else
addr = net | host;
addr = htonl(addr);
return (*(struct in_addr *)&addr);
addr = htonl((u_int32_t)addr);
return (*(struct in_addr *)(void *)&addr);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: inet_net_pton.c,v 1.7 1998/01/06 05:01:21 perry Exp $ */
/* $NetBSD: inet_net_pton.c,v 1.8 1998/11/13 15:46:54 christos Exp $ */
/*
* Copyright (c) 1996 by Internet Software Consortium.
@ -22,7 +22,7 @@
#if 0
static const char rcsid[] = "Id: inet_net_pton.c,v 8.3 1996/11/11 06:36:52 vixie Exp ";
#else
__RCSID("$NetBSD: inet_net_pton.c,v 1.7 1998/01/06 05:01:21 perry Exp $");
__RCSID("$NetBSD: inet_net_pton.c,v 1.8 1998/11/13 15:46:54 christos Exp $");
#endif
#endif
@ -113,7 +113,8 @@ inet_net_pton_ipv4(src, dst, size)
if (ch == '0' && (src[0] == 'x' || src[0] == 'X')
&& isascii(src[1]) && isxdigit(src[1])) {
/* Hexadecimal: Eat nybble string. */
if (size <= 0)
/* size is unsigned */
if (size == 0)
goto emsgsize;
*dst = 0, dirty = 0;
src++; /* skip x or X. */
@ -146,7 +147,7 @@ inet_net_pton_ipv4(src, dst, size)
goto enoent;
} while ((ch = *src++) != '\0' &&
isascii(ch) && isdigit(ch));
if (size-- <= 0)
if (size-- == 0)
goto emsgsize;
*dst++ = (u_char) tmp;
if (ch == '\0' || ch == '/')
@ -203,7 +204,8 @@ inet_net_pton_ipv4(src, dst, size)
}
/* Extend network to cover the actual mask. */
while (bits > ((dst - odst) * 8)) {
if (size-- <= 0)
/* size is unsigned */
if (size-- == 0)
goto emsgsize;
*dst++ = '\0';
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: inet_neta.c,v 1.7 1998/01/06 05:01:22 perry Exp $ */
/* $NetBSD: inet_neta.c,v 1.8 1998/11/13 15:46:54 christos Exp $ */
/*
* Copyright (c) 1996 by Internet Software Consortium.
@ -22,7 +22,7 @@
#if 0
static const char rcsid[] = "Id: inet_neta.c,v 8.2 1996/08/08 06:54:44 vixie Exp ";
#else
__RCSID("$NetBSD: inet_neta.c,v 1.7 1998/01/06 05:01:22 perry Exp $");
__RCSID("$NetBSD: inet_neta.c,v 1.8 1998/11/13 15:46:54 christos Exp $");
#endif
#endif
@ -67,7 +67,7 @@ inet_neta(src, dst, size)
char *tp;
while (src & 0xffffffff) {
u_char b = (src & 0xff000000) >> 24;
u_char b = (u_char)((src & 0xff000000) >> 24);
src <<= 8;
if (b) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: inet_ntoa.c,v 1.6 1997/07/21 14:08:07 jtc Exp $ */
/* $NetBSD: inet_ntoa.c,v 1.7 1998/11/13 15:46:54 christos Exp $ */
/*
* Copyright (c) 1983, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)inet_ntoa.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: inet_ntoa.c,v 1.6 1997/07/21 14:08:07 jtc Exp $");
__RCSID("$NetBSD: inet_ntoa.c,v 1.7 1998/11/13 15:46:54 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -63,7 +63,7 @@ inet_ntoa(in)
static char b[18];
register char *p;
p = (char *)&in;
p = (char *)(void *)&in;
#define UC(b) (((int)b)&0xff)
(void)snprintf(b, sizeof(b),
"%d.%d.%d.%d", UC(p[0]), UC(p[1]), UC(p[2]), UC(p[3]));

View File

@ -1,4 +1,4 @@
/* $NetBSD: inet_pton.c,v 1.8 1998/10/13 21:03:31 kleink Exp $ */
/* $NetBSD: inet_pton.c,v 1.9 1998/11/13 15:46:54 christos Exp $ */
/* Copyright (c) 1996 by Internet Software Consortium.
*
@ -21,7 +21,7 @@
#if 0
static char rcsid[] = "Id: inet_pton.c,v 8.7 1996/08/05 08:31:35 vixie Exp ";
#else
__RCSID("$NetBSD: inet_pton.c,v 1.8 1998/10/13 21:03:31 kleink Exp $");
__RCSID("$NetBSD: inet_pton.c,v 1.9 1998/11/13 15:46:54 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -293,7 +293,7 @@ inet_addr(cp)
{
struct in_addr val;
if (inet_pton4(cp, (u_char *) &val.s_addr))
if (inet_pton4(cp, (u_char *)(void *)&val.s_addr))
return (val.s_addr);
return (INADDR_NONE);
}
@ -310,5 +310,5 @@ inet_aton(cp, addr)
register const char *cp;
struct in_addr *addr;
{
return inet_pton4(cp, (u_char *) &addr->s_addr);
return inet_pton4(cp, (u_char *)(void *)&addr->s_addr);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: iso_addr.c,v 1.7 1998/10/15 10:22:23 kleink Exp $ */
/* $NetBSD: iso_addr.c,v 1.8 1998/11/13 15:46:55 christos Exp $ */
/*
* Copyright (c) 1989, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)iso_addr.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: iso_addr.c,v 1.7 1998/10/15 10:22:23 kleink Exp $");
__RCSID("$NetBSD: iso_addr.c,v 1.8 1998/11/13 15:46:55 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -107,7 +107,7 @@ iso_ntoa(isoa)
{
static char obuf[64];
register char *out = obuf;
register int i;
register size_t i;
register u_char *in = (u_char *)isoa->isoa_genaddr;
u_char *inlim = in + isoa->isoa_len;

View File

@ -1,4 +1,4 @@
/* $NetBSD: linkaddr.c,v 1.8 1998/10/15 10:22:23 kleink Exp $ */
/* $NetBSD: linkaddr.c,v 1.9 1998/11/13 15:46:55 christos Exp $ */
/*-
* Copyright (c) 1990, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)linkaddr.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: linkaddr.c,v 1.8 1998/10/15 10:22:23 kleink Exp $");
__RCSID("$NetBSD: linkaddr.c,v 1.9 1998/11/13 15:46:55 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -64,7 +64,7 @@ link_addr(addr, sdl)
register struct sockaddr_dl *sdl;
{
register char *cp = sdl->sdl_data;
char *cplim = sdl->sdl_len + (char *)sdl;
char *cplim = sdl->sdl_len + (char *)(void *)sdl;
register int byte = 0, state = NAMING;
register int newaddr = 0; /* pacify gcc */
@ -122,7 +122,7 @@ link_addr(addr, sdl)
break;
} while (cp < cplim);
sdl->sdl_alen = cp - LLADDR(sdl);
newaddr = cp - (char *)sdl;
newaddr = cp - (char *)(void *)sdl;
if (newaddr > sizeof(*sdl))
sdl->sdl_len = newaddr;
return;
@ -136,7 +136,7 @@ link_ntoa(sdl)
{
static char obuf[64];
register char *out = obuf;
register int i;
register size_t i;
register u_char *in = (u_char *)LLADDR(sdl);
u_char *inlim = in + sdl->sdl_alen;
int firsttime = 1;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ns_addr.c,v 1.7 1997/07/18 04:55:57 thorpej Exp $ */
/* $NetBSD: ns_addr.c,v 1.8 1998/11/13 15:46:55 christos Exp $ */
/*
* Copyright (c) 1986, 1993
@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)ns_addr.c 8.1 (Berkeley) 6/7/93";
#else
__RCSID("$NetBSD: ns_addr.c,v 1.7 1997/07/18 04:55:57 thorpej Exp $");
__RCSID("$NetBSD: ns_addr.c,v 1.8 1998/11/13 15:46:55 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -93,7 +93,7 @@ ns_addr(name)
socketname = strchr(hostname, separator);
if (socketname) {
*socketname++ = 0;
Field(socketname, (u_int8_t *)&addr.x_port, 2);
Field(socketname, (u_int8_t *)(void *)&addr.x_port, 2);
}
Field(hostname, addr.x_host.c_host, 6);
@ -172,7 +172,7 @@ Field(buf, out, len)
case 'h': case 'H':
base16 = 1;
/* fall into */
/* FALLTHROUGH */
default:
*--bp = 0; /* Ends Loop */
@ -224,10 +224,11 @@ cvtbase(oldbase,newbase,input,inlen,result,reslen)
while (d < inlen) {
sum = sum*oldbase + (long) input[d];
e += (sum > 0);
input[d++] = sum / newbase;
input[d++] = (int) (sum / newbase);
sum %= newbase;
}
result[--reslen] = sum; /* accumulate remainder */
/* accumulate remainder */
result[--reslen] = (unsigned char)sum;
}
for (d=0; d < reslen; d++)
result[d] = 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ns_ntoa.c,v 1.7 1997/07/18 04:55:59 thorpej Exp $ */
/* $NetBSD: ns_ntoa.c,v 1.8 1998/11/13 15:46:55 christos Exp $ */
/*
* Copyright (c) 1986, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)ns_ntoa.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: ns_ntoa.c,v 1.7 1997/07/18 04:55:59 thorpej Exp $");
__RCSID("$NetBSD: ns_ntoa.c,v 1.8 1998/11/13 15:46:55 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -92,17 +92,18 @@ spectHex(p0)
int ok = 0;
int nonzero = 0;
register char *p = p0;
for (; *p; p++) switch (*p) {
case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
*p += ('A' - 'a');
/* fall into . . . */
case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
ok = 1;
case '1': case '2': case '3': case '4': case '5':
case '6': case '7': case '8': case '9':
nonzero = 1;
}
for (; *p; p++)
switch (*p) {
case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
*p += ('A' - 'a');
/* FALLTHROUGH */
case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
ok = 1;
/* FALLTHROUGH */
case '1': case '2': case '3': case '4': case '5':
case '6': case '7': case '8': case '9':
nonzero = 1;
}
if (nonzero && !ok) { *p++ = 'H'; *p = 0; }
return (p);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: nsap_addr.c,v 1.6 1998/01/06 05:01:24 perry Exp $ */
/* $NetBSD: nsap_addr.c,v 1.7 1998/11/13 15:46:55 christos Exp $ */
/*
* Copyright (c) 1989, 1993
@ -53,7 +53,7 @@
#if 0
static char rcsid[] = "Id: nsap_addr.c,v 8.3 1996/08/05 08:31:35 vixie Exp ";
#else
__RCSID("$NetBSD: nsap_addr.c,v 1.6 1998/01/06 05:01:24 perry Exp $");
__RCSID("$NetBSD: nsap_addr.c,v 1.7 1998/11/13 15:46:55 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -143,7 +143,7 @@ inet_nsap_ntoa(binlen, binary, ascii)
binlen = 255;
for (i = 0; i < binlen; i++) {
nib = *binary >> 4;
nib = (u_int32_t)*binary >> 4;
*ascii++ = nib + (nib < 10 ? '0' : '7');
nib = *binary++ & 0x0f;
*ascii++ = nib + (nib < 10 ? '0' : '7');

View File

@ -1,4 +1,4 @@
/* $NetBSD: rcmd.c,v 1.27 1998/10/18 14:22:05 christos Exp $ */
/* $NetBSD: rcmd.c,v 1.28 1998/11/13 15:46:56 christos Exp $ */
/*
* Copyright (c) 1997 Matthew R. Green.
@ -39,7 +39,7 @@
#if 0
static char sccsid[] = "@(#)rcmd.c 8.3 (Berkeley) 3/26/94";
#else
__RCSID("$NetBSD: rcmd.c,v 1.27 1998/10/18 14:22:05 christos Exp $");
__RCSID("$NetBSD: rcmd.c,v 1.28 1998/11/13 15:46:56 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -71,12 +71,12 @@ __RCSID("$NetBSD: rcmd.c,v 1.27 1998/10/18 14:22:05 christos Exp $");
#include "pathnames.h"
int orcmd __P((char **, u_short, const char *, const char *, const char *,
int orcmd __P((char **, u_int, const char *, const char *, const char *,
int *));
int __ivaliduser __P((FILE *, u_int32_t, const char *, const char *));
static int rshrcmd __P((char **, u_short, const char *, const char *,
static int rshrcmd __P((char **, u_int32_t, const char *, const char *,
const char *, int *, const char *));
static int hprcmd __P((struct hostent *, char **, u_short, const char *,
static int hprcmd __P((struct hostent *, char **, u_int32_t, const char *,
const char *, const char *, int *));
static int __icheckhost __P((u_int32_t, const char *));
static char *__gethostloop __P((u_int32_t));
@ -119,7 +119,7 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
int
orcmd(ahost, rport, locuser, remuser, cmd, fd2p)
char **ahost;
u_short rport;
u_int rport;
const char *locuser, *remuser, *cmd;
int *fd2p;
{
@ -139,7 +139,7 @@ static int
hprcmd(hp, ahost, rport, locuser, remuser, cmd, fd2p)
struct hostent *hp;
char **ahost;
u_short rport;
u_int32_t rport;
const char *locuser, *remuser, *cmd;
int *fd2p;
{
@ -172,8 +172,9 @@ hprcmd(hp, ahost, rport, locuser, remuser, cmd, fd2p)
#endif
sin.sin_family = hp->h_addrtype;
sin.sin_port = rport;
memmove(&sin.sin_addr, hp->h_addr_list[0], hp->h_length);
if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) >= 0)
memmove(&sin.sin_addr,
hp->h_addr_list[0], (size_t)hp->h_length);
if (connect(s, (struct sockaddr *)(void *)&sin, sizeof(sin)) >= 0)
break;
(void)close(s);
if (errno == EADDRINUSE) {
@ -181,7 +182,7 @@ hprcmd(hp, ahost, rport, locuser, remuser, cmd, fd2p)
continue;
}
if (errno == ECONNREFUSED && timo <= 16) {
(void)sleep(timo);
(void)sleep((unsigned int)timo);
timo *= 2;
continue;
}
@ -194,7 +195,7 @@ hprcmd(hp, ahost, rport, locuser, remuser, cmd, fd2p)
perror(0);
hp->h_addr_list++;
memmove(&sin.sin_addr, hp->h_addr_list[0],
hp->h_length);
(size_t)hp->h_length);
(void)fprintf(stderr, "Trying %s...\n",
inet_ntoa(sin.sin_addr));
continue;
@ -235,7 +236,7 @@ hprcmd(hp, ahost, rport, locuser, remuser, cmd, fd2p)
(void)close(s2);
goto bad;
}
s3 = accept(s2, (struct sockaddr *)&from, &len);
s3 = accept(s2, (struct sockaddr *)(void *)&from, &len);
(void)close(s2);
if (s3 < 0) {
warn("rcmd: accept");
@ -281,10 +282,11 @@ bad:
/*
* based on code written by Chris Siebenmann <cks@utcc.utoronto.ca>
*/
/* ARGSUSED */
static int
rshrcmd(ahost, rport, locuser, remuser, cmd, fd2p, rshcmd)
char **ahost;
u_short rport;
u_int32_t rport;
const char *locuser, *remuser, *cmd;
int *fd2p;
const char *rshcmd;
@ -671,7 +673,8 @@ __ivaliduser(hostf, raddr, luser, ruser)
break;
default:
userok = -(strcmp(ruser, &auser[1]) == 0);
userok =
-(strcmp(ruser, &auser[1]) == 0 ? 1 : 0);
break;
}
else
@ -734,7 +737,7 @@ __gethostloop(raddr)
struct hostent *hp;
struct in_addr in;
hp = gethostbyaddr((char *) &raddr, sizeof(raddr), AF_INET);
hp = gethostbyaddr((char *)(void *)&raddr, sizeof(raddr), AF_INET);
if (hp == NULL)
return (NULL);
@ -749,7 +752,7 @@ __gethostloop(raddr)
return (NULL);
for (; hp->h_addr_list[0] != NULL; hp->h_addr_list++)
if (!memcmp(hp->h_addr_list[0], (caddr_t)&raddr, sizeof(raddr)))
if (!memcmp(hp->h_addr_list[0], &raddr, sizeof(raddr)))
return (remotehost);
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: res_comp.c,v 1.12 1998/10/15 09:28:13 kleink Exp $ */
/* $NetBSD: res_comp.c,v 1.13 1998/11/13 15:46:56 christos Exp $ */
/*-
* Copyright (c) 1985, 1993
@ -59,7 +59,7 @@
static char sccsid[] = "@(#)res_comp.c 8.1 (Berkeley) 6/4/93";
static char rcsid[] = "Id: res_comp.c,v 8.12 1997/06/01 20:34:37 vixie Exp ";
#else
__RCSID("$NetBSD: res_comp.c,v 1.12 1998/10/15 09:28:13 kleink Exp $");
__RCSID("$NetBSD: res_comp.c,v 1.13 1998/11/13 15:46:56 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -77,7 +77,7 @@ __RCSID("$NetBSD: res_comp.c,v 1.12 1998/10/15 09:28:13 kleink Exp $");
__weak_alias(dn_expand,_dn_expand);
#endif
static int dn_find __P((u_char *, u_char *, u_char **, u_char **));
static int dn_find __P((const u_char *, u_char *, u_char **, u_char **));
static int mklower __P((int));
/*
@ -178,12 +178,13 @@ dn_comp(exp_dn, comp_dn, length, dnptrs, lastdnptr)
u_char *comp_dn, **dnptrs, **lastdnptr;
int length;
{
register u_char *cp, *dn;
register int c, l;
u_char *cp;
const u_char *dn;
int c, l;
u_char **cpp, **lpp, *sp, *eob;
u_char *msg;
dn = (u_char *)exp_dn;
dn = (const u_char *)exp_dn;
cp = comp_dn;
if (length > MAXCDNAME)
length = MAXCDNAME;
@ -203,7 +204,7 @@ dn_comp(exp_dn, comp_dn, length, dnptrs, lastdnptr)
if ((l = dn_find(dn-1, msg, dnptrs, lpp)) >= 0) {
if (cp+1 >= eob)
return (-1);
*cp++ = (l >> 8) | INDIR_MASK;
*cp++ = ((u_int32_t)l >> 8) | INDIR_MASK;
*cp++ = l % 256;
return (cp - comp_dn);
}
@ -300,10 +301,12 @@ mklower(ch)
*/
static int
dn_find(exp_dn, msg, dnptrs, lastdnptr)
u_char *exp_dn, *msg;
const u_char *exp_dn;
u_char *msg;
u_char **dnptrs, **lastdnptr;
{
register u_char *dn, *cp, **cpp;
const u_char *dn;
u_char *cp, **cpp;
register int n;
u_char *sp;
@ -376,7 +379,7 @@ int
res_hnok(dn)
const char *dn;
{
int ppch = '\0', pch = PERIOD, ch = *dn++;
int pch = PERIOD, ch = *dn++;
while (ch != '\0') {
int nch = *dn++;
@ -393,7 +396,7 @@ res_hnok(dn)
if (!middlechar(ch))
return (0);
}
ppch = pch, pch = ch, ch = nch;
pch = ch, ch = nch;
}
return (1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: res_debug.c,v 1.21 1998/10/15 10:22:24 kleink Exp $ */
/* $NetBSD: res_debug.c,v 1.22 1998/11/13 15:46:56 christos Exp $ */
/*-
* Copyright (c) 1985, 1990, 1993
@ -81,7 +81,7 @@
static char sccsid[] = "@(#)res_debug.c 8.1 (Berkeley) 6/4/93";
static char rcsid[] = "Id: res_debug.c,v 8.20 1997/06/01 20:34:37 vixie Exp ";
#else
__RCSID("$NetBSD: res_debug.c,v 1.21 1998/10/15 10:22:24 kleink Exp $");
__RCSID("$NetBSD: res_debug.c,v 1.22 1998/11/13 15:46:56 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -107,7 +107,7 @@ static char *dewks __P((int));
static const char *deproto __P((int));
static const u_char *do_rrset __P((const u_char *, int, const u_char *,
int, int, FILE *, const char *));
static const char *precsize_ntoa __P((u_int8_t));
static const char *precsize_ntoa __P((u_int32_t));
static u_int8_t precsize_aton __P((const char **));
static u_int32_t latlon2ul __P((const char **, int *));
@ -231,7 +231,7 @@ do_rrset(msg, len, cp, cnt, pflag, file, hs)
/*
* Print answer records.
*/
sflag = (_res.pfcode & pflag);
sflag = (int)(_res.pfcode & pflag);
if ((n = ntohs(cnt)) != 0) {
if ((!_res.pfcode) || ((sflag) && (_res.pfcode & RES_PRF_HEAD1)))
fprintf(file, hs);
@ -244,7 +244,7 @@ do_rrset(msg, len, cp, cnt, pflag, file, hs)
cp += sizeof(u_int16_t);
cp += sizeof(u_int16_t);
cp += sizeof(u_int32_t);
dlen = _getshort((u_char*)cp);
dlen = _getshort((const u_char *)cp);
cp += sizeof(u_int16_t);
cp += dlen;
}
@ -307,7 +307,7 @@ __fp_nquery(msg, len, file)
/*
* Print header fields.
*/
hp = (HEADER *)msg;
hp = (const HEADER *)(const void *)msg;
cp = msg + HFIXEDSZ;
endMark = msg + len;
if ((!_res.pfcode) || (_res.pfcode & RES_PRF_HEADX) || hp->rcode) {
@ -361,25 +361,25 @@ __fp_nquery(msg, len, file)
if ((!_res.pfcode) || (_res.pfcode & RES_PRF_QUES))
cp = p_cdnname(cp, msg, len, file);
else {
int n;
int nn;
char name[MAXDNAME];
if ((n = dn_expand(msg, msg+len, cp, name,
if ((nn = dn_expand(msg, msg+len, cp, name,
sizeof name)) < 0)
cp = NULL;
else
cp += n;
cp += nn;
}
ErrorTest(cp);
TruncTest(cp);
if ((!_res.pfcode) || (_res.pfcode & RES_PRF_QUES))
fprintf(file, ", type = %s",
__p_type(_getshort((u_char*)cp)));
__p_type(_getshort((const u_char*)cp)));
cp += INT16SZ;
TruncTest(cp);
if ((!_res.pfcode) || (_res.pfcode & RES_PRF_QUES))
fprintf(file, ", class = %s\n",
__p_class(_getshort((u_char*)cp)));
__p_class(_getshort((const u_char*)cp)));
cp += INT16SZ;
if ((!_res.pfcode) || (_res.pfcode & RES_PRF_QUES))
putc('\n', file);
@ -680,17 +680,17 @@ __p_rr(cp, msg, file)
break;
case T_AAAA: {
char t[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"];
char tt[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"];
fprintf(file, "\t%s", inet_ntop(AF_INET6, cp, t, sizeof t));
fprintf(file, "\t%s", inet_ntop(AF_INET6, cp, tt, sizeof tt));
cp += dlen;
break;
}
case T_LOC: {
char t[255];
char tt[255];
fprintf(file, "\t%s", loc_ntoa(cp, t));
fprintf(file, "\t%s", loc_ntoa(cp, tt));
cp += dlen;
break;
}
@ -742,7 +742,7 @@ __p_rr(cp, msg, file)
case T_UINFO:
putc('\t', file);
fputs(cp, file);
fputs((char *)cp, file);
cp += dlen;
break;
@ -791,7 +791,7 @@ __p_rr(cp, msg, file)
fprintf(file," %u", *cp++); /* protocol */
fprintf(file," %u (", *cp++); /* algorithm */
n = b64_ntop(cp, (cp1 + dlen) - cp,
n = b64_ntop(cp, (size_t)((cp1 + dlen) - cp),
base64_key, sizeof base64_key);
for (c = 0; c < n; ++c) {
if (0 == (c & 0x3F))
@ -807,7 +807,7 @@ __p_rr(cp, msg, file)
break;
case T_SIG:
type = _getshort((u_char*)cp);
type = _getshort((const u_char *)cp);
cp += INT16SZ;
fprintf(file, " %s", p_type(type));
fprintf(file, "\t%d", *cp++); /* algorithm */
@ -818,23 +818,24 @@ __p_rr(cp, msg, file)
fprintf(file, "\t; LABELS WRONG (%d should be %d)\n\t",
n, c);
/* orig ttl */
n = _getlong((u_char*)cp);
n = _getlong((const u_char *)cp);
if (n != tmpttl)
fprintf(file, " %u", n);
cp += INT32SZ;
/* sig expire */
fprintf(file, " (\n\t%s",
__p_secstodate(_getlong((u_char*)cp)));
__p_secstodate(_getlong((const u_char *)cp)));
cp += INT32SZ;
/* time signed */
fprintf(file, " %s", __p_secstodate(_getlong((u_char*)cp)));
fprintf(file, " %s",
__p_secstodate(_getlong((const u_char *)cp)));
cp += INT32SZ;
/* sig footprint */
fprintf(file," %u ", _getshort((u_char*)cp));
fprintf(file," %u ", _getshort((const u_char *)cp));
cp += INT16SZ;
/* signer's name */
cp = p_fqname(cp, msg, file);
n = b64_ntop(cp, (cp1 + dlen) - cp,
n = b64_ntop(cp, (size_t)((cp1 + dlen) - cp),
base64_key, sizeof base64_key);
for (c = 0; c < n; c++) {
if (0 == (c & 0x3F))
@ -1072,7 +1073,8 @@ __p_time(value)
u_int32_t value;
{
static char nbuf[40];
int secs, mins, hours, days, len = sizeof nbuf;
int secs, mins, hours, days;
size_t len = sizeof nbuf;
register char *p;
if (value == 0) {
@ -1136,7 +1138,7 @@ static const unsigned int poweroften[10] = {1, 10, 100, 1000, 10000, 100000,
/* takes an XeY precision/size value, returns a string representation. */
static const char *
precsize_ntoa(prec)
u_int8_t prec;
u_int32_t prec;
{
static char retbuf[sizeof "90000000.00"];
unsigned long val;
@ -1157,11 +1159,11 @@ precsize_aton(strptr)
const char **strptr;
{
u_int8_t retval = 0;
char *cp;
const char *cp;
int exponent = 0;
int mantissa = 0;
cp = (char *)*strptr;
cp = (const char *)*strptr;
while (isdigit(*cp)) {
if (mantissa == 0)
mantissa = *cp - '0';
@ -1416,7 +1418,7 @@ loc_ntoa(binary, ascii)
const u_char *binary;
char *ascii;
{
static const char *const error = "?";
static char *error = "?";
register const u_char *cp = binary;
int latdeg, latmin, latsec, latsecfrac;
@ -1430,7 +1432,7 @@ loc_ntoa(binary, ascii)
u_int32_t templ;
u_int8_t sizeval, hpval, vpval, versionval;
const char *sizestr, *hpstr, *vpstr;
char *sizestr, *hpstr, *vpstr;
versionval = *cp++;
@ -1504,11 +1506,11 @@ loc_ntoa(binary, ascii)
altmeters, altfrac, sizestr, hpstr, vpstr);
if (sizestr != error)
free((char *)sizestr);
free(sizestr);
if (hpstr != error)
free((char *)hpstr);
free(hpstr);
if (vpstr != error)
free((char *)vpstr);
free(vpstr);
return (ascii);
}
@ -1551,14 +1553,14 @@ __p_secstodate (secs)
unsigned long secs;
{
static char output[15]; /* YYYYMMDDHHMMSS and null */
time_t clock = secs;
struct tm time;
time_t clk = secs;
struct tm tim;
(void)gmtime_r(&clock, &time);
time.tm_year += 1900;
time.tm_mon += 1;
(void)gmtime_r(&clk, &tim);
tim.tm_year += 1900;
tim.tm_mon += 1;
sprintf(output, "%04d%02d%02d%02d%02d%02d",
time.tm_year, time.tm_mon, time.tm_mday,
time.tm_hour, time.tm_min, time.tm_sec);
tim.tm_year, tim.tm_mon, tim.tm_mday,
tim.tm_hour, tim.tm_min, tim.tm_sec);
return (output);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: res_init.c,v 1.21 1998/10/15 10:22:24 kleink Exp $ */
/* $NetBSD: res_init.c,v 1.22 1998/11/13 15:46:57 christos Exp $ */
/*-
* Copyright (c) 1985, 1989, 1993
@ -59,7 +59,7 @@
static char sccsid[] = "@(#)res_init.c 8.1 (Berkeley) 6/7/93";
static char rcsid[] = "Id: res_init.c,v 8.8 1997/06/01 20:34:37 vixie Exp ";
#else
__RCSID("$NetBSD: res_init.c,v 1.21 1998/10/15 10:22:24 kleink Exp $");
__RCSID("$NetBSD: res_init.c,v 1.22 1998/11/13 15:46:57 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -395,6 +395,7 @@ res_init()
return (0);
}
/* ARGSUSED */
static void
res_setoptions(options, source)
char *options, *source;
@ -462,5 +463,5 @@ res_randomid()
struct timeval now;
gettimeofday(&now, NULL);
return (0xffff & (now.tv_sec ^ now.tv_usec ^ getpid()));
return (u_int)(0xffff & (now.tv_sec ^ now.tv_usec ^ getpid()));
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: res_mkquery.c,v 1.13 1998/10/15 10:22:24 kleink Exp $ */
/* $NetBSD: res_mkquery.c,v 1.14 1998/11/13 15:46:57 christos Exp $ */
/*-
* Copyright (c) 1985, 1993
@ -59,7 +59,7 @@
static char sccsid[] = "@(#)res_mkquery.c 8.1 (Berkeley) 6/4/93";
static char rcsid[] = "Id: res_mkquery.c,v 8.5 1996/08/27 08:33:28 vixie Exp ";
#else
__RCSID("$NetBSD: res_mkquery.c,v 1.13 1998/10/15 10:22:24 kleink Exp $");
__RCSID("$NetBSD: res_mkquery.c,v 1.14 1998/11/13 15:46:57 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -83,6 +83,7 @@ __weak_alias(res_mkquery,_res_mkquery);
* Form all types of queries.
* Returns the size of the result or -1.
*/
/* ARGSUSED */
int
res_mkquery(op, dname, class, type, data, datalen, newrr_in, buf, buflen)
int op; /* opcode of query */
@ -114,7 +115,7 @@ res_mkquery(op, dname, class, type, data, datalen, newrr_in, buf, buflen)
if ((buf == NULL) || (buflen < sizeof(HEADER)))
return(-1);
(void)memset(buf, 0, sizeof (HEADER));
hp = (HEADER *) buf;
hp = (HEADER *)(void *)buf;
hp->id = htons(++_res.id);
hp->opcode = op;
hp->rd = (_res.options & RES_RECURSE) != 0;
@ -148,7 +149,8 @@ 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;

View File

@ -1,4 +1,4 @@
/* $NetBSD: res_query.c,v 1.19 1998/10/14 19:33:49 kleink Exp $ */
/* $NetBSD: res_query.c,v 1.20 1998/11/13 15:46:57 christos Exp $ */
/*-
* Copyright (c) 1988, 1993
@ -59,7 +59,7 @@
static char sccsid[] = "@(#)res_query.c 8.1 (Berkeley) 6/4/93";
static char rcsid[] = "Id: res_query.c,v 8.10 1997/06/01 20:34:37 vixie Exp ";
#else
__RCSID("$NetBSD: res_query.c,v 1.19 1998/10/14 19:33:49 kleink Exp $");
__RCSID("$NetBSD: res_query.c,v 1.20 1998/11/13 15:46:57 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -110,7 +110,7 @@ res_query(name, class, type, answer, anslen)
int anslen; /* size of answer buffer */
{
u_char buf[MAXPACKET];
register HEADER *hp = (HEADER *) answer;
register HEADER *hp = (HEADER *)(void *)answer;
int n;
hp->rcode = NOERROR; /* default */
@ -186,7 +186,7 @@ res_search(name, class, type, answer, anslen)
int anslen; /* size of answer */
{
const char *cp, * const *domain;
HEADER *hp = (HEADER *) answer;
HEADER *hp = (HEADER *)(void *)answer;
u_int dots;
int trailing_dot, ret, saved_herrno;
int got_nodata = 0, got_servfail = 0, tried_as_is = 0;
@ -329,7 +329,7 @@ res_querydomain(name, domain, class, type, answer, anslen)
{
char nbuf[MAXDNAME];
const char *longname = nbuf;
int n, d;
size_t n, d;
if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
h_errno = NETDB_INTERNAL;

View File

@ -1,4 +1,4 @@
/* $NetBSD: res_send.c,v 1.14 1998/10/14 19:33:50 kleink Exp $ */
/* $NetBSD: res_send.c,v 1.15 1998/11/13 15:46:57 christos Exp $ */
/*-
* Copyright (c) 1985, 1989, 1993
@ -59,7 +59,7 @@
static char sccsid[] = "@(#)res_send.c 8.1 (Berkeley) 6/4/93";
static char rcsid[] = "Id: res_send.c,v 8.13 1997/06/01 20:34:37 vixie Exp ";
#else
__RCSID("$NetBSD: res_send.c,v 1.14 1998/10/14 19:33:50 kleink Exp $");
__RCSID("$NetBSD: res_send.c,v 1.15 1998/11/13 15:46:57 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -228,7 +228,7 @@ res_nameinquery(name, type, class, buf, eom)
const u_char *buf, *eom;
{
register const u_char *cp = buf + HFIXEDSZ;
int qdcount = ntohs(((HEADER*)buf)->qdcount);
int qdcount = ntohs(((const HEADER*)(const void *)buf)->qdcount);
while (qdcount-- > 0) {
char tname[MAXDNAME+1];
@ -265,9 +265,9 @@ res_queriesmatch(buf1, eom1, buf2, eom2)
const u_char *buf2, *eom2;
{
register const u_char *cp = buf1 + HFIXEDSZ;
int qdcount = ntohs(((HEADER*)buf1)->qdcount);
int qdcount = ntohs(((const HEADER *)(const void *)buf1)->qdcount);
if (qdcount != ntohs(((HEADER*)buf2)->qdcount))
if (qdcount != ntohs(((const HEADER *)(const void *)buf2)->qdcount))
return (0);
while (qdcount-- > 0) {
char tname[MAXDNAME+1];
@ -292,8 +292,8 @@ res_send(buf, buflen, ans, anssiz)
u_char *ans;
int anssiz;
{
HEADER *hp = (HEADER *) buf;
HEADER *anhp = (HEADER *) ans;
const HEADER *hp = (const HEADER *)(void *)buf;
HEADER *anhp = (HEADER *)(void *)ans;
int gotsomewhere, connreset, terrno, try, v_circuit, resplen, ns;
register int n;
u_int badns; /* XXX NSMAX can't exceed #/bits in this var */
@ -379,7 +379,7 @@ res_send(buf, buflen, ans, anssiz)
return (-1);
}
errno = 0;
if (connect(s, (struct sockaddr *)nsap,
if (connect(s, (struct sockaddr *)(void *)nsap,
sizeof(struct sockaddr)) < 0) {
terrno = errno;
Aerror(stderr, "connect/vc",
@ -393,10 +393,11 @@ res_send(buf, buflen, ans, anssiz)
/*
* Send length & message
*/
putshort((u_short)buflen, (u_char*)&len);
iov[0].iov_base = (caddr_t)&len;
putshort((u_short)buflen, (u_char*)(void *)&len);
iov[0].iov_base = &len;
iov[0].iov_len = INT16SZ;
iov[1].iov_base = (caddr_t)buf;
/* LINTED write does not affect base */
iov[1].iov_base = (void *)buf;
iov[1].iov_len = buflen;
if (writev(s, iov, 2) != (INT16SZ + buflen)) {
terrno = errno;
@ -411,9 +412,10 @@ res_send(buf, buflen, ans, anssiz)
read_len:
cp = ans;
len = INT16SZ;
while ((n = read(s, (char *)cp, (int)len)) > 0) {
while ((n = read(s, (char *)cp, (size_t)len)) > 0) {
cp += n;
if ((len -= n) <= 0)
/* len is unsigned, no need to compare < 0 */
if ((len -= n) == 0)
break;
}
if (n <= 0) {
@ -448,7 +450,7 @@ read_len:
len = resplen;
cp = ans;
while (len != 0 &&
(n = read(s, (char *)cp, (int)len)) > 0) {
(n = read(s, cp, (size_t)len)) > 0) {
cp += n;
len -= n;
}
@ -471,7 +473,7 @@ read_len:
n = (len > sizeof(junk)
? sizeof(junk)
: len);
if ((n = read(s, junk, n)) > 0)
if ((n = read(s, junk, (size_t)n)) > 0)
len -= n;
else
break;
@ -535,8 +537,9 @@ read_len:
* receive a response from another server.
*/
if (!connected) {
if (connect(s, (struct sockaddr *)nsap,
sizeof(struct sockaddr)
if (connect(s,
(struct sockaddr *)(void *)nsap,
sizeof(struct sockaddr)
) < 0) {
Aerror(stderr,
"connect(dg)",
@ -547,7 +550,7 @@ read_len:
}
connected = 1;
}
if (send(s, (char*)buf, buflen, 0) != buflen) {
if (send(s, buf, buflen, 0) != buflen) {
Perror(stderr, "send", errno);
badns |= (1 << ns);
res_close();
@ -566,9 +569,8 @@ read_len:
no_addr.sin_addr.s_addr = INADDR_ANY;
no_addr.sin_port = 0;
(void) connect(s,
(struct sockaddr *)
&no_addr,
sizeof(no_addr));
(struct sockaddr *)(void *)&no_addr,
sizeof(no_addr));
#else
int s1 = socket(PF_INET, SOCK_DGRAM,0);
if (s1 < 0)
@ -581,8 +583,8 @@ read_len:
connected = 0;
errno = 0;
}
if (sendto(s, (char*)buf, buflen, 0,
(struct sockaddr *)nsap,
if (sendto(s, buf, (size_t)buflen, 0,
(struct sockaddr *)(void *)nsap,
sizeof(struct sockaddr))
!= buflen) {
Aerror(stderr, "sendto", errno, *nsap);
@ -603,7 +605,7 @@ read_len:
dsfd.fd = s;
dsfd.events = POLLIN;
wait:
n = poll(&dsfd, 1, seconds * 1000);
n = poll(&dsfd, 1, (int)(seconds * 1000));
if (n < 0) {
if (errno == EINTR)
goto wait;
@ -623,8 +625,8 @@ wait:
}
errno = 0;
fromlen = sizeof(struct sockaddr_in);
resplen = recvfrom(s, (char*)ans, anssiz, 0,
(struct sockaddr *)&from, &fromlen);
resplen = recvfrom(s, ans, anssiz, 0,
(struct sockaddr *)(void *)&from, &fromlen);
if (resplen <= 0) {
Perror(stderr, "recvfrom", errno);
res_close();