Commit 69858972 authored by Ted Lemon's avatar Ted Lemon
Browse files

Clean up unsigned char vs. signed char discrepencies.

parent 15c1fd2c
......@@ -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);
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -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);
}
}
}
......@@ -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);
}
......@@ -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;
};
......
......@@ -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) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment