summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-11-26 09:44:30 +0000
committerUlrich Drepper <drepper@redhat.com>2000-11-26 09:44:30 +0000
commitc3301189bde66bceb3e949e4938b167fc847dd86 (patch)
tree2e449aae3fb42846f0338645ed73ef6311341902
parent8b6e67674da3b9db3208b914bd8d892abb62ec48 (diff)
downloadglibc-c3301189bde66bceb3e949e4938b167fc847dd86.tar.gz
Update.
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.
-rw-r--r--ChangeLog23
-rw-r--r--include/aliases.h19
-rw-r--r--include/netdb.h58
-rw-r--r--include/rpc/netdb.h23
-rw-r--r--inet/getnameinfo.c18
-rw-r--r--inet/netinet/in.h54
-rw-r--r--inet/rcmd.c2
-rw-r--r--inet/ruserpass.c2
-rw-r--r--string/strcoll.c2
-rw-r--r--string/strnlen.c4
-rw-r--r--string/strxfrm.c4
-rw-r--r--sysdeps/generic/_strerror.c2
-rw-r--r--sysdeps/generic/memrchr.c2
-rw-r--r--sysdeps/generic/strcasestr.c20
-rw-r--r--sysdeps/generic/strstr.c6
15 files changed, 191 insertions, 48 deletions
diff --git a/ChangeLog b/ChangeLog
index b0a4c15858..040e0c01f9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
* string/strcoll.c: Add casts to avoid warnings.
diff --git a/include/aliases.h b/include/aliases.h
index cfe459d02d..3932e52097 100644
--- a/include/aliases.h
+++ b/include/aliases.h
@@ -1 +1,20 @@
+#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
diff --git a/include/netdb.h b/include/netdb.h
index f30d46f222..6a60d4ec8c 100644
--- a/include/netdb.h
+++ b/include/netdb.h
@@ -6,6 +6,10 @@ extern int __gethostent_r (struct hostent *__restrict __result_buf,
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,
@@ -13,65 +17,119 @@ extern int __gethostbyaddr_r (__const void *__restrict __addr,
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,
diff --git a/include/rpc/netdb.h b/include/rpc/netdb.h
index a9d93e13ad..54a4b70052 100644
--- a/include/rpc/netdb.h
+++ b/include/rpc/netdb.h
@@ -1 +1,24 @@
+#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
diff --git a/inet/getnameinfo.c b/inet/getnameinfo.c
index 25a8af7a6c..435ba76ee5 100644
--- a/inet/getnameinfo.c
+++ b/inet/getnameinfo.c
@@ -211,7 +211,7 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host,
{
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))
@@ -238,7 +238,7 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host,
}
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))
@@ -290,11 +290,13 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host,
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)
{
@@ -336,7 +338,7 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host,
}
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)
{
@@ -381,7 +383,7 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host,
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))
{
@@ -410,11 +412,11 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host,
}
}
__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;
}
diff --git a/inet/netinet/in.h b/inet/netinet/in.h
index 1857c199cb..4bceaef869 100644
--- a/inet/netinet/in.h
+++ b/inet/netinet/in.h
@@ -268,34 +268,43 @@ extern uint16_t htons (uint16_t __hostshort)
#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;
@@ -306,19 +315,24 @@ extern int bindresvport6 (int __sockfd, struct sockaddr_in6 *__sock_in)
#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
diff --git a/inet/rcmd.c b/inet/rcmd.c
index 1ddf4729da..a85cce6be0 100644
--- a/inet/rcmd.c
+++ b/inet/rcmd.c
@@ -215,7 +215,7 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af)
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);
diff --git a/inet/ruserpass.c b/inet/ruserpass.c
index 3b66c3040e..d610f4240d 100644
--- a/inet/ruserpass.c
+++ b/inet/ruserpass.c
@@ -317,7 +317,7 @@ token()
*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);
diff --git a/string/strcoll.c b/string/strcoll.c
index 49725e1a69..64e00a251a 100644
--- a/string/strcoll.c
+++ b/string/strcoll.c
@@ -59,7 +59,7 @@ STRCOLL (s1, s2, l)
{
#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
diff --git a/string/strnlen.c b/string/strnlen.c
index 17b1193f0b..a50226f5fc 100644
--- a/string/strnlen.c
+++ b/string/strnlen.c
@@ -1,5 +1,5 @@
/* 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
@@ -26,6 +26,6 @@ size_t
__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)
diff --git a/string/strxfrm.c b/string/strxfrm.c
index df44586a04..4a97c3e1cc 100644
--- a/string/strxfrm.c
+++ b/string/strxfrm.c
@@ -95,7 +95,7 @@ STRXFRM (STRING_TYPE *dest, const STRING_TYPE *src, size_t n, __locale_t l)
{
#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
@@ -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];
}
- if (backw_stop != ~0)
+ if (backw_stop != ~0ul)
{
/* Handle the pushed elements now. */
size_t backw;
diff --git a/sysdeps/generic/_strerror.c b/sysdeps/generic/_strerror.c
index ae520f32fc..123331ac05 100644
--- a/sysdeps/generic/_strerror.c
+++ b/sysdeps/generic/_strerror.c
@@ -56,7 +56,7 @@ __strerror_r (int errnum, char *buf, size_t buflen)
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)
diff --git a/sysdeps/generic/memrchr.c b/sysdeps/generic/memrchr.c
index 6fa918d26e..d1c06e041a 100644
--- a/sysdeps/generic/memrchr.c
+++ b/sysdeps/generic/memrchr.c
@@ -86,7 +86,7 @@ __memrchr (s, c_in, n)
/* 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
diff --git a/sysdeps/generic/strcasestr.c b/sysdeps/generic/strcasestr.c
index 794b50beff..5fe1b10934 100644
--- a/sysdeps/generic/strcasestr.c
+++ b/sysdeps/generic/strcasestr.c
@@ -1,5 +1,5 @@
/* 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
@@ -62,7 +62,7 @@ __strcasestr (phaystack, pneedle)
if (c == '\0')
goto ret0;
}
- while (_tolower (c) != b);
+ while (_tolower (c) != (int) b);
c = _tolower (*++needle);
if (c == '\0')
@@ -80,40 +80,42 @@ __strcasestr (phaystack, pneedle)
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 */
diff --git a/sysdeps/generic/strstr.c b/sysdeps/generic/strstr.c
index 03d6c8e5fc..6bf92e7473 100644
--- a/sysdeps/generic/strstr.c
+++ b/sysdeps/generic/strstr.c
@@ -1,5 +1,5 @@
/* 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
@@ -82,7 +82,9 @@ strstr (phaystack, pneedle)
a = *++haystack;
if (a == '\0')
goto ret0;
-shloop: }
+shloop:
+ ;
+ }
while (a != b);
jin: a = *++haystack;