On 01/02/2012 05:19 PM, Peter Hutterer wrote:
> synaptics.c: In function 'SynapticsPreInit':
> synaptics.c:731:18: warning: assignment discards 'const' qualifier from
> pointer target type [enabled by default]
> 
> Signed-off-by: Peter Hutterer <[email protected]>
> ---
>  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..2affc17 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);
> +                               (const pointer)priv->device, FALSE);

This seems like a recipe for trouble. We're relying on an assumption of
how XIChangeDeviceProperty works. Either we should change the signature
of the library call, or we should use strcpy().

Even if we are 100% sure that XIChangeDeviceProperty will never modify
the string, it's just bad programming.

>          XISetDevicePropertyDeletable(pInfo->dev, prop_device_node, FALSE);
>      }
>  
> diff --git a/src/synapticsstr.h b/src/synapticsstr.h
> index 1ec8246..d74ebcd 100644
> --- a/src/synapticsstr.h
> +++ b/src/synapticsstr.h
> @@ -185,7 +185,7 @@ typedef struct _SynapticsPrivateRec
>  
>      struct SynapticsHwState hwState;
>  
> -    char *device;                    /* device node */
> +    const char *device;                      /* device node */

This looks good either way though.

-- Chase
_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to