all repos — mgba @ 9da3e5e1f91bc7fbb429e6877153ffa9c22727ab

mGBA Game Boy Advance Emulator

Util: Fix socket code to not use struct designated initialization
Jeffrey Pfau jeffrey@endrift.com
Wed, 07 Jan 2015 02:06:38 -0800
commit

9da3e5e1f91bc7fbb429e6877153ffa9c22727ab

parent

aa12eeef3a8ea3eaed3d6d863b9f5cdbc4b0a8f1

1 files changed, 8 insertions(+), 10 deletions(-)

jump to
M src/util/socket.hsrc/util/socket.h

@@ -50,11 +50,10 @@ if (SOCKET_FAILED(sock)) {

return sock; } - struct sockaddr_in bindInfo = { - .sin_family = AF_INET, - .sin_port = htons(port), - .sin_addr = { 0 } - }; + struct sockaddr_in bindInfo; + memset(&bindInfo, 0, sizeof(bindInfo)); + bindInfo.sin_family = AF_INET; + bindInfo.sin_port = htons(port); bindInfo.sin_addr.s_addr = htonl(bindAddress); int err = bind(sock, (const struct sockaddr*) &bindInfo, sizeof(struct sockaddr_in)); if (err) {

@@ -70,11 +69,10 @@ if (SOCKET_FAILED(sock)) {

return sock; } - struct sockaddr_in bindInfo = { - .sin_family = AF_INET, - .sin_port = htons(port), - .sin_addr = { 0 } - }; + struct sockaddr_in bindInfo; + memset(&bindInfo, 0, sizeof(bindInfo)); + bindInfo.sin_family = AF_INET; + bindInfo.sin_port = htons(port); bindInfo.sin_addr.s_addr = htonl(destinationAddress); int err = connect(sock, (const struct sockaddr*) &bindInfo, sizeof(struct sockaddr_in)); if (err) {