[PATCH:libFS 2/2] Mark pattern argument to FSListFonts* as const char *

Mark Kettenis mark.kettenis at xs4all.nl
Sat Nov 12 02:15:19 PST 2011


> From: Alan Coopersmith <alan.coopersmith at oracle.com>
> Date: Fri, 11 Nov 2011 21:43:05 -0800
> 
> Needed to fix gcc -Wwrite-strings warnings in clients such as fslsfonts
> 
> diff --git a/src/FSlibInt.c b/src/FSlibInt.c
> index 5a33b64..eea9840 100644
> --- a/src/FSlibInt.c
> +++ b/src/FSlibInt.c
> @@ -536,7 +536,7 @@ _FSReadPad(
>  void
>  _FSSend(
>      register FSServer	*svr,
> -    char		*data,
> +    const char		*data,
>      register long	 size)
>  {
>      struct iovec iov[3];
> @@ -591,7 +591,7 @@ _FSSend(
>  	    }
>  
>  	InsertIOV(svr->buffer, svrbufsize)
> -	InsertIOV(data, size)
> +	InsertIOV((char *)data, size)

Are you sure InsertIOV() can't modify the data you pass it?  If so,
you should constify it and drop the cast.  This sort of stuff really
needs to be done bottom up, instead of top down like you're trying
now.


More information about the xorg-devel mailing list