[PATCH synaptics] Constify priv->device

Mark Kettenis mark.kettenis at xs4all.nl
Wed Jan 4 10:55:08 PST 2012


> X-Original-To: xorg-devel at lists.x.org
> From: Daniel Stone <daniel at fooishbar.org>
> Date: Wed,  4 Jan 2012 17:02:30 +0000
> 
> Fixes a compiler warning due to discarding the const qualifier as it
> comes back from the option code.

If Daniel Kurtz's analysis of the problem is right, and I believe it
is, then this diff is just as wrong as the previous diff from Peter.
It also means that the real culprit is Peter's change to constify
XIChangeDeviceProperty().  While Daniel Kurtz's suggestion to
introduce a cpointer typedef would work, I think it's better to drop
the pointer typedef entirely and simply use "const void *" in the
XIChangeDeviceProperty() prototype.  We should probably deprecate the
pointer typedef; I bet the reason it was introduced was to support
pre-ANSI C, and I think we all agree that's irrelevant now.



> Signed-off-by: Daniel Stone <daniel at fooishbar.org>
> ---
>  src/properties.c   |    2 +-
>  src/synapticsstr.h |    2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/properties.c b/src/properties.c
> index f15a6fb..0a52801 100644
> --- a/src/properties.c
> +++ b/src/properties.c
> @@ -315,7 +315,7 @@ InitDeviceProperties(InputInfoPtr pInfo)
>          prop_device_node = MakeAtom(XI_PROP_DEVICE_NODE, strlen(XI_PROP_DEVICE_NODE), TRUE);
>          XIChangeDeviceProperty(pInfo->dev, prop_device_node, XA_STRING, 8,
>                                 PropModeReplace, strlen(priv->device),
> -                               priv->device, FALSE);
> +                               (pointer) priv->device, FALSE);
>          XISetDevicePropertyDeletable(pInfo->dev, prop_device_node, FALSE);
>      }
>  


More information about the xorg-devel mailing list