mirror of https://github.com/mgba-emu/mgba.git
Util: Fix socket code to not use struct designated initialization
This commit is contained in:
parent
aa12eeef3a
commit
9da3e5e1f9
|
@ -50,11 +50,10 @@ static inline Socket SocketOpenTCP(int port, uint32_t bindAddress) {
|
||||||
return sock;
|
return sock;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct sockaddr_in bindInfo = {
|
struct sockaddr_in bindInfo;
|
||||||
.sin_family = AF_INET,
|
memset(&bindInfo, 0, sizeof(bindInfo));
|
||||||
.sin_port = htons(port),
|
bindInfo.sin_family = AF_INET;
|
||||||
.sin_addr = { 0 }
|
bindInfo.sin_port = htons(port);
|
||||||
};
|
|
||||||
bindInfo.sin_addr.s_addr = htonl(bindAddress);
|
bindInfo.sin_addr.s_addr = htonl(bindAddress);
|
||||||
int err = bind(sock, (const struct sockaddr*) &bindInfo, sizeof(struct sockaddr_in));
|
int err = bind(sock, (const struct sockaddr*) &bindInfo, sizeof(struct sockaddr_in));
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -70,11 +69,10 @@ static inline Socket SocketConnectTCP(int port, uint32_t destinationAddress) {
|
||||||
return sock;
|
return sock;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct sockaddr_in bindInfo = {
|
struct sockaddr_in bindInfo;
|
||||||
.sin_family = AF_INET,
|
memset(&bindInfo, 0, sizeof(bindInfo));
|
||||||
.sin_port = htons(port),
|
bindInfo.sin_family = AF_INET;
|
||||||
.sin_addr = { 0 }
|
bindInfo.sin_port = htons(port);
|
||||||
};
|
|
||||||
bindInfo.sin_addr.s_addr = htonl(destinationAddress);
|
bindInfo.sin_addr.s_addr = htonl(destinationAddress);
|
||||||
int err = connect(sock, (const struct sockaddr*) &bindInfo, sizeof(struct sockaddr_in));
|
int err = connect(sock, (const struct sockaddr*) &bindInfo, sizeof(struct sockaddr_in));
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|
Loading…
Reference in New Issue