summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormikeh <mikeh@FreeBSD.org>2001-07-04 21:35:15 +0000
committermikeh <mikeh@FreeBSD.org>2001-07-04 21:35:15 +0000
commit04b5406a227d99e550191eb7d24720be3991a9bd (patch)
treeabe23100585f810499115c0f6abbd77ad4778068
parent950055e75ffb426f1206e8e51d2577dbe7aed73e (diff)
downloadFreeBSD-src-04b5406a227d99e550191eb7d24720be3991a9bd.zip
FreeBSD-src-04b5406a227d99e550191eb7d24720be3991a9bd.tar.gz
Fix warnings on alpha and re-enable WARNS=2.
Submitted by: Mike Barcroft <mike@q9media.com>
-rw-r--r--bin/chio/Makefile1
-rw-r--r--bin/chio/chio.c30
2 files changed, 18 insertions, 13 deletions
diff --git a/bin/chio/Makefile b/bin/chio/Makefile
index 1720328..33bde4b 100644
--- a/bin/chio/Makefile
+++ b/bin/chio/Makefile
@@ -2,6 +2,7 @@
# @(#)Makefile 8.1 (Berkeley) 6/6/93
PROG= chio
+WARNS?= 2
SRCS= chio.c
.include <bsd.prog.mk>
diff --git a/bin/chio/chio.c b/bin/chio/chio.c
index 17df125..13392ee 100644
--- a/bin/chio/chio.c
+++ b/bin/chio/chio.c
@@ -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 @@ usage:
*/
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;
OpenPOWER on IntegriCloud