ws2_32: Add support for FROM_PROTOCOL_INFO to WSASocket()

Dmitry Timoshkov dmitry at codeweavers.com
Sun May 25 22:08:46 CDT 2008


"Kai Blin" <kai.blin at gmail.com> wrote:

> > > +    {FROM_PROTOCOL_INFO, FROM_PROTOCOL_INFO},
> > >  };
> >
> > Although it was the case before, it's a mistake to have a comma after
> > the last struct member initializer.
> 
> It is?  K&R seems to use both, so I preferred to keep it similar to all the 
> other struct member initializers.

I said "a mistake" not "an error". Although the compiler forgives this, what
the last comma is serving for?

> > > +    if (lpProtocolInfo) {
> > > +      if (af == FROM_PROTOCOL_INFO)
> > > +          af = lpProtocolInfo->iAddressFamily;
> > > +      if (type == FROM_PROTOCOL_INFO)
> > > +          type = lpProtocolInfo->iSocketType;
> > > +      if (protocol == FROM_PROTOCOL_INFO)
> > > +          protocol = lpProtocolInfo->iProtocol;
> >
> > Please keep opening brace style/indentation consistent with code you have
> > removed.
> 
> The function is a mess with brace style and indentation. I've used the same 
> indentaion as the if right above this one. The function wildly mixes 
> two-space, three-space and four-space indents. In this case, I used two-space 
> indents for the outer if and four-space indents for the inner ifs for better 
> readability.

Even if the overall style is a mess it's not a solution to add the code which
mixes 2 and 4 spaces indentation, and the code you have removed used a consistent
style.

> > --- a/include/winsock.h
> > +++ b/include/winsock.h
> > @@ -146,6 +146,7 @@ extern "C" {
> >  /* proper 4-byte packing */
> >  #include <pshpack4.h>
> >
> > +#define FROM_PROTOCOL_INFO (-1)
>
> PSDK has it in winsock2.h
> 
> PSDK has the AF_*, PF_*, SOCK_* and IPPROTO_* defines in winsock2.h as well, 
> Wine hasn't. I preferred to keep them together.

How much efforts would it take to put 1 line to a proper .h file?

> I don't fully understand why people suddenly start getting picky about stuff 
> like this when noone previously gave a damn. As it's not acceptable to just 
> go over this mess with indent, I don't see how conforming to one sort of 
> messy indentation is preferrable to another sort of messy indentation.
> 
> Seriously, this patch fixes a bug, take it or leave it and fix it yourself.

All the patches sent to wine-patches fix a bug, not of them are applied due
to different reasons. You are not a first timer, and know the rules.


-- 
Dmitry.



More information about the wine-devel mailing list