https://git.reactos.org/?p=reactos.git;a=commitdiff;h=da53a9399a5fa65451e2b…
commit da53a9399a5fa65451e2b23b2eb94d5ed358b7a2
Author: Colin Finck <colin(a)reactos.org>
AuthorDate: Fri Oct 6 17:33:47 2017 +0200
[WS2_32_APITEST] Make the apitest fully C89-compliant to fix building under MSVC
2010.
In C89, you can only initialize the first member of a union within a declaration.
Unfortunately, that is the S_un_b UCHAR array for the S_un union inside struct in_addr.
So we have to initialize it with each UCHAR member of Address.
---
modules/rostests/apitests/ws2_32/bind.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/modules/rostests/apitests/ws2_32/bind.c
b/modules/rostests/apitests/ws2_32/bind.c
index 56d4f41f99..1e8c393aa4 100644
--- a/modules/rostests/apitests/ws2_32/bind.c
+++ b/modules/rostests/apitests/ws2_32/bind.c
@@ -23,6 +23,11 @@ static
VOID
TestBind(IN_ADDR Address)
{
+ const UCHAR b1 = Address.S_un.S_un_b.s_b1;
+ const UCHAR b2 = Address.S_un.S_un_b.s_b2;
+ const UCHAR b3 = Address.S_un.S_un_b.s_b3;
+ const UCHAR b4 = Address.S_un.S_un_b.s_b4;
+
int Error;
struct
{
@@ -36,19 +41,19 @@ TestBind(IN_ADDR Address)
{
{ SOCK_STREAM, IPPROTO_TCP, { AF_INET, PORT, {{{ 0x7f, 0x00, 0x00, 0x01 }}} }, 0,
0, { AF_INET, PORT, {{{ 0x7f, 0x00, 0x00, 0x01 }}} } },
{ SOCK_STREAM, IPPROTO_TCP, { AF_INET, PORT, {{{ 0x00, 0x00, 0x00, 0x00 }}} }, 0,
0, { AF_INET, PORT, {{{ 0x00, 0x00, 0x00, 0x00 }}} } },
- { SOCK_STREAM, IPPROTO_TCP, { AF_INET, PORT, Address }, 0, 0, { AF_INET, PORT,
Address } },
+ { SOCK_STREAM, IPPROTO_TCP, { AF_INET, PORT, {{{ b1, b2, b3, b4 }}} }, 0, 0, {
AF_INET, PORT, {{{ b1, b2, b3, b4 }}} } },
{ SOCK_STREAM, IPPROTO_TCP, { AF_INET, PORT, {{{ 0xff, 0xff, 0xff, 0xff }}} },
SOCKET_ERROR, WSAEADDRNOTAVAIL },
{ SOCK_STREAM, IPPROTO_TCP, { AF_INET, 0, {{{ 0x7f, 0x00, 0x00, 0x01 }}} }, 0, 0,
{ AF_INET, 0, {{{ 0x7f, 0x00, 0x00, 0x01 }}} } },
{ SOCK_STREAM, IPPROTO_TCP, { AF_INET, 0, {{{ 0x00, 0x00, 0x00, 0x00 }}} } },
- { SOCK_STREAM, IPPROTO_TCP, { AF_INET, 0, Address }, 0, 0, { AF_INET, 0, Address
} },
+ { SOCK_STREAM, IPPROTO_TCP, { AF_INET, 0, {{{ b1, b2, b3, b4 }}} }, 0, 0, {
AF_INET, 0, {{{ b1, b2, b3, b4 }}} } },
{ SOCK_STREAM, IPPROTO_TCP, { AF_INET, 0, {{{ 0xff, 0xff, 0xff, 0xff }}} },
SOCKET_ERROR, WSAEADDRNOTAVAIL },
{ SOCK_DGRAM, IPPROTO_UDP, { AF_INET, PORT, {{{ 0x7f, 0x00, 0x00, 0x01 }}} }, 0,
0, { AF_INET, PORT, {{{ 0x7f, 0x00, 0x00, 0x01 }}} } },
{ SOCK_DGRAM, IPPROTO_UDP, { AF_INET, PORT, {{{ 0x00, 0x00, 0x00, 0x00 }}} }, 0,
0, { AF_INET, PORT, {{{ 0x00, 0x00, 0x00, 0x00 }}} } },
- { SOCK_DGRAM, IPPROTO_UDP, { AF_INET, PORT, Address }, 0, 0, { AF_INET, PORT,
Address } },
+ { SOCK_DGRAM, IPPROTO_UDP, { AF_INET, PORT, {{{ b1, b2, b3, b4 }}} }, 0, 0, {
AF_INET, PORT, {{{ b1, b2, b3, b4 }}} } },
{ SOCK_DGRAM, IPPROTO_UDP, { AF_INET, PORT, {{{ 0xff, 0xff, 0xff, 0xff }}} },
SOCKET_ERROR, WSAEADDRNOTAVAIL },
{ SOCK_DGRAM, IPPROTO_UDP, { AF_INET, 0, {{{ 0x7f, 0x00, 0x00, 0x01 }}} }, 0, 0,
{ AF_INET, 0, {{{ 0x7f, 0x00, 0x00, 0x01 }}} } },
{ SOCK_DGRAM, IPPROTO_UDP, { AF_INET, 0, {{{ 0x00, 0x00, 0x00, 0x00 }}} } },
- { SOCK_DGRAM, IPPROTO_UDP, { AF_INET, 0, Address }, 0, 0,{ AF_INET, 0, Address }
},
+ { SOCK_DGRAM, IPPROTO_UDP, { AF_INET, 0, {{{ b1, b2, b3, b4 }}} }, 0, 0,{
AF_INET, 0, {{{ b1, b2, b3, b4 }}} } },
{ SOCK_DGRAM, IPPROTO_UDP, { AF_INET, 0, {{{ 0xff, 0xff, 0xff, 0xff }}} },
SOCKET_ERROR, WSAEADDRNOTAVAIL },
};
const INT TestCount = _countof(Tests);