[PATCH spice-server v5 03/18] windows: Do not use conflicting preprocessor macros

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"interface" and "MAX_MONITORS" are defined in some Windows system
headers causing garbage code to be fed to the compiler.

Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
---
 server/red-qxl.c | 52 ++++++++++++++++++------------------
 server/reds.c    | 68 ++++++++++++++++++++++++------------------------
 2 files changed, 60 insertions(+), 60 deletions(-)

diff --git a/server/red-qxl.c b/server/red-qxl.c
index 6dbd224ca..914fcfb21 100644
--- a/server/red-qxl.c
+++ b/server/red-qxl.c
@@ -968,95 +968,95 @@ RedsState* red_qxl_get_server(QXLState *qxl_state)
 
 void red_qxl_attach_worker(QXLInstance *qxl)
 {
-    QXLInterface *interface = qxl_get_interface(qxl);
-    interface->attache_worker(qxl, &qxl->st->qxl_worker);
+    QXLInterface *qxl_interface = qxl_get_interface(qxl);
+    qxl_interface->attache_worker(qxl, &qxl->st->qxl_worker);
 }
 
 void red_qxl_set_compression_level(QXLInstance *qxl, int level)
 {
-    QXLInterface *interface = qxl_get_interface(qxl);
-    interface->set_compression_level(qxl, level);
+    QXLInterface *qxl_interface = qxl_get_interface(qxl);
+    qxl_interface->set_compression_level(qxl, level);
 }
 
 void red_qxl_get_init_info(QXLInstance *qxl, QXLDevInitInfo *info)
 {
-    QXLInterface *interface = qxl_get_interface(qxl);
+    QXLInterface *qxl_interface = qxl_get_interface(qxl);
 
-    interface->get_init_info(qxl, info);
+    qxl_interface->get_init_info(qxl, info);
 }
 
 int red_qxl_get_command(QXLInstance *qxl, struct QXLCommandExt *cmd)
 {
-    QXLInterface *interface = qxl_get_interface(qxl);
+    QXLInterface *qxl_interface = qxl_get_interface(qxl);
 
-    return interface->get_command(qxl, cmd);
+    return qxl_interface->get_command(qxl, cmd);
 }
 
 int red_qxl_req_cmd_notification(QXLInstance *qxl)
 {
-    QXLInterface *interface = qxl_get_interface(qxl);
+    QXLInterface *qxl_interface = qxl_get_interface(qxl);
 
-    return interface->req_cmd_notification(qxl);
+    return qxl_interface->req_cmd_notification(qxl);
 }
 
 void red_qxl_release_resource(QXLInstance *qxl, struct QXLReleaseInfoExt release_info)
 {
-    QXLInterface *interface = qxl_get_interface(qxl);
+    QXLInterface *qxl_interface = qxl_get_interface(qxl);
 
-    interface->release_resource(qxl, release_info);
+    qxl_interface->release_resource(qxl, release_info);
 }
 
 int red_qxl_get_cursor_command(QXLInstance *qxl, struct QXLCommandExt *cmd)
 {
-    QXLInterface *interface = qxl_get_interface(qxl);
+    QXLInterface *qxl_interface = qxl_get_interface(qxl);
 
-    return interface->get_cursor_command(qxl, cmd);
+    return qxl_interface->get_cursor_command(qxl, cmd);
 }
 
 int red_qxl_req_cursor_notification(QXLInstance *qxl)
 {
-    QXLInterface *interface = qxl_get_interface(qxl);
+    QXLInterface *qxl_interface = qxl_get_interface(qxl);
 
-    return interface->req_cursor_notification(qxl);
+    return qxl_interface->req_cursor_notification(qxl);
 }
 
 void red_qxl_notify_update(QXLInstance *qxl, uint32_t update_id)
 {
-    QXLInterface *interface = qxl_get_interface(qxl);
+    QXLInterface *qxl_interface = qxl_get_interface(qxl);
 
-    interface->notify_update(qxl, update_id);
+    qxl_interface->notify_update(qxl, update_id);
 }
 
 int red_qxl_flush_resources(QXLInstance *qxl)
 {
-    QXLInterface *interface = qxl_get_interface(qxl);
+    QXLInterface *qxl_interface = qxl_get_interface(qxl);
 
-    return interface->flush_resources(qxl);
+    return qxl_interface->flush_resources(qxl);
 }
 
 void red_qxl_update_area_complete(QXLInstance *qxl, uint32_t surface_id,
                                   struct QXLRect *updated_rects,
                                   uint32_t num_updated_rects)
 {
-    QXLInterface *interface = qxl_get_interface(qxl);
+    QXLInterface *qxl_interface = qxl_get_interface(qxl);
 
-    interface->update_area_complete(qxl, surface_id, updated_rects, num_updated_rects);
+    qxl_interface->update_area_complete(qxl, surface_id, updated_rects, num_updated_rects);
 }
 
 void red_qxl_set_client_capabilities(QXLInstance *qxl,
                                      uint8_t client_present,
                                      uint8_t caps[SPICE_CAPABILITIES_SIZE])
 {
-    QXLInterface *interface = qxl_get_interface(qxl);
+    QXLInterface *qxl_interface = qxl_get_interface(qxl);
 
     if (qxl->st->running) {
-        interface->set_client_capabilities(qxl, client_present, caps);
+        qxl_interface->set_client_capabilities(qxl, client_present, caps);
     }
 }
 
 void red_qxl_async_complete(QXLInstance *qxl, uint64_t cookie)
 {
-    QXLInterface *interface = qxl_get_interface(qxl);
+    QXLInterface *qxl_interface = qxl_get_interface(qxl);
 
-    interface->async_complete(qxl, cookie);
+    qxl_interface->async_complete(qxl, cookie);
 }
