Blame SOURCES/0005-x11-randr-Avoid-passing-XEvent-as-value.patch

0985ad
From b6dfef73f2926c65ed146eea6ab061dd87d77f10 Mon Sep 17 00:00:00 2001
0985ad
From: Frediano Ziglio <fziglio@redhat.com>
0985ad
Date: Wed, 19 Dec 2018 18:25:51 +0000
0985ad
Subject: [PATCH 5/9] x11-randr: Avoid passing XEvent as value
0985ad
0985ad
The structure is not that small and is not necessary to copy
0985ad
the value.
0985ad
This also removed a Coverity warning.
0985ad
0985ad
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
0985ad
Acked-by: Victor Toso <victortoso@redhat.com>
0985ad
---
0985ad
 src/vdagent/x11-priv.h  | 2 +-
0985ad
 src/vdagent/x11-randr.c | 8 ++++----
0985ad
 src/vdagent/x11.c       | 2 +-
0985ad
 3 files changed, 6 insertions(+), 6 deletions(-)
0985ad
0985ad
diff --git a/src/vdagent/x11-priv.h b/src/vdagent/x11-priv.h
0985ad
index 99676d2..730b9b3 100644
0985ad
--- a/src/vdagent/x11-priv.h
0985ad
+++ b/src/vdagent/x11-priv.h
0985ad
@@ -152,7 +152,7 @@ void vdagent_x11_send_daemon_guest_xorg_res(struct vdagent_x11 *x11,
0985ad
 void vdagent_x11_randr_handle_root_size_change(struct vdagent_x11 *x11,
0985ad
                                             int screen, int width, int height);
0985ad
 int vdagent_x11_randr_handle_event(struct vdagent_x11 *x11,
0985ad
-    XEvent event);
0985ad
+    const XEvent *event);
0985ad
 void vdagent_x11_set_error_handler(struct vdagent_x11 *x11,
0985ad
     int (*handler)(Display *, XErrorEvent *));
0985ad
 int vdagent_x11_restore_error_handler(struct vdagent_x11 *x11);
0985ad
diff --git a/src/vdagent/x11-randr.c b/src/vdagent/x11-randr.c
0985ad
index 4b022d6..3fb7a68 100644
0985ad
--- a/src/vdagent/x11-randr.c
0985ad
+++ b/src/vdagent/x11-randr.c
0985ad
@@ -529,14 +529,14 @@ void vdagent_x11_randr_handle_root_size_change(struct vdagent_x11 *x11,
0985ad
 }
0985ad
 
0985ad
 int vdagent_x11_randr_handle_event(struct vdagent_x11 *x11,
0985ad
-    XEvent event)
0985ad
+    const XEvent *event)
0985ad
 {
0985ad
     int handled = TRUE;
0985ad
 
0985ad
-    switch (event.type - x11->xrandr_event_base) {
0985ad
+    switch (event->type - x11->xrandr_event_base) {
0985ad
         case RRScreenChangeNotify: {
0985ad
-            XRRScreenChangeNotifyEvent *sce =
0985ad
-                (XRRScreenChangeNotifyEvent *) &event;
0985ad
+            const XRRScreenChangeNotifyEvent *sce =
0985ad
+                (const XRRScreenChangeNotifyEvent *) event;
0985ad
             vdagent_x11_randr_handle_root_size_change(x11, 0,
0985ad
                 sce->width, sce->height);
0985ad
             break;
0985ad
diff --git a/src/vdagent/x11.c b/src/vdagent/x11.c
0985ad
index c2515a8..61d7c69 100644
0985ad
--- a/src/vdagent/x11.c
0985ad
+++ b/src/vdagent/x11.c
0985ad
@@ -545,7 +545,7 @@ static void vdagent_x11_handle_event(struct vdagent_x11 *x11, XEvent event)
0985ad
     }
0985ad
 #endif
0985ad
 
0985ad
-    if (vdagent_x11_randr_handle_event(x11, event))
0985ad
+    if (vdagent_x11_randr_handle_event(x11, &event))
0985ad
         return;
0985ad
 
0985ad
     switch (event.type) {
0985ad
-- 
0985ad
2.21.0
0985ad