fix some warnings with sbin/camcontrol
Eitan Adler
lists at eitanadler.com
Sat Oct 15 05:36:48 UTC 2011
The following patch reduced the number of warnings camcontrol produces
when compiled with clang to 29 from over 50
Index: camcontrol.c
===================================================================
--- camcontrol.c (revision 226375)
+++ camcontrol.c (working copy)
@@ -455,7 +455,7 @@
}
case DEV_MATCH_DEVICE: {
struct device_match_result *dev_result;
- char vendor[16], product[48], revision[16];
+ unsigned char vendor[16], product[48], revision[16];
char tmpstr[256];
dev_result =
@@ -1456,12 +1456,12 @@
while (isspace(*tstr) && (*tstr != '\0'))
tstr++;
- tmpstr = (char *)strtok(tstr, ":");
+ tmpstr = strtok(tstr, ":");
if ((tmpstr != NULL) && (*tmpstr != '\0')) {
*bus = strtol(tmpstr, NULL, 0);
*arglst |= CAM_ARG_BUS;
convs++;
- tmpstr = (char *)strtok(NULL, ":");
+ tmpstr = strtok(NULL, ":");
if ((tmpstr != NULL) && (*tmpstr != '\0')) {
*target = strtol(tmpstr, NULL, 0);
*arglst |= CAM_ARG_TARGET;
@@ -2506,7 +2506,7 @@
if (((retval = cam_send_ccb(device, ccb)) < 0)
|| ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)) {
- const char *warnstr = "error sending command";
+ const char * const warnstr = "error sending command";
if (retval < 0)
warn(warnstr);
@@ -4469,7 +4469,7 @@
if (((retval = cam_send_ccb(device, ccb)) < 0)
|| ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)) {
- const char *warnstr = "error sending command";
+ const char * const warnstr = "error sending command";
if (retval < 0)
warn(warnstr);
@@ -4587,7 +4587,7 @@
if (((retval = cam_send_ccb(device, ccb)) < 0)
|| ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)) {
- const char *warnstr = "error sending command";
+ const char * const warnstr = "error sending command";
if (retval < 0)
warn(warnstr);
@@ -4892,7 +4892,7 @@
if (((retval = cam_send_ccb(device, ccb)) < 0)
|| ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)) {
- const char *warnstr = "error sending command";
+ const char * const warnstr = "error sending command";
if (retval < 0)
warn(warnstr);
@@ -4974,7 +4974,7 @@
if (((retval = cam_send_ccb(device, ccb)) < 0)
|| ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)) {
- const char *warnstr = "error sending command";
+ const char * const warnstr = "error sending command";
if (retval < 0)
warn(warnstr);
@@ -5371,7 +5371,7 @@
if (((retval = cam_send_ccb(device, ccb)) < 0)
|| ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)) {
- const char *warnstr = "error sending command";
+ const char * const warnstr = "error sending command";
if (retval < 0)
warn(warnstr);
@@ -5426,7 +5426,7 @@
for (i = 0; i < num_phys; i++) {
struct cam_devitem *item;
struct device_match_result *dev_match;
- char vendor[16], product[48], revision[16];
+ unsigned char vendor[16], product[48], revision[16];
char tmpstr[256];
int j;
@@ -5451,7 +5451,7 @@
if (((retval = cam_send_ccb(device, ccb)) < 0)
|| (((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)
&& (disresponse->function_result != SMP_FR_PHY_VACANT))) {
- const char *warnstr = "error sending command";
+ const char * const warnstr = "error sending command";
if (retval < 0)
warn(warnstr);
--
Eitan Adler
More information about the freebsd-hackers
mailing list