xi: More warning cleanup for input
Lots more const char stuff. Remove duplicate defs of CoreKeyboardProc and CorePointerProc from test/xi2/protocol-common.c Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
parent
af04cf6968
commit
fecc7eb1cf
|
@ -1169,8 +1169,8 @@ IResetProc(ExtensionEntry * unused)
|
||||||
EventSwapVector[DevicePropertyNotify] = NotImplemented;
|
EventSwapVector[DevicePropertyNotify] = NotImplemented;
|
||||||
RestoreExtensionEvents();
|
RestoreExtensionEvents();
|
||||||
|
|
||||||
free(xi_all_devices.name);
|
free((void *) xi_all_devices.name);
|
||||||
free(xi_all_master_devices.name);
|
free((void *) xi_all_master_devices.name);
|
||||||
|
|
||||||
XIBarrierReset();
|
XIBarrierReset();
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,7 +119,7 @@ SizeDeviceInfo(DeviceIntPtr d, int *namesize, int *size)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
CopyDeviceName(char **namebuf, char *name)
|
CopyDeviceName(char **namebuf, const char *name)
|
||||||
{
|
{
|
||||||
char *nameptr = (char *) *namebuf;
|
char *nameptr = (char *) *namebuf;
|
||||||
|
|
||||||
|
|
|
@ -955,7 +955,7 @@ CloseDevice(DeviceIntPtr dev)
|
||||||
while (dev->xkb_interest)
|
while (dev->xkb_interest)
|
||||||
XkbRemoveResourceClient((DevicePtr) dev, dev->xkb_interest->resource);
|
XkbRemoveResourceClient((DevicePtr) dev, dev->xkb_interest->resource);
|
||||||
|
|
||||||
free(dev->name);
|
free((void *) dev->name);
|
||||||
|
|
||||||
classes = (ClassesPtr) &dev->key;
|
classes = (ClassesPtr) &dev->key;
|
||||||
FreeAllDeviceClasses(classes);
|
FreeAllDeviceClasses(classes);
|
||||||
|
@ -2735,6 +2735,7 @@ AllocDevicePair(ClientPtr client, const char *name,
|
||||||
{
|
{
|
||||||
DeviceIntPtr pointer;
|
DeviceIntPtr pointer;
|
||||||
DeviceIntPtr keyboard;
|
DeviceIntPtr keyboard;
|
||||||
|
char *dev_name;
|
||||||
|
|
||||||
*ptr = *keybd = NULL;
|
*ptr = *keybd = NULL;
|
||||||
|
|
||||||
|
@ -2745,12 +2746,12 @@ AllocDevicePair(ClientPtr client, const char *name,
|
||||||
if (!pointer)
|
if (!pointer)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
|
||||||
if (asprintf(&pointer->name, "%s pointer", name) == -1) {
|
if (asprintf(&dev_name, "%s pointer", name) == -1) {
|
||||||
pointer->name = NULL;
|
|
||||||
RemoveDevice(pointer, FALSE);
|
RemoveDevice(pointer, FALSE);
|
||||||
|
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
|
pointer->name = dev_name;
|
||||||
|
|
||||||
pointer->public.processInputProc = ProcessOtherEvent;
|
pointer->public.processInputProc = ProcessOtherEvent;
|
||||||
pointer->public.realInputProc = ProcessOtherEvent;
|
pointer->public.realInputProc = ProcessOtherEvent;
|
||||||
|
@ -2771,13 +2772,13 @@ AllocDevicePair(ClientPtr client, const char *name,
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asprintf(&keyboard->name, "%s keyboard", name) == -1) {
|
if (asprintf(&dev_name, "%s keyboard", name) == -1) {
|
||||||
keyboard->name = NULL;
|
|
||||||
RemoveDevice(keyboard, FALSE);
|
RemoveDevice(keyboard, FALSE);
|
||||||
RemoveDevice(pointer, FALSE);
|
RemoveDevice(pointer, FALSE);
|
||||||
|
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
|
keyboard->name = dev_name;
|
||||||
|
|
||||||
keyboard->public.processInputProc = ProcessOtherEvent;
|
keyboard->public.processInputProc = ProcessOtherEvent;
|
||||||
keyboard->public.realInputProc = ProcessOtherEvent;
|
keyboard->public.realInputProc = ProcessOtherEvent;
|
||||||
|
|
|
@ -351,7 +351,7 @@ DuplicateInputAttributes(InputAttributes * attrs)
|
||||||
{
|
{
|
||||||
InputAttributes *new_attr;
|
InputAttributes *new_attr;
|
||||||
int ntags = 0;
|
int ntags = 0;
|
||||||
char **tags, **new_tags;
|
const char **tags, **new_tags;
|
||||||
|
|
||||||
if (!attrs)
|
if (!attrs)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -403,20 +403,20 @@ DuplicateInputAttributes(InputAttributes * attrs)
|
||||||
void
|
void
|
||||||
FreeInputAttributes(InputAttributes * attrs)
|
FreeInputAttributes(InputAttributes * attrs)
|
||||||
{
|
{
|
||||||
char **tags;
|
const char **tags;
|
||||||
|
|
||||||
if (!attrs)
|
if (!attrs)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
free(attrs->product);
|
free((void *) attrs->product);
|
||||||
free(attrs->vendor);
|
free((void *) attrs->vendor);
|
||||||
free(attrs->device);
|
free((void *) attrs->device);
|
||||||
free(attrs->pnp_id);
|
free((void *) attrs->pnp_id);
|
||||||
free(attrs->usb_id);
|
free((void *) attrs->usb_id);
|
||||||
|
|
||||||
if ((tags = attrs->tags))
|
if ((tags = attrs->tags))
|
||||||
while (*tags)
|
while (*tags)
|
||||||
free(*tags++);
|
free((void *) *tags++);
|
||||||
|
|
||||||
free(attrs->tags);
|
free(attrs->tags);
|
||||||
free(attrs);
|
free(attrs);
|
||||||
|
|
|
@ -221,12 +221,12 @@ typedef struct _InputOption InputOption;
|
||||||
typedef struct _XI2Mask XI2Mask;
|
typedef struct _XI2Mask XI2Mask;
|
||||||
|
|
||||||
typedef struct _InputAttributes {
|
typedef struct _InputAttributes {
|
||||||
char *product;
|
const char *product;
|
||||||
char *vendor;
|
const char *vendor;
|
||||||
char *device;
|
const char *device;
|
||||||
char *pnp_id;
|
const char *pnp_id;
|
||||||
char *usb_id;
|
const char *usb_id;
|
||||||
char **tags; /* null-terminated */
|
const char **tags; /* null-terminated */
|
||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
} InputAttributes;
|
} InputAttributes;
|
||||||
|
|
||||||
|
|
|
@ -542,7 +542,7 @@ typedef struct _DeviceIntRec {
|
||||||
GrabInfoRec deviceGrab; /* grab on the device */
|
GrabInfoRec deviceGrab; /* grab on the device */
|
||||||
int type; /* MASTER_POINTER, MASTER_KEYBOARD, SLAVE */
|
int type; /* MASTER_POINTER, MASTER_KEYBOARD, SLAVE */
|
||||||
Atom xinput_type;
|
Atom xinput_type;
|
||||||
char *name;
|
const char *name;
|
||||||
int id;
|
int id;
|
||||||
KeyClassPtr key;
|
KeyClassPtr key;
|
||||||
ValuatorClassPtr valuator;
|
ValuatorClassPtr valuator;
|
||||||
|
|
|
@ -1101,7 +1101,7 @@ xi_unregister_handlers(void)
|
||||||
static void
|
static void
|
||||||
cmp_attr_fields(InputAttributes * attr1, InputAttributes * attr2)
|
cmp_attr_fields(InputAttributes * attr1, InputAttributes * attr2)
|
||||||
{
|
{
|
||||||
char **tags1, **tags2;
|
const char **tags1, **tags2;
|
||||||
|
|
||||||
assert(attr1 && attr2);
|
assert(attr1 && attr2);
|
||||||
assert(attr1 != attr2);
|
assert(attr1 != attr2);
|
||||||
|
@ -1182,7 +1182,7 @@ dix_input_attributes(void)
|
||||||
{
|
{
|
||||||
InputAttributes orig = { 0 };
|
InputAttributes orig = { 0 };
|
||||||
InputAttributes *new;
|
InputAttributes *new;
|
||||||
char *tags[4] = { "tag1", "tag2", "tag2", NULL };
|
const char *tags[4] = { "tag1", "tag2", "tag2", NULL };
|
||||||
|
|
||||||
new = DuplicateInputAttributes(NULL);
|
new = DuplicateInputAttributes(NULL);
|
||||||
assert(!new);
|
assert(!new);
|
||||||
|
|
|
@ -43,9 +43,6 @@ static ClientRec server_client;
|
||||||
|
|
||||||
void *userdata;
|
void *userdata;
|
||||||
|
|
||||||
extern int CorePointerProc(DeviceIntPtr pDev, int what);
|
|
||||||
extern int CoreKeyboardProc(DeviceIntPtr pDev, int what);
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fake_init_sprite(DeviceIntPtr dev)
|
fake_init_sprite(DeviceIntPtr dev)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue