[PATCH libXi] Fix const compiler warnings

Peter Hutterer peter.hutterer at who-t.net
Mon Nov 2 15:13:28 PST 2015


On Wed, Oct 07, 2015 at 12:41:01PM +0200, Javier Pello wrote:
> When invoking Data, Data16 and Data32 from XChangeDeviceProperty,
> we must cast the data pointer to the right type, but we do not need
> to cast constness away. This change allows to enable -Wcast-qual on
> the build and have it complete without warnings.
> 
> Signed-off-by: Javier Pello <javier.pello at urjc.es>

   3808615..13f25bf  master -> master

Thanks!

Cheers,
   Peter

> ---
>  src/XChDProp.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/src/XChDProp.c b/src/XChDProp.c
> index c863cdbd..45d0ee4e 100644
> --- a/src/XChDProp.c
> +++ b/src/XChDProp.c
> @@ -74,7 +74,7 @@ XChangeDeviceProperty(Display* dpy, XDevice* dev,
>  	len = ((long)nelements + 3) >> 2;
>  	if (dpy->bigreq_size || req->length + len <= (unsigned) 65535) {
>  	    SetReqLen(req, len, len);
> -	    Data (dpy, (char *)data, nelements);
> +	    Data (dpy, (_Xconst char *)data, nelements);
>  	} /* else force BadLength */
>  	break;
>  
> @@ -83,7 +83,7 @@ XChangeDeviceProperty(Display* dpy, XDevice* dev,
>  	if (dpy->bigreq_size || req->length + len <= (unsigned) 65535) {
>  	    SetReqLen(req, len, len);
>  	    len = (long)nelements << 1;
> -	    Data16 (dpy, (short *) data, len);
> +	    Data16 (dpy, (_Xconst short *) data, len);
>  	} /* else force BadLength */
>  	break;
>  
> @@ -92,7 +92,7 @@ XChangeDeviceProperty(Display* dpy, XDevice* dev,
>  	if (dpy->bigreq_size || req->length + len <= (unsigned) 65535) {
>  	    SetReqLen(req, len, len);
>  	    len = (long)nelements << 2;
> -	    Data32 (dpy, (long *) data, len);
> +	    Data32 (dpy, (_Xconst long *) data, len);
>  	} /* else force BadLength */
>  	break;
>  
> -- 
> 2.5.3


More information about the xorg-devel mailing list