<br><br><div class="gmail_quote">On Thu, Jan 5, 2012 at 3:28 PM, Josh Triplett <span dir="ltr"><<a href="mailto:josh@joshtriplett.org">josh@joshtriplett.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Thu, Jan 05, 2012 at 08:57:54PM +0000, Jon TURNEY wrote:<br>
> From: Ryan Pavlik <<a href="mailto:rpavlik@iastate.edu">rpavlik@iastate.edu</a>><br>
><br>
> The alternative is to use these in every WIN32 application which uses xcb. Doing<br>
> it this way should be safe, as, according to MSDN, "There must be a call to<br>
> WSACleanup for each successful call to WSAStartup. Only the final WSACleanup<br>
> function call performs the actual cleanup. The preceding calls simply decrement<br>
> an internal reference count"<br>
</div>[...]<br>
> Signed-off-by: Jon TURNEY <<a href="mailto:jon.turney@dronecode.org.uk">jon.turney@dronecode.org.uk</a>><br>
<br>
Typically a patch needs a signoff by its author, not just the person<br>
submitting it. XCB doesn't particularly require signoffs, but if you<br>
want to follow that convention you should have the original author sign<br>
off.<br>
<div><div class="h5"><br>
> --- a/src/xcb_conn.c<br>
> +++ b/src/xcb_conn.c<br>
> @@ -313,6 +313,10 @@ void xcb_disconnect(xcb_connection_t *c)<br>
> _xcb_xid_destroy(c);<br>
><br>
> free(c);<br>
> +<br>
> +#ifdef _WIN32<br>
> + WSACleanup();<br>
> +#endif<br>
> }<br>
><br>
> /* Private interface */<br>
> diff --git a/src/xcb_util.c b/src/xcb_util.c<br>
> index 62c51e1..d64c904 100644<br>
> --- a/src/xcb_util.c<br>
> +++ b/src/xcb_util.c<br>
> @@ -426,8 +426,13 @@ xcb_connection_t *xcb_connect_to_display_with_auth_info(const char *displayname,<br>
> if(!parsed) {<br>
> c = (xcb_connection_t *) &error_connection;<br>
> goto out;<br>
> - } else<br>
> + } else {<br>
> +#ifdef _WIN32<br>
> + WSADATA wsaData;<br>
> + WSAStartup(MAKEWORD(2, 2), &wsaData);<br>
> +#endif<br>
> fd = _xcb_open(host, protocol, display);<br>
> + }<br>
<br>
</div></div>What happens if the application using XCB has already called WSAStartup,<br>
and passes a lower version number than 2.2? Will XCB's call to<br>
WSAStartup cause Winsock to start assuming 2.2 semantics instead of<br>
whatever older semantics the application requested? Or will Winsock<br>
just tell XCB to use the older version? In the latter case, can XCB<br>
live with that?<br>
<span class="HOEnZb"><font color="#888888"><br>
- Josh Triplett<br>
</font></span></blockquote></div><br>I'm not sure, but 2.2 is available since a patch for Windows 95, so I'm pretty confident that it's a safe alternative.<div><br></div><div>Jon, if you put these patches in some publicly-accessible repo I can go through and sign off on them easily.<br clear="all">
<div><br></div>-- <br>Ryan Pavlik<br>HCI Graduate Student<br>Virtual Reality Applications Center<br>Iowa State University<br><br><a href="mailto:rpavlik@iastate.edu" target="_blank">rpavlik@iastate.edu</a><br><a href="http://academic.cleardefinition.com" target="_blank">http://academic.cleardefinition.com</a><br>
</div>