On Tue, Oct 12, 2010 at 10:12 PM, Mike Kaplinskiy <mike.kaplins...@gmail.com> wrote: > ... > + int newsize = (int)*maxsize; > + > + /* Make sure there is at least enough room for this entry */ > + newsize -= sizeof(WSACMSGHDR) + CMSG_ALIGN(len); > + if (newsize < 0) > + return 0; > + *maxsize = (ULONG)newsize; > Just declare it as a ULONG/size_t so you don't have to cast.
I can obviously change this around a little bit, but the reason for this conversion is that as a ULONG the "if (newsize < 0)" comparison is not going to work. > ... > + memset(cmsg_win, 0x00, sizeof(WSACMSGHDR)); /* Don't use garbage > data if no headers are found */ > I think in general that is discouraged at wine (don't quote me on > that). You should just initialize the values manually. This is actually superfluous (gone in next revision), as if no headers are found the length returned is zero. > + msg->dwFlags |= WINE_MSG_HASCTRL; > + memcpy(buftmp, msg->lpBuffers, msg->dwBufferCount * sizeof(WSABUF)); > + buftmp[msg->dwBufferCount] = msg->Control; > + ret = WS2_recvfrom( s, buftmp, msg->dwBufferCount, lpNumberOfBytesRecvd, > + &msg->dwFlags, msg->name, &msg->namelen, > + lpOverlapped, lpCompletionRoutine ); > You shouldn't add internal flags like that. Just rewrite WS2_recvfrom > to allow returning message headers instead of hacking around it. Is it acceptable to just add a parameter for WS2_recvfrom() or should this function get renamed? This function currently mirrors WSARecvFrom exactly. > + s1=socket(AF_INET, SOCK_DGRAM, 0); > + ok(s1!=INVALID_SOCKET, "socket() failed error: %d\n", > WSAGetLastError()); > Spaces around = & != would make me happy (and below). Also you don't > error out correctly if socket creation fails. I was trying to match test_so_reuseaddr(), I'll change this. Erich Hoover ehoo...@mines.edu