[Xcb] Win32 port - pls review

Peter Harris pharris at opentext.com
Tue Mar 30 14:25:33 PDT 2010


On 2010-03-30 15:32, Jeetu Golani wrote:
> I have updated the Win32 port to the current (few weeks old) tree of xcb. Have 
> conducted a few rudimentary tests and it seems to perform all right. 

Looks good. I appear to be down to nits, none of which are critical as
far as I can see. Thanks for working on this.

You appear to have accidentally dropped a number of headers in
xcb_util.c, including <fcntl.h> and <netinet/tcp.h>, so libxcb doesn't
compile any more on *ix.

SOCKET on Win32 is currently defined to intptr_t, which is wider than
int on 64-bit systems. We can probably get away with leaving fd as an
int, for the sake of keeping the code at least somewhat sane. (Neither
breaking the ABI on *ix nor #ifdefing the type on Win32 are particularly
appealing, from what I can see). Note that Win32, unlike posix, does not
just allocate FDs one by one starting from stderr, so it's more likely
that some app will run in to this than a *ix person might think. But I
believe current implementations of Windows try to keep SOCKETs below the
31-bit barrier most of the time.

#ifndef _WIN32 inside #if USE_POLL seems redundant. USE_POLL shouldn't
be defined on Win32.

The do-while around select in xcb_in.c might not be required on Win32,
but does it hurt? I'd rather avoid as many #ifdefs as possible. In the
same vein, Remi already suggested using send/recv everywhere (even on
*ix). What do you think?

There's trailing whitespace in a few places. "git diff --color" to see them.

_XCB_WINDEFS_H -- identifiers starting with underscore followed by
another underscore or a capital letter are reserved in C (7.1.3). I've
already lost this battle, as the rest of xcb already stomps on this
namespace, but I thought I'd point it out.

What does the rest of the list think? Is it better to use a name that
resembles the rest of the names in XCB, or should we try to avoid the
reserved namespace going forward?

Peter Harris
-- 
               Open Text Connectivity Solutions Group
Peter Harris                    http://connectivity.opentext.com/
Research and Development        Phone: +1 905 762 6001
pharris at opentext.com            Toll Free: 1 877 359 4866


More information about the Xcb mailing list