+2000-11-26 Ulrich Drepper <drepper@redhat.com>
+
+ * inet/getnameinfo.c: Adjust casts to avoid warnings.
+ * inet/rcmd.c: Likewise.
+ * inet/ruserpass.c: Likewise.
+ * inet/netinet/in.h (IN6_IS_ADDR_UNSPECIFIED, IN6_IS_ADDR_LOOPBACK,
+ IN6_IS_ADDR_MULTICAST, IN6_IS_ADDR_LINKLOCAL, IN6_IS_ADDR_SITELOCAL,
+ IN6_IS_ADDR_V4MAPPED, IN6_IS_ADDR_V4COMPAT, IN6_ARE_ADDR_EQUAL,
+ IN6_IS_ADDR_MC_NODELOCAL, IN6_IS_ADDR_MC_LINKLOCAL,
+ IN6_IS_ADDR_MC_SITELOCAL, IN6_IS_ADDR_MC_ORGLOCAL,
+ IN6_IS_ADDR_MC_GLOBAL): Preserve const in cast.
+ * include/aliases.h: Add prototypes for internal __getalias* functions.
+ * include/netdb.h: Add prototypes for __old_gethostent_r,
+ __old_gethostbyaddr_r, __old_gethostbyname_r, __old_gethostbyname2_r,
+ __old_getnetent_r, __old_getnetbyaddr_r, __old_getnetbyname_r,
+ __old_getservent_r, __old_getservbyname_r, __old_getservbyport_r,
+ __old_getprotoent_r, __old_getprotobyname_r, __old_getprotobynumber_r.
+ * include/rpc/netdb.h: Add prototypes for __old_getrpcbyname_r,
+ __old_getrpcbynumber_r, __old_getrpcent_r.
+
+ * include/rpc/netdb.h: Add __getrpcbyname_r, __getrpcbynumber_r,
+ __getrpcent_r prototypes.
+
2000-11-25 Ulrich Drepper <drepper@redhat.com>
* string/strcoll.c: Add casts to avoid warnings.
+#ifndef _ALIASES_H
#include <inet/aliases.h>
+
+extern int __getaliasent_r (struct aliasent *__restrict __result_buf,
+ char *__restrict __buffer, size_t __buflen,
+ struct aliasent **__restrict __result);
+extern int __old_getaliasent_r (struct aliasent *__restrict __result_buf,
+ char *__restrict __buffer, size_t __buflen,
+ struct aliasent **__restrict __result);
+
+extern int __getaliasbyname_r (__const char *__restrict __name,
+ struct aliasent *__restrict __result_buf,
+ char *__restrict __buffer, size_t __buflen,
+ struct aliasent **__restrict __result);
+extern int __old_getaliasbyname_r (__const char *__restrict __name,
+ struct aliasent *__restrict __result_buf,
+ char *__restrict __buffer, size_t __buflen,
+ struct aliasent **__restrict __result);
+
+#endif
char *__restrict __buf, size_t __buflen,
struct hostent **__restrict __result,
int *__restrict __h_errnop);
+extern int __old_gethostent_r (struct hostent *__restrict __result_buf,
+ char *__restrict __buf, size_t __buflen,
+ struct hostent **__restrict __result,
+ int *__restrict __h_errnop);
extern int __gethostbyaddr_r (__const void *__restrict __addr,
socklen_t __len, int __type,
char *__restrict __buf, size_t __buflen,
struct hostent **__restrict __result,
int *__restrict __h_errnop);
+extern int __old_gethostbyaddr_r (__const void *__restrict __addr,
+ socklen_t __len, int __type,
+ struct hostent *__restrict __result_buf,
+ char *__restrict __buf, size_t __buflen,
+ struct hostent **__restrict __result,
+ int *__restrict __h_errnop);
extern int __gethostbyname_r (__const char *__restrict __name,
struct hostent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
struct hostent **__restrict __result,
int *__restrict __h_errnop);
+extern int __old_gethostbyname_r (__const char *__restrict __name,
+ struct hostent *__restrict __result_buf,
+ char *__restrict __buf, size_t __buflen,
+ struct hostent **__restrict __result,
+ int *__restrict __h_errnop);
extern int __gethostbyname2_r (__const char *__restrict __name, int __af,
struct hostent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
struct hostent **__restrict __result,
int *__restrict __h_errnop);
+extern int __old_gethostbyname2_r (__const char *__restrict __name, int __af,
+ struct hostent *__restrict __result_buf,
+ char *__restrict __buf, size_t __buflen,
+ struct hostent **__restrict __result,
+ int *__restrict __h_errnop);
extern int __getnetent_r (struct netent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
struct netent **__restrict __result,
int *__restrict __h_errnop);
+extern int __old_getnetent_r (struct netent *__restrict __result_buf,
+ char *__restrict __buf, size_t __buflen,
+ struct netent **__restrict __result,
+ int *__restrict __h_errnop);
extern int __getnetbyaddr_r (uint32_t __net, int __type,
struct netent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
struct netent **__restrict __result,
int *__restrict __h_errnop);
+extern int __old_getnetbyaddr_r (uint32_t __net, int __type,
+ struct netent *__restrict __result_buf,
+ char *__restrict __buf, size_t __buflen,
+ struct netent **__restrict __result,
+ int *__restrict __h_errnop);
extern int __getnetbyname_r (__const char *__restrict __name,
struct netent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
struct netent **__restrict __result,
int *__restrict __h_errnop);
+extern int __old_getnetbyname_r (__const char *__restrict __name,
+ struct netent *__restrict __result_buf,
+ char *__restrict __buf, size_t __buflen,
+ struct netent **__restrict __result,
+ int *__restrict __h_errnop);
extern int __getservent_r (struct servent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
struct servent **__restrict __result);
+extern int __old_getservent_r (struct servent *__restrict __result_buf,
+ char *__restrict __buf, size_t __buflen,
+ struct servent **__restrict __result);
extern int __getservbyname_r (__const char *__restrict __name,
__const char *__restrict __proto,
struct servent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
struct servent **__restrict __result);
+extern int __old_getservbyname_r (__const char *__restrict __name,
+ __const char *__restrict __proto,
+ struct servent *__restrict __result_buf,
+ char *__restrict __buf, size_t __buflen,
+ struct servent **__restrict __result);
extern int __getservbyport_r (int __port,
__const char *__restrict __proto,
struct servent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
struct servent **__restrict __result);
+extern int __old_getservbyport_r (int __port,
+ __const char *__restrict __proto,
+ struct servent *__restrict __result_buf,
+ char *__restrict __buf, size_t __buflen,
+ struct servent **__restrict __result);
extern int __getprotoent_r (struct protoent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
struct protoent **__restrict __result);
+extern int __old_getprotoent_r (struct protoent *__restrict __result_buf,
+ char *__restrict __buf, size_t __buflen,
+ struct protoent **__restrict __result);
extern int __getprotobyname_r (__const char *__restrict __name,
struct protoent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
struct protoent **__restrict __result);
+extern int __old_getprotobyname_r (__const char *__restrict __name,
+ struct protoent *__restrict __result_buf,
+ char *__restrict __buf, size_t __buflen,
+ struct protoent **__restrict __result);
extern int __getprotobynumber_r (int __proto,
struct protoent *__restrict __res_buf,
char *__restrict __buf, size_t __buflen,
struct protoent **__restrict __result);
+extern int __old_getprotobynumber_r (int __proto,
+ struct protoent *__restrict __res_buf,
+ char *__restrict __buf, size_t __buflen,
+ struct protoent **__restrict __result);
extern int __getnetgrent_r (char **__restrict __hostp,
char **__restrict __userp,
+#ifndef _RPC_NETDB_H
#include <sunrpc/rpc/netdb.h>
+
+extern int __getrpcbyname_r (__const char *__name, struct rpcent *__result_buf,
+ char *__buffer, size_t __buflen,
+ struct rpcent **__result);
+extern int __old_getrpcbyname_r (__const char *__name,
+ struct rpcent *__result_buf,
+ char *__buffer, size_t __buflen,
+ struct rpcent **__result);
+
+extern int __getrpcbynumber_r (int __number, struct rpcent *__result_buf,
+ char *__buffer, size_t __buflen,
+ struct rpcent **__result);
+extern int __old_getrpcbynumber_r (int __number, struct rpcent *__result_buf,
+ char *__buffer, size_t __buflen,
+ struct rpcent **__result);
+
+extern int __getrpcent_r (struct rpcent *__result_buf, char *__buffer,
+ size_t __buflen, struct rpcent **__result);
+extern int __old_getrpcent_r (struct rpcent *__result_buf, char *__buffer,
+ size_t __buflen, struct rpcent **__result);
+
+#endif
{
if (sa->sa_family == AF_INET6)
{
- while (__gethostbyaddr_r ((void *) &(((struct sockaddr_in6 *) sa)->sin6_addr),
+ while (__gethostbyaddr_r ((const void *) &(((const struct sockaddr_in6 *) sa)->sin6_addr),
sizeof(struct in6_addr),
AF_INET6, &th, tmpbuf, tmpbuflen,
&h, &herrno))
}
else
{
- while (__gethostbyaddr_r ((void *) &(((struct sockaddr_in *)sa)->sin_addr),
+ while (__gethostbyaddr_r ((const void *) &(((const struct sockaddr_in *)sa)->sin_addr),
sizeof(struct in_addr), AF_INET,
&th, tmpbuf, tmpbuflen,
&h, &herrno))
const char *c;
if (sa->sa_family == AF_INET6)
{
- struct sockaddr_in6 *sin6p = (struct sockaddr_in6 *) sa;
+ const struct sockaddr_in6 *sin6p;
uint32_t scopeid;
+ sin6p = (const struct sockaddr_in6 *) sa;
+
c = inet_ntop (AF_INET6,
- (void *) &sin6p->sin6_addr, host, hostlen);
+ (const void *) &sin6p->sin6_addr, host, hostlen);
scopeid = sin6p->sin6_scope_id;
if (scopeid != 0)
{
}
else
c = inet_ntop (AF_INET,
- (void *) &(((struct sockaddr_in *) sa)->sin_addr),
+ (const void *) &(((const struct sockaddr_in *) sa)->sin_addr),
host, hostlen);
if (c == NULL)
{
if (!(flags & NI_NUMERICSERV))
{
struct servent *s, ts;
- while (__getservbyport_r (((struct sockaddr_in *) sa)->sin_port,
+ while (__getservbyport_r (((const struct sockaddr_in *) sa)->sin_port,
((flags & NI_DGRAM) ? "udp" : "tcp"),
&ts, tmpbuf, tmpbuflen, &s))
{
}
}
__snprintf (serv, servlen, "%d",
- ntohs (((struct sockaddr_in *) sa)->sin_port));
+ ntohs (((const struct sockaddr_in *) sa)->sin_port));
break;
case AF_LOCAL:
- strncpy (serv, ((struct sockaddr_un *) sa)->sun_path, servlen);
+ strncpy (serv, ((const struct sockaddr_un *) sa)->sun_path, servlen);
break;
}
#endif
#define IN6_IS_ADDR_UNSPECIFIED(a) \
- (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \
- ((uint32_t *) (a))[2] == 0 && ((uint32_t *) (a))[3] == 0)
+ (((__const uint32_t *) (a))[0] == 0 \
+ && ((__const uint32_t *) (a))[1] == 0 \
+ && ((__const uint32_t *) (a))[2] == 0 \
+ && ((__const uint32_t *) (a))[3] == 0)
#define IN6_IS_ADDR_LOOPBACK(a) \
- (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \
- ((uint32_t *) (a))[2] == 0 && ((uint32_t *) (a))[3] == htonl (1))
+ (((__const uint32_t *) (a))[0] == 0 \
+ && ((__const uint32_t *) (a))[1] == 0 \
+ && ((__const uint32_t *) (a))[2] == 0 \
+ && ((__const uint32_t *) (a))[3] == htonl (1))
-#define IN6_IS_ADDR_MULTICAST(a) (((uint8_t *) (a))[0] == 0xff)
+#define IN6_IS_ADDR_MULTICAST(a) (((__const uint8_t *) (a))[0] == 0xff)
#define IN6_IS_ADDR_LINKLOCAL(a) \
- ((((uint32_t *) (a))[0] & htonl (0xffc00000)) == htonl (0xfe800000))
+ ((((__const uint32_t *) (a))[0] & htonl (0xffc00000)) \
+ == htonl (0xfe800000))
#define IN6_IS_ADDR_SITELOCAL(a) \
- ((((uint32_t *) (a))[0] & htonl (0xffc00000)) == htonl (0xfec00000))
+ ((((__const uint32_t *) (a))[0] & htonl (0xffc00000)) \
+ == htonl (0xfec00000))
#define IN6_IS_ADDR_V4MAPPED(a) \
- ((((uint32_t *) (a))[0] == 0) && (((uint32_t *) (a))[1] == 0) && \
- (((uint32_t *) (a))[2] == htonl (0xffff)))
+ ((((__const uint32_t *) (a))[0] == 0) \
+ && (((__const uint32_t *) (a))[1] == 0) \
+ && (((__const uint32_t *) (a))[2] == htonl (0xffff)))
#define IN6_IS_ADDR_V4COMPAT(a) \
- ((((uint32_t *) (a))[0] == 0) && (((uint32_t *) (a))[1] == 0) && \
- (((uint32_t *) (a))[2] == 0) && (ntohl (((uint32_t *) (a))[3]) > 1))
+ ((((__const uint32_t *) (a))[0] == 0) \
+ && (((__const uint32_t *) (a))[1] == 0) \
+ && (((__const uint32_t *) (a))[2] == 0) \
+ && (ntohl (((__const uint32_t *) (a))[3]) > 1))
#define IN6_ARE_ADDR_EQUAL(a,b) \
- ((((uint32_t *) (a))[0] == ((uint32_t *) (b))[0]) && \
- (((uint32_t *) (a))[1] == ((uint32_t *) (b))[1]) && \
- (((uint32_t *) (a))[2] == ((uint32_t *) (b))[2]) && \
- (((uint32_t *) (a))[3] == ((uint32_t *) (b))[3]))
+ ((((__const uint32_t *) (a))[0] == ((__const uint32_t *) (b))[0]) \
+ && (((__const uint32_t *) (a))[1] == ((__const uint32_t *) (b))[1]) \
+ && (((__const uint32_t *) (a))[2] == ((__const uint32_t *) (b))[2]) \
+ && (((__const uint32_t *) (a))[3] == ((__const uint32_t *) (b))[3]))
/* Bind socket to a privileged IP port. */
extern int bindresvport (int __sockfd, struct sockaddr_in *__sock_in) __THROW;
#define IN6_IS_ADDR_MC_NODELOCAL(a) \
- (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0x1))
+ (IN6_IS_ADDR_MULTICAST(a) \
+ && ((((__const uint8_t *) (a))[1] & 0xf) == 0x1))
#define IN6_IS_ADDR_MC_LINKLOCAL(a) \
- (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0x2))
+ (IN6_IS_ADDR_MULTICAST(a) \
+ && ((((__const uint8_t *) (a))[1] & 0xf) == 0x2))
#define IN6_IS_ADDR_MC_SITELOCAL(a) \
- (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0x5))
+ (IN6_IS_ADDR_MULTICAST(a) \
+ && ((((__const uint8_t *) (a))[1] & 0xf) == 0x5))
#define IN6_IS_ADDR_MC_ORGLOCAL(a) \
- (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0x8))
+ (IN6_IS_ADDR_MULTICAST(a) \
+ && ((((__const uint8_t *) (a))[1] & 0xf) == 0x8))
#define IN6_IS_ADDR_MC_GLOBAL(a) \
- (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0xe))
+ (IN6_IS_ADDR_MULTICAST(a) \
+ && ((((__const uint8_t *) (a))[1] & 0xf) == 0xe))
/* IPv6 packet information. */
struct in6_pktinfo
goto bad;
listen(s2, 1);
(void)__snprintf(num, sizeof(num), "%d", lport);
- if (__write(s, num, strlen(num)+1) != strlen(num)+1) {
+ if (__write(s, num, strlen(num)+1) != (ssize_t)strlen(num)+1) {
(void)fprintf(stderr,
_("rcmd: write (setting up stderr): %m\n"));
(void)__close(s2);
*cp = 0;
if (tokval[0] == 0)
return (0);
- for (i = 0; i < sizeof (toktab) / sizeof (toktab[0]); ++i)
+ for (i = 0; i < (int) (sizeof (toktab) / sizeof (toktab[0])); ++i)
if (!strcmp(&tokstr[toktab[i].tokstr_off], tokval))
return toktab[i].tval;
return (ID);
{
#ifdef USE_IN_EXTENDED_LOCALE_MODEL
struct locale_data *current = l->__locales[LC_COLLATE];
- uint_fast32_t nrules = *((uint32_t *) current->values[_NL_ITEM_INDEX (_NL_COLLATE_NRULES)].string);
+ uint_fast32_t nrules = *((const uint32_t *) current->values[_NL_ITEM_INDEX (_NL_COLLATE_NRULES)].string);
#else
uint_fast32_t nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
#endif
/* Find the length of STRING, but scan at most MAXLEN characters.
- Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
__strnlen (const char *string, size_t maxlen)
{
const char *end = memchr (string, '\0', maxlen);
- return end ? end - string : maxlen;
+ return end ? (size_t) (end - string) : maxlen;
}
weak_alias (__strnlen, strnlen)
{
#ifdef USE_IN_EXTENDED_LOCALE_MODEL
struct locale_data *current = l->__locales[LC_COLLATE];
- uint_fast32_t nrules = *((uint32_t *) current->values[_NL_ITEM_INDEX (_NL_COLLATE_NRULES)].string);
+ uint_fast32_t nrules = *((const uint32_t *) current->values[_NL_ITEM_INDEX (_NL_COLLATE_NRULES)].string);
#else
uint32_t nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
#endif
rule = rulesets[rulearr[idxcnt + 1] * nrules + pass];
}
- if (backw_stop != ~0)
+ if (backw_stop != ~0ul)
{
/* Handle the pushed elements now. */
size_t backw;
buffer size. */
q = __mempcpy (buf, unk, MIN (unklen, buflen));
if (unklen < buflen)
- memcpy (q, p, MIN (&numbuf[21] - p, buflen - unklen));
+ memcpy (q, p, MIN ((size_t) (&numbuf[21] - p), buflen - unklen));
/* Terminate the string in any case. */
if (buflen > 0)
/* All these elucidatory comments refer to 4-byte longwords,
but the theory applies equally well to 8-byte longwords. */
- longword_ptr = (unsigned long int *) char_ptr;
+ longword_ptr = (const unsigned long int *) char_ptr;
/* Bits 31, 24, 16, and 8 of this number are zero. Call these bits
the "holes." Note that there is a hole just to the left of
/* Return the offset of one string within another.
- Copyright (C) 1994, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1994,1996,1997,1998,1999,2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
if (c == '\0')
goto ret0;
}
- while (_tolower (c) != b);
+ while (_tolower (c) != (int) b);
c = _tolower (*++needle);
if (c == '\0')
a = *++haystack;
if (a == '\0')
goto ret0;
- if (_tolower (a) == b)
+ if (_tolower (a) == (int) b)
break;
a = *++haystack;
if (a == '\0')
goto ret0;
-shloop: }
- while (_tolower (a) != b);
+shloop:
+ ;
+ }
+ while (_tolower (a) != (int) b);
jin: a = *++haystack;
if (a == '\0')
goto ret0;
- if (_tolower (a) != c)
+ if (_tolower (a) != (int) c)
goto shloop;
rhaystack = haystack-- + 1;
rneedle = needle;
a = _tolower (*rneedle);
- if (_tolower (*rhaystack) == a)
+ if (_tolower (*rhaystack) == (int) a)
do
{
if (a == '\0')
goto foundneedle;
++rhaystack;
a = _tolower (*++needle);
- if (_tolower (*rhaystack) != a)
+ if (_tolower (*rhaystack) != (int) a)
break;
if (a == '\0')
goto foundneedle;
++rhaystack;
a = _tolower (*++needle);
}
- while (_tolower (*rhaystack) == a);
+ while (_tolower (*rhaystack) == (int) a);
needle = rneedle; /* took the register-poor approach */
/* Return the offset of one string within another.
- Copyright (C) 1994, 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1994, 1996, 1997, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
a = *++haystack;
if (a == '\0')
goto ret0;
-shloop: }
+shloop:
+ ;
+ }
while (a != b);
jin: a = *++haystack;