From owner-freebsd-hackers@FreeBSD.ORG Sat Oct 15 05:36:48 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A9BDC106566C for ; Sat, 15 Oct 2011 05:36:48 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 463268FC08 for ; Sat, 15 Oct 2011 05:36:47 +0000 (UTC) Received: by wyi40 with SMTP id 40so276046wyi.13 for ; Fri, 14 Oct 2011 22:36:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eitanadler.com; s=0xdeadbeef; h=mime-version:from:date:message-id:subject:to:content-type; bh=a4UNeM/i3H8EVU5QLCFRznIYcnTm5KNLE/puGgaxUpk=; b=qNIBl+QVqHqx6NM71Mo6TgG34F7bTv3nepbjRqQ3FEiaiu6jEMQaPh7TL2VH8B8Vcr OORDxILVuvYyKi/uVLntV7pGC3IhaMHWfrGeOOIATNi2n8koyBCk8xNX0M1jRvVyW7RD 1dFNkpjjiuiOsDqUglTgFBRTLNIou85tzdvuY= Received: by 10.227.61.142 with SMTP id t14mr3413176wbh.68.1318657007069; Fri, 14 Oct 2011 22:36:47 -0700 (PDT) MIME-Version: 1.0 Received: by 10.227.200.72 with HTTP; Fri, 14 Oct 2011 22:36:17 -0700 (PDT) From: Eitan Adler Date: Sat, 15 Oct 2011 01:36:17 -0400 Message-ID: To: FreeBSD Hackers Content-Type: text/plain; charset=UTF-8 Subject: fix some warnings with sbin/camcontrol X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Oct 2011 05:36:48 -0000 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