[Spice-devel,xf86-video-qxl,v2,cleanup,2/6] spiceqxl_inputs: fix const discard at initialization warnings

Submitted by Alon Levy on April 24, 2012, 9:21 a.m.

Details

Message ID 1335259287-23125-2-git-send-email-alevy@redhat.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Alon Levy April 24, 2012, 9:21 a.m.
---
 src/spiceqxl_inputs.c |   64 ++++++++++++++++++++++++++++---------------------
 1 file changed, 37 insertions(+), 27 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/spiceqxl_inputs.c b/src/spiceqxl_inputs.c
index 62ef19f..5cfa823 100644
--- a/src/spiceqxl_inputs.c
+++ b/src/spiceqxl_inputs.c
@@ -46,26 +46,6 @@  void XSpicePointerUnInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags);
 static
 void XSpiceKeyboardUnInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags);
 
-static InputDriverRec XSPICE_POINTER = {
-    1,
-    "xspice pointer",
-    NULL,
-    XSpicePointerPreInit,
-    XSpicePointerUnInit,
-    NULL,
-    NULL /* defaults */
-};
-
-static InputDriverRec XSPICE_KEYBOARD = {
-    1,
-    "xspice keyboard",
-    NULL,
-    XSpiceKeyboardPreInit,
-    XSpiceKeyboardUnInit,
-    NULL,
-    NULL
-};
-
 #define BUTTONS 5
 
 typedef struct XSpiceKbd {
@@ -152,12 +132,17 @@  static void xspice_keyboard_control(DeviceIntPtr device, KeybdCtrl *ctrl)
 static int xspice_keyboard_proc(DeviceIntPtr pDevice, int onoff)
 {
     DevicePtr pDev = (DevicePtr)pDevice;
+    char rules[] = "evdev";
+    char model[] = "pc105";
+    char layout[] = "us";
+    char variant[] = "";
+    char options[] = "";
     XkbRMLVOSet rmlvo = {
-        .rules = "evdev",
-        .model = "pc105",
-        .layout = "us",
-        .variant = "",
-        .options = "",
+        .rules = rules,
+        .model = model,
+        .layout = layout,
+        .variant = variant,
+        .options = options,
     };
 
     switch (onoff) {
@@ -354,13 +339,14 @@  static int
 XSpiceKeyboardPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
 {
     XSpiceKbd *kbd;
+    static char type_name[] = "UNKNOWN";
 
     kbd = calloc(sizeof(*kbd), 1);
     kbd->sin.base.sif = &kbd_interface.base;
     kbd->pInfo = pInfo;
 
     pInfo->private = kbd;
-    pInfo->type_name = "UNKNOWN";
+    pInfo->type_name = type_name;
     pInfo->device_control = xspice_keyboard_proc;
     pInfo->read_input = NULL;
     pInfo->switch_mode = NULL;
@@ -373,6 +359,7 @@  static int
 XSpicePointerPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
 {
     XSpicePointer *pointer;
+    static char type_name[] = "UNKNOWN";
 
     pointer = calloc(sizeof(*pointer), 1);
     pointer->mouse.base.sif  = &mouse_interface.base;
@@ -381,7 +368,7 @@  XSpicePointerPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
     pointer->pInfo = pInfo;
 
     pInfo->private = NULL;
-    pInfo->type_name = "UNKNOWN";
+    pInfo->type_name = type_name;
     pInfo->device_control = xspice_pointer_proc;
     pInfo->read_input = NULL;
     pInfo->switch_mode = NULL;
@@ -402,6 +389,29 @@  XSpiceKeyboardUnInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
 
 void xspice_add_input_drivers(pointer module)
 {
+    char xspice_pointer[] = "xspice pointer";
+    char xspice_keyboard[] = "xspice keyboard";
+
+    InputDriverRec XSPICE_POINTER = {
+        1,
+        xspice_pointer,
+        NULL,
+        XSpicePointerPreInit,
+        XSpicePointerUnInit,
+        NULL,
+        NULL /* defaults */
+    };
+
+    InputDriverRec XSPICE_KEYBOARD = {
+        1,
+        xspice_keyboard,
+        NULL,
+        XSpiceKeyboardPreInit,
+        XSpiceKeyboardUnInit,
+        NULL,
+        NULL
+    };
+
     xf86AddInputDriver(&XSPICE_POINTER, module, 0);
     xf86AddInputDriver(&XSPICE_KEYBOARD, module, 0);
 }