[PATCH lib/libX11] Don't use caddr_t casts
Alan Coopersmith
alan.coopersmith at oracle.com
Thu Mar 8 20:45:28 PST 2012
On 02/19/12 06:31 AM, Jon TURNEY wrote:
> On 18/02/2012 19:11, Jamey Sharp wrote:
>> On Sat, Feb 18, 2012 at 05:21:24PM +0000, Jon TURNEY wrote:
>>> Casting a (const char *) to (caddr_t) to assign to iovec.io_base
>>> seems pointless. caddr_t isn't used anywhere else in xcb or libX11
>>
>> According to the libxcb git history, I replaced (caddr_t) with (char *)
>> in 2006 to "help DragonFly and Solaris". I'd be fine with this patch if
>> it explicitly cast to (char *), which I believe suppresses the constness
>> warning.
BTW, Solaris 11 now uses (void *), but Solaris 10 & older used caddr_t there,
which is why you needed it back then.
> diff --git a/src/xcb_io.c b/src/xcb_io.c
> index 0af47d8..300ef57 100644
> --- a/src/xcb_io.c
> +++ b/src/xcb_io.c
> @@ -478,9 +478,9 @@ void _XSend(Display *dpy, const char *data, long size)
>
> vec[0].iov_base = dpy->buffer;
> vec[0].iov_len = dpy->bufptr - dpy->buffer;
> - vec[1].iov_base = (caddr_t) data;
> + vec[1].iov_base = (char *)data;
> vec[1].iov_len = size;
> - vec[2].iov_base = (caddr_t) pad;
> + vec[2].iov_base = (char *)pad;
> vec[2].iov_len = -size & 3;
>
> for(ext = dpy->flushes; ext; ext = ext->next_flush)
Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
--
-Alan Coopersmith- alan.coopersmith at oracle.com
Oracle Solaris Engineering - http://blogs.oracle.com/alanc
More information about the xorg-devel
mailing list