[PATCH lib/libX11] Don't use caddr_t casts

Jamey Sharp jamey at minilop.net
Sat Feb 18 11:11:17 PST 2012


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.

> Note: there's a warning about dropping constness here, but that's
> going to be unfixable as long as xcb_writev() takes a non-const struct
> iovec as a parameter.

C's rules regarding const always confuse me, but I'm pretty sure even
that wouldn't help. If the struct iovec is declared const, that just
means XCB won't change where the iov_base pointers point. It doesn't
mean XCB promises to refrain from writing through those pointers.

Jamey
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.x.org/archives/xorg-devel/attachments/20120218/a8cc67e5/attachment.pgp>


More information about the xorg-devel mailing list