Adjust casts to avoid warnings.
authordrepper <drepper>
Sun, 26 Nov 2000 09:36:45 +0000 (09:36 +0000)
committerdrepper <drepper>
Sun, 26 Nov 2000 09:36:45 +0000 (09:36 +0000)
inet/getnameinfo.c
inet/rcmd.c
inet/ruserpass.c

index 25a8af7..435ba76 100644 (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),
                                              AF_INET6, &th, tmpbuf, tmpbuflen,
                                              &h, &herrno))
                                              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
                  {
                  }
                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))
                                              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)
                  {
                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;
 
                    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;
                    if (scopeid != 0)
                      {
                    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,
                  }
                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)
                  {
                                 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;
        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))
              {
                                      ((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",
              }
          }
        __snprintf (serv, servlen, "%d",
-                   ntohs (((struct sockaddr_in *) sa)->sin_port));
+                   ntohs (((const struct sockaddr_in *) sa)->sin_port));
        break;
 
       case AF_LOCAL:
        break;
 
       case AF_LOCAL:
-       strncpy (serv, ((struct sockaddr_un *) sa)->sun_path, servlen);
+       strncpy (serv, ((const struct sockaddr_un *) sa)->sun_path, servlen);
        break;
     }
 
        break;
     }
 
index 1ddf472..a85cce6 100644 (file)
@@ -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);
                        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);
                        (void)fprintf(stderr,
                            _("rcmd: write (setting up stderr): %m\n"));
                        (void)__close(s2);
index 3b66c30..d610f42 100644 (file)
@@ -317,7 +317,7 @@ token()
        *cp = 0;
        if (tokval[0] == 0)
                return (0);
        *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);
                if (!strcmp(&tokstr[toktab[i].tokstr_off], tokval))
                        return toktab[i].tval;
        return (ID);