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:
Keith Packard 2013-11-15 06:00:44 -08:00
parent af04cf6968
commit fecc7eb1cf
8 changed files with 26 additions and 28 deletions

View File

@ -1169,8 +1169,8 @@ IResetProc(ExtensionEntry * unused)
EventSwapVector[DevicePropertyNotify] = NotImplemented;
RestoreExtensionEvents();
free(xi_all_devices.name);
free(xi_all_master_devices.name);
free((void *) xi_all_devices.name);
free((void *) xi_all_master_devices.name);
XIBarrierReset();
}

View File

@ -119,7 +119,7 @@ SizeDeviceInfo(DeviceIntPtr d, int *namesize, int *size)
*/
static void
CopyDeviceName(char **namebuf, char *name)
CopyDeviceName(char **namebuf, const char *name)
{
char *nameptr = (char *) *namebuf;

View File

@ -955,7 +955,7 @@ CloseDevice(DeviceIntPtr dev)
while (dev->xkb_interest)
XkbRemoveResourceClient((DevicePtr) dev, dev->xkb_interest->resource);
free(dev->name);
free((void *) dev->name);
classes = (ClassesPtr) &dev->key;
FreeAllDeviceClasses(classes);
@ -2735,6 +2735,7 @@ AllocDevicePair(ClientPtr client, const char *name,
{
DeviceIntPtr pointer;
DeviceIntPtr keyboard;
char *dev_name;
*ptr = *keybd = NULL;
@ -2745,12 +2746,12 @@ AllocDevicePair(ClientPtr client, const char *name,
if (!pointer)
return BadAlloc;
if (asprintf(&pointer->name, "%s pointer", name) == -1) {
pointer->name = NULL;
if (asprintf(&dev_name, "%s pointer", name) == -1) {
RemoveDevice(pointer, FALSE);
return BadAlloc;
}
pointer->name = dev_name;
pointer->public.processInputProc = ProcessOtherEvent;
pointer->public.realInputProc = ProcessOtherEvent;
@ -2771,13 +2772,13 @@ AllocDevicePair(ClientPtr client, const char *name,
return BadAlloc;
}
if (asprintf(&keyboard->name, "%s keyboard", name) == -1) {
keyboard->name = NULL;
if (asprintf(&dev_name, "%s keyboard", name) == -1) {
RemoveDevice(keyboard, FALSE);
RemoveDevice(pointer, FALSE);
return BadAlloc;
}
keyboard->name = dev_name;
keyboard->public.processInputProc = ProcessOtherEvent;
keyboard->public.realInputProc = ProcessOtherEvent;

View File

@ -351,7 +351,7 @@ DuplicateInputAttributes(InputAttributes * attrs)
{
InputAttributes *new_attr;
int ntags = 0;
char **tags, **new_tags;
const char **tags, **new_tags;
if (!attrs)
return NULL;
@ -403,20 +403,20 @@ DuplicateInputAttributes(InputAttributes * attrs)
void
FreeInputAttributes(InputAttributes * attrs)
{
char **tags;
const char **tags;
if (!attrs)
return;
free(attrs->product);
free(attrs->vendor);
free(attrs->device);
free(attrs->pnp_id);
free(attrs->usb_id);
free((void *) attrs->product);
free((void *) attrs->vendor);
free((void *) attrs->device);
free((void *) attrs->pnp_id);
free((void *) attrs->usb_id);
if ((tags = attrs->tags))
while (*tags)
free(*tags++);
free((void *) *tags++);
free(attrs->tags);
free(attrs);

View File

@ -221,12 +221,12 @@ typedef struct _InputOption InputOption;
typedef struct _XI2Mask XI2Mask;
typedef struct _InputAttributes {
char *product;
char *vendor;
char *device;
char *pnp_id;
char *usb_id;
char **tags; /* null-terminated */
const char *product;
const char *vendor;
const char *device;
const char *pnp_id;
const char *usb_id;
const char **tags; /* null-terminated */
uint32_t flags;
} InputAttributes;

View File

@ -542,7 +542,7 @@ typedef struct _DeviceIntRec {
GrabInfoRec deviceGrab; /* grab on the device */
int type; /* MASTER_POINTER, MASTER_KEYBOARD, SLAVE */
Atom xinput_type;
char *name;
const char *name;
int id;
KeyClassPtr key;
ValuatorClassPtr valuator;

View File

@ -1101,7 +1101,7 @@ xi_unregister_handlers(void)
static void
cmp_attr_fields(InputAttributes * attr1, InputAttributes * attr2)
{
char **tags1, **tags2;
const char **tags1, **tags2;
assert(attr1 && attr2);
assert(attr1 != attr2);
@ -1182,7 +1182,7 @@ dix_input_attributes(void)
{
InputAttributes orig = { 0 };
InputAttributes *new;
char *tags[4] = { "tag1", "tag2", "tag2", NULL };
const char *tags[4] = { "tag1", "tag2", "tag2", NULL };
new = DuplicateInputAttributes(NULL);
assert(!new);

View File

@ -43,9 +43,6 @@ static ClientRec server_client;
void *userdata;
extern int CorePointerProc(DeviceIntPtr pDev, int what);
extern int CoreKeyboardProc(DeviceIntPtr pDev, int what);
static void
fake_init_sprite(DeviceIntPtr dev)
{