[Xcb] Win32 port - pls review

Jeetu Golani jeetu.golani at gmail.com
Thu Apr 22 12:31:05 PDT 2010


I've made the following changes as suggested by everyone here:

- initialized errno to 0 in read_block so that in Win32 this loop processes 
only once without the need for preprocessor directives.
- _xcb_open now returns -1 if control reaches the end.
- have replaced read with recv unconditionally.

>I think you could simplify the write_vec changes by providing your own 
function named writev

Hmm I had done something similar earlier i.e. instead of having #ifdefs within 
the core xcb funcs had my own versions of these functions for Win32 but ppl 
on the list advised me to have singular functions with #ifdefs instead. I'm 
open to either solution.

The code seems to function under Win32 but would appreciate if ppl could 
have a look and also confirm if it works on non-win32 platforms and if all 
looks good.

Bye for now
- An open (GPL) platform to discover and run software off someone in the 
meshed network pool and use it on your own device

twitter: @0topcat0 and @ebrainpool

On Thursday 01 April 2010, Jeetu Golani wrote:
> Hi,
> Vincent:
> >>you didn't quoted everything or read carefully:  **If** you do
> Ah yup :)...sorry I didn't read this carefully.
> This makes what Peter said feasible in my opinion i.e we could set errno to
> 0 and thereby the loop will only be processed once and we can make do 
> the #ifdef at the point. For *ix platforms errno will be set in the case of
> an error and the code should function normally. Will make the change and
> test out the code.
> Jamey:
> >>Looks like _xcb_open on Win32 could fall off the end without defining a
> >>return value. Have you compiled this with warnings turned on?
> Yes _xcb_open should have a return value. Will make the change.
> Bye for now
> On Thu, Apr 1, 2010 at 10:07 AM, Vincent Torri <vtorri at univ-evry.fr> wrote:
> > On Thu, 1 Apr 2010, Jeetu Golani wrote:
> >> Hi,
> >>
> >>  Fine with me, but I thought there were platforms where you can't assign
> >>
> >>> to errno--in fact, I thought Win32 was one of those platforms?
> >>
> >> While mingw doesn't seem to complain if we assign errno = 0, this
> >> article on
> >> msdn suggests applications can't (or maybe shouldn't?)
> >>
> >> http://msdn.microsoft.com/en-
> >>.microsoft.com/en-us/library/ms737828%28VS.85%29.aspx>
> >>
> >> <Quote>
> >> Furthermore, it is not possible for an application to assign a new value
> >> to
> >> errno. (In Windows Sockets, the function WSASetLastError may be used 
> >> this purpose.)
> >> </Unquote>
> >
> > you didn't quoted everything or read carefully:  **If** you do
> >
> > #define errno WSAGetLastError()
> >
> > then you can't set a value to errno as it's not an lvalue anymore. errno
> > is a global variable and can, of course, be set if no strange define like
> > above is done
> >
> > if you use socket functions on Windows, WSASetLastError() and
> > WSAGetLastError() should be used to set / get errors, like errno for CRT
> >
> > Vincent

More information about the Xcb mailing list