[vlc-devel] [PATCH] Contrib: fix UPNP building on Win32

Steve Lhomme robux4 at gmail.com
Mon Mar 2 16:38:34 CET 2015


On 02/03/2015 16:22, Steve Lhomme wrote:
> Fixes #14057
> ---
>   modules/services_discovery/upnp.hpp | 4 ++++
>   1 file changed, 4 insertions(+)
>
> diff --git a/modules/services_discovery/upnp.hpp b/modules/services_discovery/upnp.hpp
> index 23fe4db..09e1bc3 100644
> --- a/modules/services_discovery/upnp.hpp
> +++ b/modules/services_discovery/upnp.hpp
> @@ -28,6 +28,10 @@
>   #include <vector>
>   #include <string>
>
> +#ifdef _WIN32
> +# undef if_nametoindex
> +#endif
> +
>   #include <upnp/upnp.h>
>   #include <upnp/upnptools.h>
>
>

More generally in vlc_fixups.h we define if_nametoindex() to atoi() if 
it doesn't exist. So when it's actually defined in the win32 includes, 
it's renamed to atoi()...

So should we assume that in vlc_fixups.h we must know if 
`if_nametoindex` is defined or not ? In that case we should include the 
proper files when compiling for Win32, like UPNP does.

`if_nametoindex` is only used in udp.c, so maybe the fix belongs there ?

By the way, if_nametoindex() exists on Vista and up (_WIN32_WINNT >= 
0x600). Given the current atoi() call in the current udp.c code, I think 
multicasting is not going to work on Windows. But with the proper 
include, it may work.

Steve




More information about the vlc-devel mailing list