From: Ted Lemon Date: Mon, 16 Mar 1998 06:17:37 +0000 (+0000) Subject: Clean up unsigned char vs. signed char discrepencies. X-Git-Tag: carrel-2~168 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=69858972fde49a68ba9b6ff3f7d3212427f0a816;p=thirdparty%2Fdhcp.git Clean up unsigned char vs. signed char discrepencies. --- diff --git a/common/dns.c b/common/dns.c index 74d10fa19..f7b678ca8 100644 --- a/common/dns.c +++ b/common/dns.c @@ -48,7 +48,7 @@ #ifndef lint static char copyright[] = -"$Id: dns.c,v 1.7 1998/03/15 20:50:53 mellon Exp $ Copyright (c) 1997 The Internet Software Consortium. All rights reserved.\n"; +"$Id: dns.c,v 1.8 1998/03/16 06:11:30 mellon Exp $ Copyright (c) 1997 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -150,7 +150,7 @@ static int copy_out_name (base, name, buf) /* Compute a hash on the question. */ -static inline u_int32_t dns_hash_question (struct dns_question *question) +static INLINE u_int32_t dns_hash_question (struct dns_question *question) { u_int32_t sum; u_int32_t remainder; @@ -212,7 +212,8 @@ struct dns_query *find_dns_query (question, new) for (q = dns_query_hash [hash]; q; q = q -> next) { if (q -> question -> type == question -> type && q -> question -> class == question -> class && - !strcmp (q -> question -> data, question -> data)) + !strcmp ((char *)q -> question -> data, + (char *)question -> data)) break; } if (q || !new) { @@ -280,17 +281,17 @@ struct dns_query *ns_inaddr_lookup (inaddr, wakeup) struct dns_question *question; /* First format the query in the internal format. */ - sprintf (query, "%d.%d.%d.%d.in-addr.arpa.", + sprintf ((char *)query, "%d.%d.%d.%d.in-addr.arpa.", inaddr.iabuf [0], inaddr.iabuf [1], inaddr.iabuf [2], inaddr.iabuf [3]); - question = (struct dns_question *)malloc (strlen (query) + + question = (struct dns_question *)malloc (strlen ((char *)query) + sizeof *question); if (!question) return (struct dns_query *)-1; question -> type = T_PTR; question -> class = C_IN; - strcpy (question -> data, query); + strcpy ((char *)question -> data, (char *)query); /* Now format the query for the name server. */ s = query; @@ -298,8 +299,8 @@ struct dns_query *ns_inaddr_lookup (inaddr, wakeup) /* Copy out the digits. */ for (i = 3; i >= 0; --i) { label = s++; - sprintf (s, "%d", inaddr.iabuf [i]); - *label = strlen (s); + sprintf ((char *)s, "%d", inaddr.iabuf [i]); + *label = strlen ((char *)s); s += *label; } s += addlabel (s, "in-addr"); @@ -415,7 +416,7 @@ void dns_timeout (qv) /* Send the query. */ if (query -> next_server) status = sendto (dns_protocol_fd, - query -> query, query -> len, 0, + (char *)query -> query, query -> len, 0, ((struct sockaddr *)&query -> next_server -> addr), sizeof query -> next_server -> addr); @@ -469,7 +470,7 @@ void dns_packet (protocol) struct dns_query *query; len = sizeof from; - status = recvfrom (protocol -> fd, buf, sizeof buf, 0, + status = recvfrom (protocol -> fd, (char *)buf, sizeof buf, 0, (struct sockaddr *)&from, &len); if (status < 0) { warn ("dns_packet: %m"); @@ -501,7 +502,7 @@ void dns_packet (protocol) name = dptr; /* Skip over the name. */ - dptr += copy_out_name (name, name, qbuf.q.data); + dptr += copy_out_name (name, name, (char *)qbuf.q.data); /* Skip over the query type and query class. */ qbuf.q.type = getUShort (dptr); diff --git a/common/hash.c b/common/hash.c index e8e937520..0a95635b2 100644 --- a/common/hash.c +++ b/common/hash.c @@ -42,12 +42,12 @@ #ifndef lint static char copyright[] = -"$Id: hash.c,v 1.9 1996/09/09 07:04:45 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; +"$Id: hash.c,v 1.10 1998/03/16 06:11:51 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" -static INLINE int do_hash PROTO ((char *, int, int)); +static INLINE int do_hash PROTO ((unsigned char *, int, int)); struct hash_table *new_hash () { @@ -60,7 +60,7 @@ struct hash_table *new_hash () } static INLINE int do_hash (name, len, size) - char *name; + unsigned char *name; int len; int size; { @@ -92,7 +92,7 @@ static INLINE int do_hash (name, len, size) void add_hash (table, name, len, pointer) struct hash_table *table; int len; - char *name; + unsigned char *name; unsigned char *pointer; { int hashno; @@ -118,7 +118,7 @@ void add_hash (table, name, len, pointer) void delete_hash_entry (table, name, len) struct hash_table *table; int len; - char *name; + unsigned char *name; { int hashno; struct hash_bucket *bp, *pbp = (struct hash_bucket *)0; @@ -131,7 +131,8 @@ void delete_hash_entry (table, name, len) /* Go through the list looking for an entry that matches; if we find it, delete it. */ for (bp = table -> buckets [hashno]; bp; bp = bp -> next) { - if ((!bp -> len && !strcmp (bp -> name, name)) || + if ((!bp -> len && + !strcmp ((char *)bp -> name, (char *)name)) || (bp -> len == len && !memcmp (bp -> name, name, len))) { if (pbp) { @@ -148,7 +149,7 @@ void delete_hash_entry (table, name, len) unsigned char *hash_lookup (table, name, len) struct hash_table *table; - char *name; + unsigned char *name; int len; { int hashno; @@ -166,7 +167,8 @@ unsigned char *hash_lookup (table, name, len) } } else { for (bp = table -> buckets [hashno]; bp; bp = bp -> next) - if (!strcmp (bp -> name, name)) + if (!strcmp ((char *)bp -> name, + (char *)name)) return bp -> value; } return (unsigned char *)0; diff --git a/common/memory.c b/common/memory.c index af8ea6ebe..96deb9dff 100644 --- a/common/memory.c +++ b/common/memory.c @@ -3,7 +3,7 @@ Memory-resident database... */ /* - * Copyright (c) 1995, 1996 The Internet Software Consortium. + * Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -42,7 +42,7 @@ #ifndef lint static char copyright[] = -"$Id: memory.c,v 1.35 1997/09/16 18:14:18 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; +"$Id: memory.c,v 1.36 1998/03/16 06:13:18 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -837,11 +837,11 @@ struct class *add_class (type, name) class -> name = tname; if (type) - add_hash (user_class_hash, - tname, strlen (tname), (unsigned char *)class); + add_hash (user_class_hash, (unsigned char *)tname, + strlen (tname), (unsigned char *)class); else - add_hash (vendor_class_hash, - tname, strlen (tname), (unsigned char *)class); + add_hash (vendor_class_hash, (unsigned char *)tname, + strlen (tname), (unsigned char *)class); return class; } @@ -851,9 +851,10 @@ struct class *find_class (type, name, len) int len; { struct class *class = - (struct class *)hash_lookup (type - ? user_class_hash - : vendor_class_hash, name, len); + (struct class *)hash_lookup ((type + ? user_class_hash + : vendor_class_hash), + (unsigned char *)name, len); return class; } diff --git a/common/print.c b/common/print.c index 8b5aefd55..df5bcd383 100644 --- a/common/print.c +++ b/common/print.c @@ -3,7 +3,7 @@ Turn data structures into printable text. */ /* - * Copyright (c) 1995, 1996 The Internet Software Consortium. + * Copyright (c) 1995, 1996, 1998 The Internet Software Consortium. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -42,7 +42,7 @@ #ifndef lint static char copyright[] = -"$Id: print.c,v 1.16 1997/11/29 07:52:10 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; +"$Id: print.c,v 1.17 1998/03/16 06:14:21 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -178,7 +178,7 @@ void hash_dump (table) if (bp -> len) dump_raw (bp -> name, bp -> len); else - note (bp -> name); + note ((char *)bp -> name); } } } diff --git a/common/tables.c b/common/tables.c index 81669c84e..34d6260cd 100644 --- a/common/tables.c +++ b/common/tables.c @@ -3,7 +3,7 @@ Tables of information... */ /* - * Copyright (c) 1995, 1996 The Internet Software Consortium. + * Copyright (c) 1995, 1996, 1998 The Internet Software Consortium. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -42,7 +42,7 @@ #ifndef lint static char copyright[] = -"$Id: tables.c,v 1.13 1997/05/09 08:13:38 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; +"$Id: tables.c,v 1.14 1998/03/16 06:15:04 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -681,10 +681,11 @@ void initialize_universes() error ("Can't allocate dhcp option hash table."); for (i = 0; i < 256; i++) { dhcp_universe.options [i] = &dhcp_options [i]; - add_hash (dhcp_universe.hash, dhcp_options [i].name, 0, + add_hash (dhcp_universe.hash, + (unsigned char *)dhcp_options [i].name, 0, (unsigned char *)&dhcp_options [i]); } universe_hash.hash_count = DEFAULT_HASH_SIZE; - add_hash (&universe_hash, dhcp_universe.name, 0, + add_hash (&universe_hash, (unsigned char *)dhcp_universe.name, 0, (unsigned char *)&dhcp_universe); } diff --git a/includes/hash.h b/includes/hash.h index d30072b3c..46381d624 100644 --- a/includes/hash.h +++ b/includes/hash.h @@ -3,7 +3,8 @@ Definitions for hashing... */ /* - * Copyright (c) 1995 The Internet Software Consortium. All rights reserved. + * Copyright (c) 1995, 1998 The Internet Software Consortium. + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -43,7 +44,7 @@ struct hash_bucket { struct hash_bucket *next; - char *name; + unsigned char *name; int len; unsigned char *value; }; diff --git a/server/confpars.c b/server/confpars.c index 1fa81e35c..e9d3b3ba8 100644 --- a/server/confpars.c +++ b/server/confpars.c @@ -42,7 +42,7 @@ #ifndef lint static char copyright[] = -"$Id: confpars.c,v 1.46 1998/03/15 21:16:39 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; +"$Id: confpars.c,v 1.47 1998/03/16 06:17:37 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -890,8 +890,9 @@ void parse_option_param (cfile, group) /* Look up the option name hash table for the specified vendor. */ - universe = (struct universe *)hash_lookup (&universe_hash, - vendor, 0); + universe = ((struct universe *) + hash_lookup (&universe_hash, + (unsigned char *)vendor, 0)); /* If it's not there, we can't parse the rest of the declaration. */ if (!universe) { @@ -907,7 +908,8 @@ void parse_option_param (cfile, group) } /* Look up the actual option info... */ - option = (struct option *)hash_lookup (universe -> hash, val, 0); + option = ((struct option *) + hash_lookup (universe -> hash, (unsigned char *)val, 0)); /* If we didn't get an option structure, it's an undefined option. */ if (!option) {