[Spice-commits] server/agent-msg-filter.c
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Feb 12 21:03:30 UTC 2019
server/agent-msg-filter.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
New commits:
commit ca7fe46a73410a8d01c6e1daa4447485937770d7
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Sat Feb 9 20:13:39 2019 +0000
agent-msg-filter: Simplify code
Most of the time result is set to AGENT_MSG_FILTER_OK, set at
the beginning and change if necessary.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/agent-msg-filter.c b/server/agent-msg-filter.c
index 458f563b..abead87a 100644
--- a/server/agent-msg-filter.c
+++ b/server/agent-msg-filter.c
@@ -82,35 +82,31 @@ data_to_read:
if (filter->discard_all) {
filter->result = AGENT_MSG_FILTER_DISCARD;
} else {
+ // default, easier to set once
+ filter->result = AGENT_MSG_FILTER_OK;
switch (msg_header.type) {
case VD_AGENT_CLIPBOARD:
case VD_AGENT_CLIPBOARD_GRAB:
case VD_AGENT_CLIPBOARD_REQUEST:
case VD_AGENT_CLIPBOARD_RELEASE:
- if (filter->copy_paste_enabled) {
- filter->result = AGENT_MSG_FILTER_OK;
- } else {
+ if (!filter->copy_paste_enabled) {
filter->result = AGENT_MSG_FILTER_DISCARD;
}
break;
case VD_AGENT_FILE_XFER_START:
case VD_AGENT_FILE_XFER_STATUS:
case VD_AGENT_FILE_XFER_DATA:
- if (filter->file_xfer_enabled) {
- filter->result = AGENT_MSG_FILTER_OK;
- } else {
+ if (!filter->file_xfer_enabled) {
filter->result = AGENT_MSG_FILTER_DISCARD;
}
break;
case VD_AGENT_MONITORS_CONFIG:
if (filter->use_client_monitors_config) {
filter->result = AGENT_MSG_FILTER_MONITORS_CONFIG;
- } else {
- filter->result = AGENT_MSG_FILTER_OK;
}
break;
default:
- filter->result = AGENT_MSG_FILTER_OK;
+ break;
}
}
More information about the Spice-commits
mailing list