Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits: 0c45a05b by Steve Lhomme at 2026-06-04T08:07:17+00:00 gai_strerror: add declaration as its not defined in vlc_fixups.h - - - - - 8f9d92fd by Steve Lhomme at 2026-06-04T08:07:17+00:00 gai_strerror: remap Windows SDK EAI_NODATA to WSANO_DATA Otherwise it's mapped to WSAHOST_NOT_FOUND which we already handle with EAI_NONAME. And we wouldn't have a string for WSANO_DATA. - - - - - fabc9361 by Steve Lhomme at 2026-06-04T08:07:17+00:00 gai_strerror: map missing Windows getaddrinfo/getnameinfo errors gai_strerror() is called to get the string version of an error code returned by vlc_getaddrinfo(), vlc_getnameinfo() or vlc_getaddrinfo_i11e(). In all cases the value comes from an OS call. On Windows they return both EAI_* and a lot of WSA errors [^1]. The strings come from src/win32/error.c. [^1]: https://learn.microsoft.com/en-us/windows/win32/api/ws2tcpip/nf-ws2tcpip-getaddrinfo#return-value - - - - - 70ff5756 by Steve Lhomme at 2026-06-04T08:07:17+00:00 build: always use the compat version of gai_strerror() on Windows We don't know what codepage the might be for gai_strerrorA() and the documentation [^1] doesn't mention if it's using it or not. Internally we deal with UTF-8 char* strings. Also the Windows version is not thread safe. The returned pointer is always the same and points to different content. [^1]: https://learn.microsoft.com/en-us/windows/win32/api/ws2tcpip/nf-ws2tcpip-gai_strerrora - - - - - 4 changed files: - compat/gai_strerror.c - configure.ac - include/vlc_network.h - meson.build Changes: ===================================== compat/gai_strerror.c ===================================== @@ -27,6 +27,26 @@ # include "config.h" #endif +const char *gai_strerror (int); + +#ifdef _WIN32 +# include <winsock2.h> +# undef gai_strerror /* mapped to gai_strerrorA or gai_strerrorW */ + +#ifdef _MSC_VER +/* EAI_NODATA was removed in RFC 3493 + * The Windows SDK defines EAI_NODATA as EAI_NONAME, aka WSAHOST_NOT_FOUND. + * It used to be WSANO_DATA. Remap it locally so we have strings for all the + * WSA errors that getaddrinfo() can return. + * + * In mingw-w64 EAI_NODATA is still mapped to WSANO_DATA. + */ +# undef EAI_NODATA +# define EAI_NODATA WSANO_DATA +#endif + +#endif /* _WIN32 */ + /* GAI error codes. See include/vlc_network.h. */ #ifndef EAI_BADFLAGS # define EAI_BADFLAGS -1 @@ -84,6 +104,12 @@ static const struct { EAI_MEMORY, "Memory allocation failure" }, { EAI_OVERFLOW, "Buffer overflow" }, { EAI_SYSTEM, "System error" }, + +#ifdef _WIN32 + { WSAEFAULT, "Invalid memory address" }, + { WSANOTINITIALISED, "WSAStartup not called or failed" }, +#endif + { 0, "" }, }; ===================================== configure.ac ===================================== @@ -537,8 +537,8 @@ AS_IF([test "${SYS}" = "mingw32"],[ vlc_winstore_app=1 LIBCOM="-loleaut32" VLC_ADD_LIBS([libvlccore], [-lruntimeobject]) - AC_LIBOBJ([gai_strerror]) ],[]) + AC_LIBOBJ([gai_strerror]) AC_SUBST([LIBCOM]) AC_SUBST([LIBCOMCXXFLAGS]) ]) ===================================== include/vlc_network.h ===================================== @@ -283,10 +283,9 @@ static inline int vlc_setsockopt(int s, int level, int name, #endif #ifdef _WIN32 -# if defined(UNICODE) +/* undo ws2tcpip.h define and declare the signature from compat */ # undef gai_strerror -# define gai_strerror gai_strerrorA -# endif +const char *gai_strerror (int); #endif /* union of the various sockaddr structures often used together */ ===================================== meson.build ===================================== @@ -759,7 +759,7 @@ endif libcompat_sources = [] -if have_win_store +if host_system == 'windows' libcompat_sources += 'gai_strerror.c' endif View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/13f988a2e7b29492d6e7c303b90863e8c003656e...70ff5756b3996cbd10343cd2c905d3ae7781b1fe -- View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/13f988a2e7b29492d6e7c303b90863e8c003656e...70ff5756b3996cbd10343cd2c905d3ae7781b1fe You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help
_______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
