[Spice-commits] server/display-channel.c

Frediano Ziglio fziglio at kemper.freedesktop.org
Fri Sep 30 12:13:44 UTC 2016


 server/display-channel.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

New commits:
commit 3e51627991f6315a795a50e7df845904c70514a2
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Sun Sep 18 03:08:50 2016 +0100

    Cache field to make code easier
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Victor Toso <victortoso at redhat.com>

diff --git a/server/display-channel.c b/server/display-channel.c
index d7ea7d5..32f8e67 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -1976,22 +1976,23 @@ void display_channel_process_surface_cmd(DisplayChannel *display,
 
     switch (surface_cmd->type) {
     case QXL_SURFACE_CMD_CREATE: {
-        uint32_t height = surface_cmd->u.surface_create.height;
-        int32_t stride = surface_cmd->u.surface_create.stride;
+        const RedSurfaceCreate *create = &surface_cmd->u.surface_create;
+        uint32_t height = create->height;
+        int32_t stride = create->stride;
         int reloaded_surface = loadvm || (surface_cmd->flags & QXL_SURF_FLAG_KEEP_DATA);
 
         if (surface->refs) {
             spice_warning("avoiding creating a surface twice");
             break;
         }
-        data = surface_cmd->u.surface_create.data;
+        data = create->data;
         if (stride < 0) {
             /* No need to worry about overflow here, command should already be validated
              * when it is read, specifically red_get_surface_cmd */
             data -= (int32_t)(stride * (height - 1));
         }
-        display_channel_create_surface(display, surface_id, surface_cmd->u.surface_create.width,
-                                       height, stride, surface_cmd->u.surface_create.format, data,
+        display_channel_create_surface(display, surface_id, create->width,
+                                       height, stride, create->format, data,
                                        reloaded_surface,
                                        // reloaded surfaces will be sent on demand
                                        !reloaded_surface);


More information about the Spice-commits mailing list