Fix warnings on alpha and re-enable WARNS=2.

Submitted by:	Mike Barcroft <mike@q9media.com>
This commit is contained in:
Mike Heffner 2001-07-04 21:35:15 +00:00
parent d6580eb1a8
commit 616203938d
2 changed files with 18 additions and 13 deletions

View File

@ -2,6 +2,7 @@
# @(#)Makefile 8.1 (Berkeley) 6/6/93
PROG= chio
WARNS?= 2
SRCS= chio.c
.include <bsd.prog.mk>

View File

@ -63,10 +63,11 @@ static int parse_element_unit __P((char *));
static const char * element_type_name __P((int et));
static int parse_special __P((char *));
static int is_special __P((char *));
static const char *bits_to_string __P((int, const char *));
static const char *bits_to_string __P((ces_status_flags, const char *));
static void find_element __P((char *, u_int16_t *, u_int16_t *));
static struct changer_element_status *get_element_status __P((u_int16_t, u_int16_t));
static struct changer_element_status *get_element_status
__P((unsigned int, unsigned int));
static int do_move __P((const char *, int, char **));
static int do_exchange __P((const char *, int, char **));
@ -689,7 +690,7 @@ do_status(cname, argc, argv)
/* Allocate storage for the status structures. */
cesr.cesr_element_status =
(struct changer_element_status *)
calloc(count, sizeof(struct changer_element_status));
calloc((size_t)count, sizeof(struct changer_element_status));
if (!cesr.cesr_element_status)
errx(1, "can't allocate status storage");
@ -845,7 +846,7 @@ do_voltag(cname, argc, argv)
goto usage;
}
strncpy(csvr.csvr_voltag.cv_volid, argv[2],
strlcpy((char *)csvr.csvr_voltag.cv_volid, argv[2],
sizeof(csvr.csvr_voltag.cv_volid));
if (argc == 4) {
@ -944,7 +945,7 @@ is_special(cp)
static const char *
bits_to_string(v, cp)
int v;
ces_status_flags v;
const char *cp;
{
const char *np;
@ -1006,7 +1007,8 @@ do_return(cname, argc, argv)
}
++argv; --argc;
ces = get_element_status(type, element); /* Get the status */
/* Get the status */
ces = get_element_status((unsigned int)type, (unsigned int)element);
if (NULL == ces)
errx(1, "%s: null element status pointer", cname);
@ -1042,22 +1044,22 @@ do_return(cname, argc, argv)
*/
static struct changer_element_status *
get_element_status(type, element)
u_int16_t type;
u_int16_t element;
unsigned int type;
unsigned int element;
{
struct changer_element_status_request cesr;
struct changer_element_status *ces;
ces = (struct changer_element_status *)
calloc(1, sizeof(struct changer_element_status));
calloc((size_t)1, sizeof(struct changer_element_status));
if (NULL == ces)
errx(1, "can't allocate status storage");
(void)memset(&cesr, 0, sizeof(cesr));
cesr.cesr_element_type = type;
cesr.cesr_element_base = element;
cesr.cesr_element_type = (u_int16_t)type;
cesr.cesr_element_base = (u_int16_t)element;
cesr.cesr_element_count = 1; /* Only this one element */
cesr.cesr_flags |= CESR_VOLTAGS; /* Grab voltags as well */
cesr.cesr_element_status = ces;
@ -1088,7 +1090,8 @@ find_element(voltag, et, eu)
struct changer_params cp;
struct changer_element_status_request cesr;
struct changer_element_status *ch_ces, *ces;
int elem, total_elem, found = 0;
int found = 0;
size_t elem, total_elem;
/*
* Get the changer parameters, we're interested in the counts
@ -1185,7 +1188,8 @@ find_element(voltag, et, eu)
continue;
/* Check to see if it is our target */
if (strcasecmp(voltag, ces->ces_pvoltag.cv_volid) == 0) {
if (strcasecmp(voltag,
(const char *)ces->ces_pvoltag.cv_volid) == 0) {
*et = ces->ces_type;
*eu = ces->ces_addr;
++found;