[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-devel
Subject:    Re: ws2_32: Implement SO_GET_MAX_MSG_SIZE for getsockopt.
From:       Kai Blin <kai.blin () gmail ! com>
Date:       2006-11-28 17:21:31
Message-ID: 200611281821.36603.kai.blin () gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


On Tuesday 28 November 2006 17:05, Dmitry Timoshkov wrote:
> "Kai Blin" <kai.blin@gmail.com> wrote:
> > +static void test_extendedSocketOptions()
> > +{
> > +    WSADATA wsa;
> > +    SOCKET sock;
> > +    struct sockaddr_in sa;
> > +    int sa_len = sizeof(struct sockaddr_in);
> > +    ULONG optval, optlen = sizeof(ULONG);
>
> Why to use ULONG if what you later cast it to is 'int *', and according to
> the docs (and your implementation) SO_MAX_MSG_SIZE expects sizeof(int) for
> the optval?

Because another part of the docs says SO_MAX_MSG_SIZE expects ULONG.

>
> ...
>
> > +    if(bind(sock, (struct sockaddr *) &sa, (int)sa_len) < 0){
>
> There is not need for a cast, sa_len has the type 'int'.

Whoops, copy&paste error from my linux test program, where sa_len was a 
size_t.

> > +        trace("Failed to bind socket: 0x%08x\n", WSAGetLastError());
> > +        closesocket(sock);
> > +        WSACleanup();
> > +        exit(1);
>
> This kills the whole process instead of terminating gracefully just this
> particular test.

Yeah, forgot to convert that from the standalone test I wrote first.
Reading all the code in socket.c must have turned my brain all mushy.

Thanks for catching those. I'll fix it and resubmit. 
Kai

-- 
Kai Blin, <kai Dot blin At gmail Dot com>
WorldForge developer    http://www.worldforge.org/
Wine developer          http://wiki.winehq.org/KaiBlin/
--
Will code for cotton.

[Attachment #5 (application/pgp-signature)]



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic