提交 ee032ca1 编写于 作者: S Stefan Weil 提交者: Stefan Hajnoczi

vnc: Fix packed boolean struct members

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 <aliguori@us.ibm.com>
Signed-off-by: NStefan Weil <sw@weilnetz.de>
Signed-off-by: NStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
上级 b920df5c
...@@ -31,7 +31,9 @@ ...@@ -31,7 +31,9 @@
void vnc_sasl_client_cleanup(VncState *vs) void vnc_sasl_client_cleanup(VncState *vs)
{ {
if (vs->sasl.conn) { 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.encodedLength = vs->sasl.encodedOffset = 0;
vs->sasl.encoded = NULL; vs->sasl.encoded = NULL;
g_free(vs->sasl.username); g_free(vs->sasl.username);
......
...@@ -37,9 +37,9 @@ typedef struct VncDisplaySASL VncDisplaySASL; ...@@ -37,9 +37,9 @@ typedef struct VncDisplaySASL VncDisplaySASL;
struct VncStateSASL { struct VncStateSASL {
sasl_conn_t *conn; sasl_conn_t *conn;
/* If we want to negotiate an SSF layer with client */ /* If we want to negotiate an SSF layer with client */
int wantSSF :1; bool wantSSF;
/* If we are now running the SSF layer */ /* If we are now running the SSF layer */
int runSSF :1; bool runSSF;
/* /*
* If this is non-zero, then wait for that many bytes * If this is non-zero, then wait for that many bytes
* to be written plain, before switching to SSF encoding * to be written plain, before switching to SSF encoding
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册