vlc | branch: master | Rémi Denis-Courmont <[email protected]> | Sat Nov 23 18:48:58 2019 +0200| [d5507a75bfb1ea133452149d9b119eacd5e58fc2] | committer: Rémi Denis-Courmont
xcb/window: fix Win32 build MSDN requires the host name to fit in 256 bytes. sysconf() is not available. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d5507a75bfb1ea133452149d9b119eacd5e58fc2 --- modules/video_output/xcb/window.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/modules/video_output/xcb/window.c b/modules/video_output/xcb/window.c index 491e5e17cf..a8116020c9 100644 --- a/modules/video_output/xcb/window.c +++ b/modules/video_output/xcb/window.c @@ -26,9 +26,14 @@ #include <stdarg.h> #include <assert.h> -#include <poll.h> +#ifdef HAVE_POLL +# include <poll.h> +#endif #include <unistd.h> /* gethostname() and sysconf() */ #include <limits.h> /* _POSIX_HOST_NAME_MAX */ +#ifdef _WIN32 +# include <winsock2.h> +#endif #include <xcb/xcb.h> #ifdef HAVE_XKBCOMMON @@ -473,11 +478,18 @@ void set_wm_hints (xcb_connection_t *conn, xcb_window_t window) static inline void set_hostname_prop (xcb_connection_t *conn, xcb_window_t window) { - char* hostname; + char *hostname; +#ifndef _WIN32 long host_name_max = sysconf (_SC_HOST_NAME_MAX); - if (host_name_max <= 0) host_name_max = _POSIX_HOST_NAME_MAX; + + if (host_name_max <= 0) + host_name_max = _POSIX_HOST_NAME_MAX; +#else + size_t host_name_max = 256; +#endif hostname = malloc (host_name_max); - if(!hostname) return; + if (hostname == NULL) + return; if (gethostname (hostname, host_name_max) == 0) { _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
