[Xcb] Win32 branch of XCB now up :)

Julien Danjou julien at danjou.info
Mon May 18 01:46:22 PDT 2009


At 1242038193 time_t, Jeetu Golani wrote:
> I've updated my branch at github to reflect changes in code as suggested by
> Julien and also rectify the goof ups I made with my initial submission.
> Julien, I would appreciate if you could verify if all is well now.

Yeah, that's much better. :-)

I'll quote some of your work here and just review it. I'm not qualified
in Windows coding so I won't judge if the work is good, bad or even

--- /dev/null
+++ b/src/windefs.h
+#define WINVER 0x0501 /* required for getaddrinfo/freeaddrinfo defined only for WinXP and above */

Hum, are you sure you always want to define it?
If not, maybe adding #ifndef WINVER / #endif surrounding this #define
might be a good idea.

--- a/src/xcb_in.c
+++ b/src/xcb_in.c
+static int read_block(const int fd, void *buf, const size_t len)
+int _xcb_in_read(xcb_connection_t *c)

You are redefining the whole function. IMHO, this is not so good,
because you are duplicating a lot of code. And is some day we need to
fix code in one of that function, we may forget to fix it in the WIN32

--- a/src/xcb.h
+++ b/src/xcb.h
+int initWSA(void);

This is not right. If I'm understanding correctly, this is required to
initialize some stuff. The function name is not respecting the naming
scheme of xcb functions and the name is too generic.

I suggest that:
1. You drop the function and documente that loading winsock via
  WSAStartup() is mandatory before using XCB;
2. or you add a static flag in xcb_open() that check that winsock has been
  initialized before running;
3. or you initialize winsock in xcb_open() unconditionnally. I don't know
  if you can initialize winsock multiple times. If not, the solution
  above can be better. But again, maybe another lib can initiliaze
  winsock in its corner, so maybe if it can be initialized only once,
  solution 1 will be better.

The rest seems fine to me.

Julien Danjou
// ᐰ <julien at danjou.info>   http://julien.danjou.info
// 9A0D 5FD9 EB42 22F6 8974  C95C A462 B51E C2FE E5CD
// When I get sad, I stop being sad and be awesome instead. True story.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
Url : http://lists.freedesktop.org/archives/xcb/attachments/20090518/e4889c73/attachment.pgp 

More information about the Xcb mailing list