[vlc-commits] win32: wrap {g,s}etsockopt()

Rémi Denis-Courmont git at videolan.org
Sun Apr 14 09:18:06 CEST 2019


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Apr 14 09:41:38 2019 +0300| [36715d9b79f34824e126c2bc3aee2f1c1c16af46] | committer: Rémi Denis-Courmont

win32: wrap {g,s}etsockopt()

char * can alias anything, and Winsock relies on that. Unfortunately,
the compiler still issues warnings. This works around that.

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

 include/vlc_network.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/include/vlc_network.h b/include/vlc_network.h
index 7cc384587a..b4d5fabdd6 100644
--- a/include/vlc_network.h
+++ b/include/vlc_network.h
@@ -202,6 +202,22 @@ VLC_API int vlc_close(int);
 
 /** @} */
 
+#ifdef _WIN32
+static inline int vlc_getsockopt(int s, int level, int name,
+                                 void *val, socklen_t *len)
+{
+    return getsockopt(s, level, name, (char *)val, len);
+}
+#define getsockopt vlc_getsockopt
+
+static inline int vlc_setsockopt(int s, int level, int name,
+                                 const void *val, socklen_t len)
+{
+    return setsockopt(s, level, name, (const char *)val, len);
+}
+#define setsockopt vlc_setsockopt
+#endif
+
 /* Portable network names/addresses resolution layer */
 
 #define NI_MAXNUMERICHOST 64



More information about the vlc-commits mailing list