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.
This commit is contained in:
Ulrich Drepper 2000-11-26 09:44:30 +00:00
parent 8b6e67674d
commit c3301189bd
15 changed files with 191 additions and 48 deletions

View File

@ -1,3 +1,26 @@
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> 2000-11-25 Ulrich Drepper <drepper@redhat.com>
* string/strcoll.c: Add casts to avoid warnings. * string/strcoll.c: Add casts to avoid warnings.

View File

@ -1 +1,20 @@
#ifndef _ALIASES_H
#include <inet/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

View File

@ -6,6 +6,10 @@ extern int __gethostent_r (struct hostent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen, char *__restrict __buf, size_t __buflen,
struct hostent **__restrict __result, struct hostent **__restrict __result,
int *__restrict __h_errnop); 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, extern int __gethostbyaddr_r (__const void *__restrict __addr,
socklen_t __len, int __type, socklen_t __len, int __type,
@ -13,65 +17,119 @@ extern int __gethostbyaddr_r (__const void *__restrict __addr,
char *__restrict __buf, size_t __buflen, char *__restrict __buf, size_t __buflen,
struct hostent **__restrict __result, struct hostent **__restrict __result,
int *__restrict __h_errnop); 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, extern int __gethostbyname_r (__const char *__restrict __name,
struct hostent *__restrict __result_buf, struct hostent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen, char *__restrict __buf, size_t __buflen,
struct hostent **__restrict __result, struct hostent **__restrict __result,
int *__restrict __h_errnop); 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, extern int __gethostbyname2_r (__const char *__restrict __name, int __af,
struct hostent *__restrict __result_buf, struct hostent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen, char *__restrict __buf, size_t __buflen,
struct hostent **__restrict __result, struct hostent **__restrict __result,
int *__restrict __h_errnop); 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, extern int __getnetent_r (struct netent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen, char *__restrict __buf, size_t __buflen,
struct netent **__restrict __result, struct netent **__restrict __result,
int *__restrict __h_errnop); 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, extern int __getnetbyaddr_r (uint32_t __net, int __type,
struct netent *__restrict __result_buf, struct netent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen, char *__restrict __buf, size_t __buflen,
struct netent **__restrict __result, struct netent **__restrict __result,
int *__restrict __h_errnop); 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, extern int __getnetbyname_r (__const char *__restrict __name,
struct netent *__restrict __result_buf, struct netent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen, char *__restrict __buf, size_t __buflen,
struct netent **__restrict __result, struct netent **__restrict __result,
int *__restrict __h_errnop); 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, extern int __getservent_r (struct servent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen, char *__restrict __buf, size_t __buflen,
struct servent **__restrict __result); 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, extern int __getservbyname_r (__const char *__restrict __name,
__const char *__restrict __proto, __const char *__restrict __proto,
struct servent *__restrict __result_buf, struct servent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen, char *__restrict __buf, size_t __buflen,
struct servent **__restrict __result); 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, extern int __getservbyport_r (int __port,
__const char *__restrict __proto, __const char *__restrict __proto,
struct servent *__restrict __result_buf, struct servent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen, char *__restrict __buf, size_t __buflen,
struct servent **__restrict __result); 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, extern int __getprotoent_r (struct protoent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen, char *__restrict __buf, size_t __buflen,
struct protoent **__restrict __result); 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, extern int __getprotobyname_r (__const char *__restrict __name,
struct protoent *__restrict __result_buf, struct protoent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen, char *__restrict __buf, size_t __buflen,
struct protoent **__restrict __result); 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, extern int __getprotobynumber_r (int __proto,
struct protoent *__restrict __res_buf, struct protoent *__restrict __res_buf,
char *__restrict __buf, size_t __buflen, char *__restrict __buf, size_t __buflen,
struct protoent **__restrict __result); 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, extern int __getnetgrent_r (char **__restrict __hostp,
char **__restrict __userp, char **__restrict __userp,

View File

@ -1 +1,24 @@
#ifndef _RPC_NETDB_H
#include <sunrpc/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

View File

@ -211,7 +211,7 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host,
{ {
if (sa->sa_family == AF_INET6) 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), sizeof(struct in6_addr),
AF_INET6, &th, tmpbuf, tmpbuflen, AF_INET6, &th, tmpbuf, tmpbuflen,
&h, &herrno)) &h, &herrno))
@ -238,7 +238,7 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host,
} }
else 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, sizeof(struct in_addr), AF_INET,
&th, tmpbuf, tmpbuflen, &th, tmpbuf, tmpbuflen,
&h, &herrno)) &h, &herrno))
@ -290,11 +290,13 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host,
const char *c; const char *c;
if (sa->sa_family == AF_INET6) if (sa->sa_family == AF_INET6)
{ {
struct sockaddr_in6 *sin6p = (struct sockaddr_in6 *) sa; const struct sockaddr_in6 *sin6p;
uint32_t scopeid; uint32_t scopeid;
sin6p = (const struct sockaddr_in6 *) sa;
c = inet_ntop (AF_INET6, c = inet_ntop (AF_INET6,
(void *) &sin6p->sin6_addr, host, hostlen); (const void *) &sin6p->sin6_addr, host, hostlen);
scopeid = sin6p->sin6_scope_id; scopeid = sin6p->sin6_scope_id;
if (scopeid != 0) if (scopeid != 0)
{ {
@ -336,7 +338,7 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host,
} }
else else
c = inet_ntop (AF_INET, c = inet_ntop (AF_INET,
(void *) &(((struct sockaddr_in *) sa)->sin_addr), (const void *) &(((const struct sockaddr_in *) sa)->sin_addr),
host, hostlen); host, hostlen);
if (c == NULL) if (c == NULL)
{ {
@ -381,7 +383,7 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host,
if (!(flags & NI_NUMERICSERV)) if (!(flags & NI_NUMERICSERV))
{ {
struct servent *s, ts; 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"), ((flags & NI_DGRAM) ? "udp" : "tcp"),
&ts, tmpbuf, tmpbuflen, &s)) &ts, tmpbuf, tmpbuflen, &s))
{ {
@ -410,11 +412,11 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host,
} }
} }
__snprintf (serv, servlen, "%d", __snprintf (serv, servlen, "%d",
ntohs (((struct sockaddr_in *) sa)->sin_port)); ntohs (((const struct sockaddr_in *) sa)->sin_port));
break; break;
case AF_LOCAL: case AF_LOCAL:
strncpy (serv, ((struct sockaddr_un *) sa)->sun_path, servlen); strncpy (serv, ((const struct sockaddr_un *) sa)->sun_path, servlen);
break; break;
} }

