BIO: Undefine UNICODE in b_addr.c to get POSIX declaration of gai_strerror()

When UNICODE is defined, Windows headers push for WCHAR implementations,
which aren't compatible with POSIX declarations.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13318)
This commit is contained in:
Richard Levitte 2020-11-10 10:45:07 +01:00
parent 105d01f1eb
commit 256d41d437

View File

@ -11,6 +11,16 @@
# define _GNU_SOURCE
#endif
/*
* VC configurations may define UNICODE, to indicate to the C RTL that
* WCHAR functions are preferred.
* This affects functions like gai_strerror(), which is implemented as
* an alias macro for gai_strerrorA() (which returns a const char *) or
* gai_strerrorW() (which returns a const WCHAR *). This source file
* assumes POSIX declarations, so prefer the non-UNICODE definitions.
*/
#undef UNICODE
#include <assert.h>
#include <string.h>