summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2017-05-16 14:59:08 (GMT)
committerTobias Markmann <tm@ayena.de>2017-05-17 06:36:48 (GMT)
commitedf519a67a28f9acb61af6d442d94f1aa43df688 (patch)
tree802269050d3db7c13c763550269f663172938b96 /3rdParty/LibMiniUPnPc/src/miniupnpc/receivedata.c
parent6644c207c879f33dac40c02ab6787a0c4184728d (diff)
downloadswift-edf519a67a28f9acb61af6d442d94f1aa43df688.zip
swift-edf519a67a28f9acb61af6d442d94f1aa43df688.tar.bz2
Update 3rdParty/LibMiniUPnPc to miniupnpc-2.0.20170509
Test-Information: Builds on macOS 10.12.5 with Qt 5.4.2 and all unit and integration tests pass. Change-Id: I491c0f78bf8773056feb3825d21989d6c7a2aeab
Diffstat (limited to '3rdParty/LibMiniUPnPc/src/miniupnpc/receivedata.c')
-rw-r--r--3rdParty/LibMiniUPnPc/src/miniupnpc/receivedata.c44
1 files changed, 20 insertions, 24 deletions
diff --git a/3rdParty/LibMiniUPnPc/src/miniupnpc/receivedata.c b/3rdParty/LibMiniUPnPc/src/miniupnpc/receivedata.c
index ffbfbea..5dbd227 100644
--- a/3rdParty/LibMiniUPnPc/src/miniupnpc/receivedata.c
+++ b/3rdParty/LibMiniUPnPc/src/miniupnpc/receivedata.c
@@ -1,2 +1,2 @@
-/* $Id: receivedata.c,v 1.5 2013/10/07 09:48:36 nanard Exp $ */
+/* $Id: receivedata.c,v 1.8 2017/04/21 10:16:45 nanard Exp $ */
/* Project : miniupnp
@@ -4,3 +4,3 @@
* Author : Thomas Bernard
- * Copyright (c) 2011-2012 Thomas Bernard
+ * Copyright (c) 2011-2014 Thomas Bernard
* This software is subject to the conditions detailed in the
@@ -9,2 +9,3 @@
#include <stdio.h>
+#include <string.h>
#ifdef _WIN32
@@ -12,3 +13,3 @@
#include <ws2tcpip.h>
-#else
+#else /* _WIN32 */
#include <unistd.h>
@@ -23,9 +24,9 @@
#include <poll.h>
-#endif
+#endif /* !defined(__amigaos__) && !defined(__amigaos4__) */
#include <errno.h>
#define MINIUPNPC_IGNORE_EINTR
-#endif
+#endif /* _WIN32 */
#ifdef _WIN32
-#define PRINT_SOCKET_ERROR(x) printf("Socket error: %s, %d\n", x, WSAGetLastError());
+#define PRINT_SOCKET_ERROR(x) fprintf(stderr, "Socket error: %s, %d\n", x, WSAGetLastError());
#else
@@ -41,11 +42,6 @@ receivedata(int socket,
{
-#if MINIUPNPC_GET_SRC_ADDR
-#ifdef DEBUG
- /* to shut up valgrind about uninit value */
- struct sockaddr_storage src_addr = {0};
-#else
+#ifdef MINIUPNPC_GET_SRC_ADDR
struct sockaddr_storage src_addr;
-#endif
socklen_t src_addr_len = sizeof(src_addr);
-#endif
+#endif /* MINIUPNPC_GET_SRC_ADDR */
int n;
@@ -56,3 +52,3 @@ receivedata(int socket,
do {
-#endif
+#endif /* MINIUPNPC_IGNORE_EINTR */
fds[0].fd = socket;
@@ -62,3 +58,3 @@ receivedata(int socket,
} while(n < 0 && errno == EINTR);
-#endif
+#endif /* MINIUPNPC_IGNORE_EINTR */
if(n < 0) {
@@ -70,3 +66,3 @@ receivedata(int socket,
}
-#else /* !defined(_WIN32) && !defined(__amigaos__) && !defined(__amigaos4__) */
+#else /* !defined(_WIN32) && !defined(__amigaos__) && !defined(__amigaos4__) */
/* using select under _WIN32 and amigaos */
@@ -85,9 +81,10 @@ receivedata(int socket,
}
-#endif
-#if MINIUPNPC_GET_SRC_ADDR
+#endif /* !defined(_WIN32) && !defined(__amigaos__) && !defined(__amigaos4__) */
+#ifdef MINIUPNPC_GET_SRC_ADDR
+ memset(&src_addr, 0, sizeof(src_addr));
n = recvfrom(socket, data, length, 0,
(struct sockaddr *)&src_addr, &src_addr_len);
-#else
+#else /* MINIUPNPC_GET_SRC_ADDR */
n = recv(socket, data, length, 0);
-#endif
+#endif /* MINIUPNPC_GET_SRC_ADDR */
if(n<0) {
@@ -95,3 +92,3 @@ receivedata(int socket,
}
-#if MINIUPNPC_GET_SRC_ADDR
+#ifdef MINIUPNPC_GET_SRC_ADDR
if (src_addr.ss_family == AF_INET6) {
@@ -100,3 +97,3 @@ receivedata(int socket,
printf("scope_id=%u\n", src_addr6->sin6_scope_id);
-#endif
+#endif /* DEBUG */
if(scope_id)
@@ -104,3 +101,3 @@ receivedata(int socket,
}
-#endif
+#endif /* MINIUPNPC_GET_SRC_ADDR */
return n;
@@ -108,2 +105 @@ receivedata(int socket,
-