View File

@ -268,34 +268,43 @@ extern uint16_t htons (uint16_t __hostshort)
#endif #endif
#define IN6_IS_ADDR_UNSPECIFIED(a) \ #define IN6_IS_ADDR_UNSPECIFIED(a) \
(((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \ (((__const uint32_t *) (a))[0] == 0 \
((uint32_t *) (a))[2] == 0 && ((uint32_t *) (a))[3] == 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) \ #define IN6_IS_ADDR_LOOPBACK(a) \
(((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \ (((__const uint32_t *) (a))[0] == 0 \
((uint32_t *) (a))[2] == 0 && ((uint32_t *) (a))[3] == htonl (1)) && ((__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) \ #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) \ #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) \ #define IN6_IS_ADDR_V4MAPPED(a) \
((((uint32_t *) (a))[0] == 0) && (((uint32_t *) (a))[1] == 0) && \ ((((__const uint32_t *) (a))[0] == 0) \
(((uint32_t *) (a))[2] == htonl (0xffff))) && (((__const uint32_t *) (a))[1] == 0) \
&& (((__const uint32_t *) (a))[2] == htonl (0xffff)))
#define IN6_IS_ADDR_V4COMPAT(a) \ #define IN6_IS_ADDR_V4COMPAT(a) \
((((uint32_t *) (a))[0] == 0) && (((uint32_t *) (a))[1] == 0) && \ ((((__const uint32_t *) (a))[0] == 0) \
(((uint32_t *) (a))[2] == 0) && (ntohl (((uint32_t *) (a))[3]) > 1)) && (((__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) \ #define IN6_ARE_ADDR_EQUAL(a,b) \
((((uint32_t *) (a))[0] == ((uint32_t *) (b))[0]) && \ ((((__const uint32_t *) (a))[0] == ((__const uint32_t *) (b))[0]) \
(((uint32_t *) (a))[1] == ((uint32_t *) (b))[1]) && \ && (((__const uint32_t *) (a))[1] == ((__const uint32_t *) (b))[1]) \
(((uint32_t *) (a))[2] == ((uint32_t *) (b))[2]) && \ && (((__const uint32_t *) (a))[2] == ((__const uint32_t *) (b))[2]) \
(((uint32_t *) (a))[3] == ((uint32_t *) (b))[3])) && (((__const uint32_t *) (a))[3] == ((__const uint32_t *) (b))[3]))
/* Bind socket to a privileged IP port. */ /* Bind socket to a privileged IP port. */
extern int bindresvport (int __sockfd, struct sockaddr_in *__sock_in) __THROW; extern int bindresvport (int __sockfd, struct sockaddr_in *__sock_in) __THROW;
@ -306,19 +315,24 @@ extern int bindresvport6 (int __sockfd, struct sockaddr_in6 *__sock_in)
#define IN6_IS_ADDR_MC_NODELOCAL(a) \ #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) \ #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) \ #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) \ #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) \ #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. */ /* IPv6 packet information. */
struct in6_pktinfo struct in6_pktinfo

View File

@ -215,7 +215,7 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af)
goto bad; goto bad;
listen(s2, 1); listen(s2, 1);
(void)__snprintf(num, sizeof(num), "%d", lport); (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, (void)fprintf(stderr,
_("rcmd: write (setting up stderr): %m\n")); _("rcmd: write (setting up stderr): %m\n"));
(void)__close(s2); (void)__close(s2);

View File

@ -317,7 +317,7 @@ token()
*cp = 0; *cp = 0;
if (tokval[0] == 0) if (tokval[0] == 0)
return (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)) if (!strcmp(&tokstr[toktab[i].tokstr_off], tokval))
return toktab[i].tval; return toktab[i].tval;
return (ID); return (ID);

View File

@ -59,7 +59,7 @@ STRCOLL (s1, s2, l)
{ {
#ifdef USE_IN_EXTENDED_LOCALE_MODEL #ifdef USE_IN_EXTENDED_LOCALE_MODEL
struct locale_data *current = l->__locales[LC_COLLATE]; 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 #else
uint_fast32_t nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES); uint_fast32_t nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
#endif #endif

View File

@ -1,5 +1,5 @@
/* Find the length of STRING, but scan at most MAXLEN characters. /* 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. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -26,6 +26,6 @@ size_t
__strnlen (const char *string, size_t maxlen) __strnlen (const char *string, size_t maxlen)
{ {
const char *end = memchr (string, '\0', maxlen); const char *end = memchr (string, '\0', maxlen);
return end ? end - string : maxlen; return end ? (size_t) (end - string) : maxlen;
} }
weak_alias (__strnlen, strnlen) weak_alias (__strnlen, strnlen)

View File

@ -95,7 +95,7 @@ STRXFRM (STRING_TYPE *dest, const STRING_TYPE *src, size_t n, __locale_t l)
{ {
#ifdef USE_IN_EXTENDED_LOCALE_MODEL #ifdef USE_IN_EXTENDED_LOCALE_MODEL
struct locale_data *current = l->__locales[LC_COLLATE]; 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 #else
uint32_t nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES); uint32_t nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
#endif #endif
@ -393,7 +393,7 @@ STRXFRM (STRING_TYPE *dest, const STRING_TYPE *src, size_t n, __locale_t l)
rule = rulesets[rulearr[idxcnt + 1] * nrules + pass]; rule = rulesets[rulearr[idxcnt + 1] * nrules + pass];
} }
if (backw_stop != ~0) if (backw_stop != ~0ul)
{ {
/* Handle the pushed elements now. */ /* Handle the pushed elements now. */
size_t backw; size_t backw;

View File

@ -56,7 +56,7 @@ __strerror_r (int errnum, char *buf, size_t buflen)
buffer size. */ buffer size. */
q = __mempcpy (buf, unk, MIN (unklen, buflen)); q = __mempcpy (buf, unk, MIN (unklen, buflen));
if (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. */ /* Terminate the string in any case. */
if (buflen > 0) if (buflen > 0)

View File

@ -86,7 +86,7 @@ __memrchr (s, c_in, n)
/* All these elucidatory comments refer to 4-byte longwords, /* All these elucidatory comments refer to 4-byte longwords,
but the theory applies equally well to 8-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 /* 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 the "holes." Note that there is a hole just to the left of

View File

@ -1,5 +1,5 @@
/* Return the offset of one string within another. /* 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. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -62,7 +62,7 @@ __strcasestr (phaystack, pneedle)
if (c == '\0') if (c == '\0')
goto ret0; goto ret0;
} }
while (_tolower (c) != b); while (_tolower (c) != (int) b);
c = _tolower (*++needle); c = _tolower (*++needle);
if (c == '\0') if (c == '\0')
@ -80,40 +80,42 @@ __strcasestr (phaystack, pneedle)
a = *++haystack; a = *++haystack;
if (a == '\0') if (a == '\0')
goto ret0; goto ret0;
if (_tolower (a) == b) if (_tolower (a) == (int) b)
break; break;
a = *++haystack; a = *++haystack;
if (a == '\0') if (a == '\0')
goto ret0; goto ret0;
shloop: } shloop:
while (_tolower (a) != b); ;
}
while (_tolower (a) != (int) b);
jin: a = *++haystack; jin: a = *++haystack;
if (a == '\0') if (a == '\0')
goto ret0; goto ret0;
if (_tolower (a) != c) if (_tolower (a) != (int) c)
goto shloop; goto shloop;
rhaystack = haystack-- + 1; rhaystack = haystack-- + 1;
rneedle = needle; rneedle = needle;
a = _tolower (*rneedle); a = _tolower (*rneedle);
if (_tolower (*rhaystack) == a) if (_tolower (*rhaystack) == (int) a)
do do
{ {
if (a == '\0') if (a == '\0')
goto foundneedle; goto foundneedle;
++rhaystack; ++rhaystack;
a = _tolower (*++needle); a = _tolower (*++needle);
if (_tolower (*rhaystack) != a) if (_tolower (*rhaystack) != (int) a)
break; break;
if (a == '\0') if (a == '\0')
goto foundneedle; goto foundneedle;
++rhaystack; ++rhaystack;
a = _tolower (*++needle); a = _tolower (*++needle);
} }
while (_tolower (*rhaystack) == a); while (_tolower (*rhaystack) == (int) a);
needle = rneedle; /* took the register-poor approach */ needle = rneedle; /* took the register-poor approach */

View File

@ -1,5 +1,5 @@
/* Return the offset of one string within another. /* 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. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -82,7 +82,9 @@ strstr (phaystack, pneedle)
a = *++haystack; a = *++haystack;
if (a == '\0') if (a == '\0')
goto ret0; goto ret0;
shloop: } shloop:
;
}
while (a != b); while (a != b);
jin: a = *++haystack; jin: a = *++haystack;