Zebediah Figura (@zfigura) commented about dlls/ws2_32/tests/sock.c:
- if (!ret)
- {
ret = connect(client, (SOCKADDR *)&addr, sizeof(addr));
ok(ret == SOCKET_ERROR && GetLastError() == WSAEWOULDBLOCK,
"Incorrect error when connecting to TCP socket: %lu\n",
GetLastError());
server = accept(listener, NULL, NULL);
ok(server != INVALID_SOCKET, "Could not accept TCP socket connection: %lu\n",
GetLastError());
ret = ioctlsocket(client, FIONBIO, &zero);
ok(!ret, "Could not set TCP socket to blocking: %lun", GetLastError());
- }
- // Fill the address with invalid data
- for (int i = 0; i < sizeof(bad_addr); i++)
((char *)&bad_addr)[i] = sizeof(bad_addr) - i;
This works, but something like memset(&bad_addr, 0xcc, sizeof(bad_addr); would probably be simpler.
(We also avoid C++ comments, which in this case doesn't seem that necessary anyway, and I think there's still some compiler that chokes on the loop declaration. Although at this point I'm not convinced that's not a -std=c89 problem...?)