[PATCH:libXft] Add const attributes to fix gcc -Wwrite-strings warnings

Aaron Plattner aplattner at nvidia.com
Mon Sep 26 15:56:50 PDT 2011


On 09/26/2011 03:43 PM, Alan Coopersmith wrote:
> Signed-off-by: Alan Coopersmith<alan.coopersmith at oracle.com>

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

XftDefaultParseBool could probably use a const too.

Should these be _Xconst rather than plain old const?  Does anyone 
#define _Xconst to override the definition in Xfuncproto.h?

> ---
>   src/xftdpy.c      |    6 +++---
>   src/xftfreetype.c |    2 +-
>   src/xftinit.c     |    2 +-
>   3 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/src/xftdpy.c b/src/xftdpy.c
> index 747b8db..86cd14c 100644
> --- a/src/xftdpy.c
> +++ b/src/xftdpy.c
> @@ -307,7 +307,7 @@ XftDefaultParseBool (char *v)
>   }
>
>   static Bool
> -_XftDefaultInitBool (Display *dpy, FcPattern *pat, char *option)
> +_XftDefaultInitBool (Display *dpy, FcPattern *pat, const char *option)
>   {
>       char    *v;
>       int	    i;
> @@ -319,7 +319,7 @@ _XftDefaultInitBool (Display *dpy, FcPattern *pat, char *option)
>   }
>
>   static Bool
> -_XftDefaultInitDouble (Display *dpy, FcPattern *pat, char *option)
> +_XftDefaultInitDouble (Display *dpy, FcPattern *pat, const char *option)
>   {
>       char    *v, *e;
>       double  d;
> @@ -335,7 +335,7 @@ _XftDefaultInitDouble (Display *dpy, FcPattern *pat, char *option)
>   }
>
>   static Bool
> -_XftDefaultInitInteger (Display *dpy, FcPattern *pat, char *option)
> +_XftDefaultInitInteger (Display *dpy, FcPattern *pat, const char *option)
>   {
>       char    *v, *e;
>       int	    i;
> diff --git a/src/xftfreetype.c b/src/xftfreetype.c
> index 3d930be..3f8dfef 100644
> --- a/src/xftfreetype.c
> +++ b/src/xftfreetype.c
> @@ -164,7 +164,7 @@ _XftLockFile (XftFtFile *f)
>   }
>
>   static void
> -_XftLockError (char *reason)
> +_XftLockError (const char *reason)
>   {
>       fprintf (stderr, "Xft: locking error %s\n", reason);
>   }
> diff --git a/src/xftinit.c b/src/xftinit.c
> index 0205e4b..ff23722 100644
> --- a/src/xftinit.c
> +++ b/src/xftinit.c
> @@ -43,7 +43,7 @@ XftGetVersion (void)
>   }
>
>   static struct {
> -    char    *name;
> +    const char *name;
>       int	    alloc_count;
>       int	    alloc_mem;
>       int	    free_count;



More information about the xorg-devel mailing list