[vlc-commits] contribs: upnp: Fix interface filtering

Hugo Beauzée-Luyssen git at videolan.org
Fri Mar 17 18:44:13 CET 2017


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Fri Mar 17 18:36:09 2017 +0100| [af7f15a8cec92c669a6b4c0e64ad909574a79abf] | committer: Hugo Beauzée-Luyssen

contribs: upnp: Fix interface filtering

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=af7f15a8cec92c669a6b4c0e64ad909574a79abf
---

 contrib/src/upnp/rules.mak         |  1 +
 contrib/src/upnp/use-unicode.patch | 49 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 50 insertions(+)

diff --git a/contrib/src/upnp/rules.mak b/contrib/src/upnp/rules.mak
index 9636036..5a4d815 100644
--- a/contrib/src/upnp/rules.mak
+++ b/contrib/src/upnp/rules.mak
@@ -44,6 +44,7 @@ endif
 	$(APPLY) $(SRC)/upnp/fix_infinite_loop.patch
 	$(APPLY) $(SRC)/upnp/dont_use_down_intf.patch
 	$(APPLY) $(SRC)/upnp/upnp-no-debugfile.patch
+	$(APPLY) $(SRC)/upnp/use-unicode.patch
 	$(UPDATE_AUTOCONFIG) && cd $(UNPACK_DIR) && mv config.guess config.sub build-aux/
 	$(MOVE)
 
diff --git a/contrib/src/upnp/use-unicode.patch b/contrib/src/upnp/use-unicode.patch
new file mode 100644
index 0000000..b67b780
--- /dev/null
+++ b/contrib/src/upnp/use-unicode.patch
@@ -0,0 +1,49 @@
+--- upnp/upnp/src/api/upnpapi.c.orig	2017-03-17 17:21:09.510544751 +0100
++++ upnp/upnp/src/api/upnpapi.c	2017-03-17 17:21:32.742531559 +0100
+@@ -3264,31 +3264,10 @@
+ 		}
+ 		if (ifname_found == 0) {
+ 			/* We have found a valid interface name. Keep it. */
+-#ifdef UPNP_USE_MSVCPP
+-			/*
+-			 * Partial fix for VC - friendly name is wchar string,
+-			 * but currently gIF_NAME is char string. For now try
+-			 * to convert it, which will work with many (but not
+-			 * all) adapters. A full fix would require a lot of
+-			 * big changes (gIF_NAME to wchar string?).
+-			 */
+ 			wcstombs(gIF_NAME, adapts_item->FriendlyName,
+ 				sizeof(gIF_NAME));
+-#else
+-			memset(gIF_NAME, 0, sizeof(gIF_NAME));
+-			strncpy(gIF_NAME, adapts_item->FriendlyName,
+-				sizeof(gIF_NAME) - 1);
+-#endif
+ 			ifname_found = 1;
+ 		} else {
+-#ifdef UPNP_USE_MSVCPP
+-			/*
+-			 * Partial fix for VC - friendly name is wchar string,
+-			 * but currently gIF_NAME is char string. For now try
+-			 * to convert it, which will work with many (but not
+-			 * all) adapters. A full fix would require a lot of
+-			 * big changes (gIF_NAME to wchar string?).
+-			 */
+ 			char tmpIfName[LINE_SIZE] = { 0 };
+ 			wcstombs(tmpIfName, adapts_item->FriendlyName,
+ 				sizeof(tmpIfName));
+@@ -3298,14 +3277,6 @@
+ 				/* This is not the interface we're looking for. */
+ 				continue;
+ 			}
+-#else
+-			if (strncmp
+-			    (gIF_NAME, adapts_item->FriendlyName,
+-			     sizeof(gIF_NAME)) != 0) {
+-				/* This is not the interface we're looking for. */
+-				continue;
+-			}
+-#endif
+ 		}
+ 		/* Loop thru this adapter's unicast IP addresses. */
+ 		uni_addr = adapts_item->FirstUnicastAddress;



More information about the vlc-commits mailing list