[Bug 24775] get_local_interfaces_ips() not implemented on Windows
bugzilla-daemon at freedesktop.org
bugzilla-daemon at freedesktop.org
Sun Oct 31 13:48:48 CET 2010
https://bugs.freedesktop.org/show_bug.cgi?id=24775
--- Comment #3 from Thomas Flueeli <tflueeli at gmail.com> 2010-10-31 05:48:48 PDT ---
(In reply to comment #2)
> MSDN says the ioctl fails with error WSAEFAULT if the buffer is too small.
> Would it be worth allocating this array dynamically, catching WSAEFAULT, and
> retrying with a larger buffer until it works? (Perhaps not.)
Sounds reasonable. I've implemented it in a way pretty similar to the
non-HAVE_GETIFADDRS version of get_local_interfaces_ips().
> I'd prefer these to have an unsigned type that's at least as large as bytes
> (gsize is guaranteed to be large enough for anything that'll fit in memory, so
> use that?)
Done
> We prefer to spell null pointers as NULL, so the first 0 here should be NULL.
Ok, fixed
> + if (WSAIoctl (sockfd, SIO_GET_INTERFACE_LIST, 0, 0, &iflist,
> + sizeof (iflist), &bytes, 0, 0) == SOCKET_ERROR)
>
> This parameter is documented as a LPDWORD, so you should declare 'bytes' as
> having type DWORD, unless DWORD is guaranteed by Windows to be the same thing
> as "unsigned long" in all versions and platforms.
DWORD is always defined as "unsigned long", see
http://msdn.microsoft.com/en-us/library/aa383751%28VS.85%29.aspx
> If I'm reading MSDN correctly, these two 0 parameters would be better as NULL.
Yes you're right, fixed
> Our normal coding style would be (i = 0; i < num; i++)
Oops, it takes some time to get used to a different coding style.
--
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the telepathy-bugs
mailing list