[Bug 24775] get_local_interfaces_ips() not implemented on Windows

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Thu Oct 28 17:41:28 CEST 2010


https://bugs.freedesktop.org/show_bug.cgi?id=24775

--- Comment #2 from Simon McVittie <simon.mcvittie at collabora.co.uk> 2010-10-28 08:41:28 PDT ---
Review of attachment 39856:
 --> (https://bugs.freedesktop.org/review?bug=24775&attachment=39856)

Thanks, this is superb! Some nitpicking on the implementation:

::: src/bytestream-socks5.c
@@ +1650,3 @@
 {
+  gint sockfd;
+  INTERFACE_INFO iflist[32];

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.)

@@ +1653,3 @@
+  gulong bytes;
+  gint num = 0;
+  gint i;

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?)

@@ +1664,3 @@
+    }
+
+  if (WSAIoctl (sockfd, SIO_GET_INTERFACE_LIST, 0, 0, &iflist,

We prefer to spell null pointers as NULL, so the first 0 here should be NULL.

@@ +1665,3 @@
+
+  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.

If I'm reading MSDN correctly, these two 0 parameters would be better as NULL.

@@ +1674,3 @@
+
+  /* Loop throught the interface list and get the IP address of each IF */
+  for (i=0; i<num; ++i)

Our normal coding style would be (i = 0; i < num; i++)

-- 
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