[PATCH libXi 1/5] Handle unknown device classes.
Daniel Stone
daniel at fooishbar.org
Thu Sep 22 03:22:25 PDT 2011
On Mon, Aug 22, 2011 at 03:35:18PM +1000, Peter Hutterer wrote:
> @@ -1564,13 +1576,13 @@ wireToDeviceChangedEvent(xXIDeviceChangedEvent *in, XGenericEventCookie *cookie)
> out->deviceid = in->deviceid;
> out->sourceid = in->sourceid;
> out->reason = in->reason;
> - out->num_classes = in->num_classes;
>
> out->classes = (XIAnyClassInfo**)&out[1];
>
> info.classes = out->classes;
>
> - copy_classes(&info, (xXIAnyInfo*)&in[1], in->num_classes);
> + copy_classes(&info, (xXIAnyInfo*)&in[1], &nclasses);
> + out->num_classes = nclasses;
I like this change.
> diff --git a/src/XIQueryDevice.c b/src/XIQueryDevice.c
> index 4e2f392..c22aee1 100644
> --- a/src/XIQueryDevice.c
> +++ b/src/XIQueryDevice.c
> @@ -87,7 +87,7 @@ XIQueryDevice(Display *dpy, int deviceid, int *ndevices_return)
> ptr += ((wire->name_len + 3)/4) * 4;
>
> lib->classes = Xmalloc(size_classes((xXIAnyInfo*)ptr, lib->num_classes));
> - ptr += copy_classes(lib, (xXIAnyInfo*)ptr, lib->num_classes);
> + ptr += copy_classes(lib, (xXIAnyInfo*)ptr, &lib->num_classes);
> }
... and think you should probably make the same one here, for clarity.
I noted that while reading XIQueryDevice to make sure it was safe and
only spotted the same change in wireToDeviceChangedEvent when I hit
reply to suggest it, so clearly if both of us think the same way, it
must be true, right? :)
Cheers,
Daniel
More information about the xorg-devel
mailing list