Fix STM32 build

This commit is contained in:
Sergey Lyubka 2021-08-07 17:48:51 +01:00
parent b7ce8213d7
commit 76865cbe14
2 changed files with 11 additions and 2 deletions

View File

@ -2862,6 +2862,10 @@ typedef int SOCKET;
#define MSG_NONBLOCKING 0
#endif
#ifndef AF_INET6
#define AF_INET6 10
#endif
union usa {
struct sockaddr sa;
struct sockaddr_in sin;
@ -3220,7 +3224,8 @@ static bool mg_socketpair(SOCKET sp[2], union usa usa[2]) {
(void) memset(&usa[0], 0, sizeof(usa[0]));
usa[0].sin.sin_family = AF_INET;
usa[0].sin.sin_addr.s_addr = htonl(0x7f000001); // 127.0.0.1
// usa[0].sin.sin_addr.s_addr = mg_htonl(0x7f000001); // 127.0.0.1
*(uint32_t *) &usa->sin.sin_addr = mg_htonl(0x7f000001); // 127.0.0.1
usa[1] = usa[0];
if ((sp[0] = socket(AF_INET, SOCK_DGRAM, 0)) != INVALID_SOCKET &&

View File

@ -35,6 +35,10 @@ typedef int SOCKET;
#define MSG_NONBLOCKING 0
#endif
#ifndef AF_INET6
#define AF_INET6 10
#endif
union usa {
struct sockaddr sa;
struct sockaddr_in sin;
@ -393,7 +397,7 @@ static bool mg_socketpair(SOCKET sp[2], union usa usa[2]) {
(void) memset(&usa[0], 0, sizeof(usa[0]));
usa[0].sin.sin_family = AF_INET;
usa[0].sin.sin_addr.s_addr = htonl(0x7f000001); // 127.0.0.1
*(uint32_t *) &usa->sin.sin_addr = mg_htonl(0x7f000001); // 127.0.0.1
usa[1] = usa[0];
if ((sp[0] = socket(AF_INET, SOCK_DGRAM, 0)) != INVALID_SOCKET &&