diff --git a/server/reds.c b/server/reds.c
index 302da5858..0aae3589f 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -1262,9 +1262,9 @@ void reds_release_agent_data_buffer(RedsState *reds, uint8_t *buf)
 static void reds_on_main_agent_monitors_config(RedsState *reds,
         MainChannelClient *mcc, const void *message, size_t size)
 {
-    const unsigned int MAX_MONITORS = 256;
+    const unsigned int MAX_NUM_MONITORS = 256;
     const unsigned int MAX_MONITOR_CONFIG_SIZE =
-       sizeof(VDAgentMonitorsConfig) + MAX_MONITORS * sizeof(VDAgentMonConfig);
+       sizeof(VDAgentMonitorsConfig) + MAX_NUM_MONITORS * sizeof(VDAgentMonConfig);
 
     VDAgentMessage *msg_header;
     VDAgentMonitorsConfig *monitors_config;
@@ -3387,12 +3387,12 @@ static int spice_server_char_device_remove_interface(RedsState *reds, SpiceBaseI
 SPICE_GNUC_VISIBLE int spice_server_add_interface(SpiceServer *reds,
                                                   SpiceBaseInstance *sin)
 {
-    const SpiceBaseInterface *interface = sin->sif;
+    const SpiceBaseInterface *base_interface = sin->sif;
 
-    if (strcmp(interface->type, SPICE_INTERFACE_KEYBOARD) == 0) {
+    if (strcmp(base_interface->type, SPICE_INTERFACE_KEYBOARD) == 0) {
         spice_debug("SPICE_INTERFACE_KEYBOARD");
-        if (interface->major_version != SPICE_INTERFACE_KEYBOARD_MAJOR ||
-            interface->minor_version > SPICE_INTERFACE_KEYBOARD_MINOR) {
+        if (base_interface->major_version != SPICE_INTERFACE_KEYBOARD_MAJOR ||
+            base_interface->minor_version > SPICE_INTERFACE_KEYBOARD_MINOR) {
             spice_warning("unsupported keyboard interface");
             return -1;
         }
@@ -3400,10 +3400,10 @@ SPICE_GNUC_VISIBLE int spice_server_add_interface(SpiceServer *reds,
                                         SPICE_UPCAST(SpiceKbdInstance, sin)) != 0) {
             return -1;
         }
-    } else if (strcmp(interface->type, SPICE_INTERFACE_MOUSE) == 0) {
+    } else if (strcmp(base_interface->type, SPICE_INTERFACE_MOUSE) == 0) {
         spice_debug("SPICE_INTERFACE_MOUSE");
-        if (interface->major_version != SPICE_INTERFACE_MOUSE_MAJOR ||
-            interface->minor_version > SPICE_INTERFACE_MOUSE_MINOR) {
+        if (base_interface->major_version != SPICE_INTERFACE_MOUSE_MAJOR ||
+            base_interface->minor_version > SPICE_INTERFACE_MOUSE_MINOR) {
             spice_warning("unsupported mouse interface");
             return -1;
         }
@@ -3411,12 +3411,12 @@ SPICE_GNUC_VISIBLE int spice_server_add_interface(SpiceServer *reds,
                                      SPICE_UPCAST(SpiceMouseInstance, sin)) != 0) {
             return -1;
         }
-    } else if (strcmp(interface->type, SPICE_INTERFACE_QXL) == 0) {
+    } else if (strcmp(base_interface->type, SPICE_INTERFACE_QXL) == 0) {
         QXLInstance *qxl;
 
         spice_debug("SPICE_INTERFACE_QXL");
-        if (interface->major_version != SPICE_INTERFACE_QXL_MAJOR ||
-            interface->minor_version > SPICE_INTERFACE_QXL_MINOR) {
+        if (base_interface->major_version != SPICE_INTERFACE_QXL_MAJOR ||
+            base_interface->minor_version > SPICE_INTERFACE_QXL_MINOR) {
             spice_warning("unsupported qxl interface");
             return -1;
         }
@@ -3440,11 +3440,11 @@ SPICE_GNUC_VISIBLE int spice_server_add_interface(SpiceServer *reds,
          * be called. */
         red_qxl_attach_worker(qxl);
         red_qxl_set_compression_level(qxl, calc_compression_level(reds));
-    } else if (strcmp(interface->type, SPICE_INTERFACE_TABLET) == 0) {
+    } else if (strcmp(base_interface->type, SPICE_INTERFACE_TABLET) == 0) {
         SpiceTabletInstance *tablet = SPICE_UPCAST(SpiceTabletInstance, sin);
         spice_debug("SPICE_INTERFACE_TABLET");
-        if (interface->major_version != SPICE_INTERFACE_TABLET_MAJOR ||
-            interface->minor_version > SPICE_INTERFACE_TABLET_MINOR) {
+        if (base_interface->major_version != SPICE_INTERFACE_TABLET_MAJOR ||
+            base_interface->minor_version > SPICE_INTERFACE_TABLET_MINOR) {
             spice_warning("unsupported tablet interface");
             return -1;
         }
@@ -3456,41 +3456,41 @@ SPICE_GNUC_VISIBLE int spice_server_add_interface(SpiceServer *reds,
             inputs_channel_set_tablet_logical_size(reds->inputs_channel, reds->monitor_mode.x_res, reds->monitor_mode.y_res);
         }
 
-    } else if (strcmp(interface->type, SPICE_INTERFACE_PLAYBACK) == 0) {
+    } else if (strcmp(base_interface->type, SPICE_INTERFACE_PLAYBACK) == 0) {
         spice_debug("SPICE_INTERFACE_PLAYBACK");
-        if (interface->major_version != SPICE_INTERFACE_PLAYBACK_MAJOR ||
-            interface->minor_version > SPICE_INTERFACE_PLAYBACK_MINOR) {
+        if (base_interface->major_version != SPICE_INTERFACE_PLAYBACK_MAJOR ||
+            base_interface->minor_version > SPICE_INTERFACE_PLAYBACK_MINOR) {
             spice_warning("unsupported playback interface");
             return -1;
         }
         snd_attach_playback(reds, SPICE_UPCAST(SpicePlaybackInstance, sin));
 
-    } else if (strcmp(interface->type, SPICE_INTERFACE_RECORD) == 0) {
+    } else if (strcmp(base_interface->type, SPICE_INTERFACE_RECORD) == 0) {
         spice_debug("SPICE_INTERFACE_RECORD");
-        if (interface->major_version != SPICE_INTERFACE_RECORD_MAJOR ||
-            interface->minor_version > SPICE_INTERFACE_RECORD_MINOR) {
+        if (base_interface->major_version != SPICE_INTERFACE_RECORD_MAJOR ||
+            base_interface->minor_version > SPICE_INTERFACE_RECORD_MINOR) {
             spice_warning("unsupported record interface");
             return -1;
         }
         snd_attach_record(reds, SPICE_UPCAST(SpiceRecordInstance, sin));
 
-    } else if (strcmp(interface->type, SPICE_INTERFACE_CHAR_DEVICE) == 0) {
-        if (interface->major_version != SPICE_INTERFACE_CHAR_DEVICE_MAJOR ||
-            interface->minor_version > SPICE_INTERFACE_CHAR_DEVICE_MINOR) {
+    } else if (strcmp(base_interface->type, SPICE_INTERFACE_CHAR_DEVICE) == 0) {
+        if (base_interface->major_version != SPICE_INTERFACE_CHAR_DEVICE_MAJOR ||
+            base_interface->minor_version > SPICE_INTERFACE_CHAR_DEVICE_MINOR) {
             spice_warning("unsupported char device interface");
             return -1;
         }
         spice_server_char_device_add_interface(reds, sin);
 
-    } else if (strcmp(interface->type, SPICE_INTERFACE_MIGRATION) == 0) {
+    } else if (strcmp(base_interface->type, SPICE_INTERFACE_MIGRATION) == 0) {
         spice_debug("SPICE_INTERFACE_MIGRATION");
         if (reds->migration_interface) {
             spice_warning("already have migration");
             return -1;
         }
 
-        if (interface->major_version != SPICE_INTERFACE_MIGRATION_MAJOR ||
-            interface->minor_version > SPICE_INTERFACE_MIGRATION_MINOR) {
+        if (base_interface->major_version != SPICE_INTERFACE_MIGRATION_MAJOR ||
+            base_interface->minor_version > SPICE_INTERFACE_MIGRATION_MINOR) {
             spice_warning("unsupported migration interface");
             return -1;
         }
@@ -3504,30 +3504,30 @@ SPICE_GNUC_VISIBLE int spice_server_add_interface(SpiceServer *reds,
 SPICE_GNUC_VISIBLE int spice_server_remove_interface(SpiceBaseInstance *sin)
 {
     RedsState *reds;
-    const SpiceBaseInterface *interface;
+    const SpiceBaseInterface *base_interface;
 
     g_return_val_if_fail(sin != NULL, -1);
 
-    interface = sin->sif;
-    if (strcmp(interface->type, SPICE_INTERFACE_TABLET) == 0) {
+    base_interface = sin->sif;
+    if (strcmp(base_interface->type, SPICE_INTERFACE_TABLET) == 0) {
         SpiceTabletInstance *tablet = SPICE_UPCAST(SpiceTabletInstance, sin);
         g_return_val_if_fail(tablet->st != NULL, -1);
         reds = spice_tablet_state_get_server(tablet->st);
         spice_debug("remove SPICE_INTERFACE_TABLET");
         inputs_channel_detach_tablet(reds->inputs_channel, tablet);
         reds_update_mouse_mode(reds);
-    } else if (strcmp(interface->type, SPICE_INTERFACE_PLAYBACK) == 0) {
+    } else if (strcmp(base_interface->type, SPICE_INTERFACE_PLAYBACK) == 0) {
         spice_debug("remove SPICE_INTERFACE_PLAYBACK");
         snd_detach_playback(SPICE_UPCAST(SpicePlaybackInstance, sin));
-    } else if (strcmp(interface->type, SPICE_INTERFACE_RECORD) == 0) {
+    } else if (strcmp(base_interface->type, SPICE_INTERFACE_RECORD) == 0) {
         spice_debug("remove SPICE_INTERFACE_RECORD");
         snd_detach_record(SPICE_UPCAST(SpiceRecordInstance, sin));
-    } else if (strcmp(interface->type, SPICE_INTERFACE_CHAR_DEVICE) == 0) {
+    } else if (strcmp(base_interface->type, SPICE_INTERFACE_CHAR_DEVICE) == 0) {
         SpiceCharDeviceInstance *char_device = SPICE_UPCAST(SpiceCharDeviceInstance, sin);
         g_return_val_if_fail(char_device->st != NULL, -1);
         reds = red_char_device_get_server(char_device->st);
         return spice_server_char_device_remove_interface(reds, sin);
-    } else if (strcmp(interface->type, SPICE_INTERFACE_QXL) == 0) {
+    } else if (strcmp(base_interface->type, SPICE_INTERFACE_QXL) == 0) {
         QXLInstance *qxl;
 
         qxl = SPICE_UPCAST(QXLInstance, sin);
-- 
2.20.1

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]