[PATCH:libXrandr] Constify a couple string arguments that are just copied, not modified

Aaron Plattner aplattner at nvidia.com
Sat Sep 1 17:38:51 PDT 2012


On 08/31/2012 09:40 PM, Alan Coopersmith wrote:
> Fixes compiler warnings when building app/xrandr:
>
> xrandr.c: In function ‘crtc_set_transform’:
> xrandr.c:1459:9: warning: passing argument 4 of ‘XRRSetCrtcTransform’ discards qualifiers from pointer target type
> X11/extensions/Xrandr.h:419:1: note: expected ‘char *’ but argument is of type ‘const char *’
>
> Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>

I almost sent this exact patch out, but never got around to it.  Thanks 
for fixing this.

Reviewed-by: Aaron Plattner <aplattner at nvidia.com>

-- Aaron

> ---
>   include/X11/extensions/Xrandr.h |    4 ++--
>   src/XrrCrtc.c                   |    2 +-
>   src/XrrMode.c                   |    2 +-
>   3 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/include/X11/extensions/Xrandr.h b/include/X11/extensions/Xrandr.h
> index b1baf8a..f394864 100644
> --- a/include/X11/extensions/Xrandr.h
> +++ b/include/X11/extensions/Xrandr.h
> @@ -341,7 +341,7 @@ XRRGetOutputProperty (Display *dpy, RROutput output,
>   		      unsigned char **prop);
>
>   XRRModeInfo *
> -XRRAllocModeInfo (char *name, int nameLength);
> +XRRAllocModeInfo (_Xconst char *name, int nameLength);
>
>   RRMode
>   XRRCreateMode (Display *dpy, Window window, XRRModeInfo *modeInfo);
> @@ -419,7 +419,7 @@ void
>   XRRSetCrtcTransform (Display	*dpy,
>   		     RRCrtc	crtc,
>   		     XTransform	*transform,
> -		     char	*filter,
> +		     _Xconst char *filter,
>   		     XFixed	*params,
>   		     int	nparams);
>
> diff --git a/src/XrrCrtc.c b/src/XrrCrtc.c
> index 0762373..04087c5 100644
> --- a/src/XrrCrtc.c
> +++ b/src/XrrCrtc.c
> @@ -306,7 +306,7 @@ void
>   XRRSetCrtcTransform (Display	*dpy,
>   		     RRCrtc	crtc,
>   		     XTransform	*transform,
> -		     char	*filter,
> +		     _Xconst char *filter,
>   		     XFixed	*params,
>   		     int	nparams)
>   {
> diff --git a/src/XrrMode.c b/src/XrrMode.c
> index 0b74a73..e605e8a 100644
> --- a/src/XrrMode.c
> +++ b/src/XrrMode.c
> @@ -33,7 +33,7 @@
>   #include "Xrandrint.h"
>
>   XRRModeInfo *
> -XRRAllocModeInfo (char *name, int nameLength)
> +XRRAllocModeInfo (_Xconst char *name, int nameLength)
>   {
>       XRRModeInfo	*mode_info;
>
>

-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------


More information about the xorg-devel mailing list