From 5d6ad6ec8cba62d032eb3fd2970ce5f9d433de89 Mon Sep 17 00:00:00 2001 From: Ezra Peisach Date: Tue, 26 Sep 2000 22:17:10 +0000 Subject: [PATCH] Cleanup gcc warnings of signed vs unsigned arguments to functions git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@12683 dc483132-0cff-0310-8789-dd5450dbe970 --- src/appl/simple/client/ChangeLog | 4 ++++ src/appl/simple/client/sim_client.c | 20 ++++++++++++++------ src/appl/simple/server/ChangeLog | 5 +++++ src/appl/simple/server/sim_server.c | 17 +++++++++-------- 4 files changed, 32 insertions(+), 14 deletions(-) diff --git a/src/appl/simple/client/ChangeLog b/src/appl/simple/client/ChangeLog index d7a049c54..6ac62bb75 100644 --- a/src/appl/simple/client/ChangeLog +++ b/src/appl/simple/client/ChangeLog @@ -1,3 +1,7 @@ +Tue Sep 26 18:15:47 2000 Ezra Peisach + + * sim_client.c: Warnings cleanups unsigned vs signed. + 1999-10-26 Wilfredo Sanchez * Makefile.in: Clean up usage of CFLAGS, CPPFLAGS, DEFS, DEFINES, diff --git a/src/appl/simple/client/sim_client.c b/src/appl/simple/client/sim_client.c index b010794ee..efe71cc88 100644 --- a/src/appl/simple/client/sim_client.c +++ b/src/appl/simple/client/sim_client.c @@ -46,6 +46,9 @@ #else extern char *malloc(); #endif +#ifdef HAVE_UNISTD_H +#include +#endif /* for old Unixes and friends ... */ #ifndef MAXHOSTNAMELEN @@ -54,6 +57,8 @@ extern char *malloc(); #define MSG "hi there!" /* message text */ +void usage KRB5_PROTOTYPE((char *)); + void usage(name) char *name; @@ -67,6 +72,7 @@ main(argc, argv) char *argv[]; { int sock, i; + unsigned int len; int flags = 0; /* flags for sendto() */ struct servent *serv; struct hostent *host; @@ -96,7 +102,6 @@ main(argc, argv) krb5_context context; krb5_auth_context auth_context = NULL; - krb5_replay_data replaydata; retval = krb5_init_context(&context); if (retval) { @@ -237,7 +242,8 @@ main(argc, argv) exit(1); } /* Send authentication info to server */ - if ((i = send(sock, (char *)packet.data, packet.length, flags)) < 0) + if ((i = send(sock, (char *)packet.data, (unsigned) packet.length, + flags)) < 0) com_err(progname, errno, "while sending KRB_AP_REQ message"); printf("Sent authentication data: %d bytes\n", i); krb5_free_data_contents(context, &packet); @@ -246,8 +252,8 @@ main(argc, argv) /* Get my address */ memset((char *) &c_sock, 0, sizeof(c_sock)); - i = sizeof(c_sock); - if (getsockname(sock, (struct sockaddr *)&c_sock, &i) < 0) { + len = sizeof(c_sock); + if (getsockname(sock, (struct sockaddr *)&c_sock, &len) < 0) { com_err(progname, errno, "while getting socket name"); exit(1); } @@ -305,7 +311,8 @@ main(argc, argv) } /* Send it */ - if ((i = send(sock, (char *)packet.data, packet.length, flags)) < 0) + if ((i = send(sock, (char *)packet.data, (unsigned) packet.length, + flags)) < 0) com_err(progname, errno, "while sending SAFE message"); printf("Sent checksummed message: %d bytes\n", i); krb5_free_data_contents(context, &packet); @@ -320,7 +327,8 @@ main(argc, argv) } /* Send it */ - if ((i = send(sock, (char *)packet.data, packet.length, flags)) < 0) + if ((i = send(sock, (char *)packet.data, (unsigned) packet.length, + flags)) < 0) com_err(progname, errno, "while sending PRIV message"); printf("Sent encrypted message: %d bytes\n", i); krb5_free_data_contents(context, &packet); diff --git a/src/appl/simple/server/ChangeLog b/src/appl/simple/server/ChangeLog index f68291059..0bcd7ce30 100644 --- a/src/appl/simple/server/ChangeLog +++ b/src/appl/simple/server/ChangeLog @@ -1,3 +1,8 @@ +Tue Sep 26 18:16:33 2000 Ezra Peisach + + * sim_server.c: Warnigs cleanup of signed vs. unsigned arguments + to functions. + 1999-10-26 Wilfredo Sanchez * Makefile.in: Clean up usage of CFLAGS, CPPFLAGS, DEFS, DEFINES, diff --git a/src/appl/simple/server/sim_server.c b/src/appl/simple/server/sim_server.c index 6e4f4e1cc..b04338f77 100644 --- a/src/appl/simple/server/sim_server.c +++ b/src/appl/simple/server/sim_server.c @@ -52,19 +52,20 @@ #define PROGNAME argv[0] -void +static void usage(name) char *name; { fprintf(stderr, "usage: %s [-p port] [-s service] [-S keytab]\n", name); } -void +int main(argc, argv) int argc; char *argv[]; { int sock, i; + unsigned int len; int flags = 0; /* for recvfrom() */ int on = 1; struct servent *serv; @@ -179,9 +180,9 @@ char *argv[]; /* GET KRB_AP_REQ MESSAGE */ /* use "recvfrom" so we know client's address */ - i = sizeof(struct sockaddr_in); + len = sizeof(struct sockaddr_in); if ((i = recvfrom(sock, (char *)pktbuf, sizeof(pktbuf), flags, - (struct sockaddr *)&c_sock, &i)) < 0) { + (struct sockaddr *)&c_sock, &len)) < 0) { perror("receiving datagram"); exit(1); } @@ -226,9 +227,9 @@ char *argv[]; /* GET KRB_MK_SAFE MESSAGE */ /* use "recvfrom" so we know client's address */ - i = sizeof(struct sockaddr_in); + len = sizeof(struct sockaddr_in); if ((i = recvfrom(sock, (char *)pktbuf, sizeof(pktbuf), flags, - (struct sockaddr *)&c_sock, &i)) < 0) { + (struct sockaddr *)&c_sock, &len)) < 0) { perror("receiving datagram"); exit(1); } @@ -252,9 +253,9 @@ char *argv[]; /* NOW GET ENCRYPTED MESSAGE */ /* use "recvfrom" so we know client's address */ - i = sizeof(struct sockaddr_in); + len = sizeof(struct sockaddr_in); if ((i = recvfrom(sock, (char *)pktbuf, sizeof(pktbuf), flags, - (struct sockaddr *)&c_sock, &i)) < 0) { + (struct sockaddr *)&c_sock, &len)) < 0) { perror("receiving datagram"); exit(1); } -- 2.26.2