From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:45928) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S5lLf-0003Tn-Qn for qemu-devel@nongnu.org; Thu, 08 Mar 2012 16:58:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S5lLd-0000RL-Ro for qemu-devel@nongnu.org; Thu, 08 Mar 2012 16:58:11 -0500 From: Stefan Weil Date: Thu, 8 Mar 2012 22:58:06 +0100 Message-Id: <1331243886-19117-1-git-send-email-sw@weilnetz.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH v2] vnc: Fix packed boolean struct members List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: qemu-trivial , Stefan Weil , Anthony Liguori 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 =E2=80=98vnc_sasl_client_cleanup=E2=80=99= : 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 =3D unsigned =3D bool =3D 0 Splitting that code in three statements works. Cc: Anthony Liguori Signed-off-by: Stefan Weil --- 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 =3D vs->sasl.waitWriteSSF =3D vs->sasl.wantSSF =3D= 0; + vs->sasl.runSSF =3D false; + vs->sasl.wantSSF =3D false; + vs->sasl.waitWriteSSF =3D 0; vs->sasl.encodedLength =3D vs->sasl.encodedOffset =3D 0; vs->sasl.encoded =3D 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 --=20 1.7.9