Received: from eggs.gnu.org ([208.118.235.92]:57900) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S9bci-00034O-4E for qemu-devel@nongnu.org; Mon, 19 Mar 2012 08:23:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S9bcb-0000JV-JR for qemu-devel@nongnu.org; Mon, 19 Mar 2012 08:23:39 -0400 Received: from e06smtp13.uk.ibm.com ([195.75.94.109]:40123) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S9bcb-0000Er-AB for qemu-devel@nongnu.org; Mon, 19 Mar 2012 08:23:33 -0400 Received: from /spool/local by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 19 Mar 2012 12:23:29 -0000 Received: from d06av05.portsmouth.uk.ibm.com (d06av05.portsmouth.uk.ibm.com [9.149.37.229]) by d06nrmr1507.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q2JCN4sn2646178 for ; Mon, 19 Mar 2012 12:23:04 GMT Received: from d06av05.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av05.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q2JCN4vi016134 for ; Mon, 19 Mar 2012 06:23:04 -0600 From: Stefan Hajnoczi Date: Mon, 19 Mar 2012 12:22:54 +0000 Message-Id: <1332159780-31781-3-git-send-email-stefanha@linux.vnet.ibm.com> In-Reply-To: <1332159780-31781-1-git-send-email-stefanha@linux.vnet.ibm.com> References: <1332159780-31781-1-git-send-email-stefanha@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PATCH 2/8] vnc: Fix packed boolean struct members List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Stefan Weil , qemu-devel@nongnu.org, Stefan Hajnoczi From: Stefan Weil This patch fixes warnings reported by splint: For variables which are packed in a single bit, a signed data type like 'int' does not make much sense. There is no obvious reason why the two values should be packed, so I removed the packing and changed the data type to bool because both are used as boolean values. v2: Some versions of gcc complain after this modification, for example gcc (Debian 4.4.5-8) 4.4.5): ui/vnc-auth-sasl.c: In function ‘vnc_sasl_client_cleanup’: ui/vnc-auth-sasl.c:34: error: suggest parentheses around assignment used as truth value Obviously, the compiler does not like code which does bool = unsigned = bool = 0 Splitting that code in three statements works. Cc: Anthony Liguori Signed-off-by: Stefan Weil Signed-off-by: Stefan Hajnoczi --- ui/vnc-auth-sasl.c | 4 +++- ui/vnc-auth-sasl.h | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ui/vnc-auth-sasl.c b/ui/vnc-auth-sasl.c index e2045fc..8fba770 100644 --- a/ui/vnc-auth-sasl.c +++ b/ui/vnc-auth-sasl.c @@ -31,7 +31,9 @@ void vnc_sasl_client_cleanup(VncState *vs) { if (vs->sasl.conn) { - vs->sasl.runSSF = vs->sasl.waitWriteSSF = vs->sasl.wantSSF = 0; + vs->sasl.runSSF = false; + vs->sasl.wantSSF = false; + vs->sasl.waitWriteSSF = 0; vs->sasl.encodedLength = vs->sasl.encodedOffset = 0; vs->sasl.encoded = NULL; g_free(vs->sasl.username); diff --git a/ui/vnc-auth-sasl.h b/ui/vnc-auth-sasl.h index fd9b18a..ee243a9 100644 --- a/ui/vnc-auth-sasl.h +++ b/ui/vnc-auth-sasl.h @@ -37,9 +37,9 @@ typedef struct VncDisplaySASL VncDisplaySASL; struct VncStateSASL { sasl_conn_t *conn; /* If we want to negotiate an SSF layer with client */ - int wantSSF :1; + bool wantSSF; /* If we are now running the SSF layer */ - int runSSF :1; + bool runSSF; /* * If this is non-zero, then wait for that many bytes * to be written plain, before switching to SSF encoding -- 1.7.9.1