File Info

Rev. 2af31d809b5b1a7920472fdfb1645186830ac141
Size 975 bytes
Time 2021-12-12 23:10:44
Author simphone
Log Message

simphone 0.8.2

Content

diff -urb miniupnpc-2.2.3/src/miniupnpc_socketdef.h miniupnpc/src/miniupnpc_socketdef.h
--- miniupnpc-2.2.3/src/miniupnpc_socketdef.h
+++ miniupnpc/src/miniupnpc_socketdef.h
@@ -34,6 +34,23 @@
 #define MSC_CAST_INT
 #endif
 
+#ifdef SIM_MODULE
+
+#include "../../simcore/logger.h"
+
+#define fprintf(must_be_stderr, ...) log_warn_(SIM_MODULE, __VA_ARGS__)
+
+#ifdef _WIN32
+#define PRINT_SOCKET_ERROR(x) log_note_(SIM_MODULE, "upnp %s %s error: %d\n", __FUNCTION__, x, WSAGetLastError())
+#else
+#include <errno.h>
+#define PRINT_SOCKET_ERROR(x) log_note_(SIM_MODULE, "upnp %s %s error: %d\n", __FUNCTION__, x, errno)
+#endif
+
+#define perror(x) PRINT_SOCKET_ERROR(x)
+
+#else
+
 /* definition of PRINT_SOCKET_ERROR */
 #ifdef _WIN32
 #define PRINT_SOCKET_ERROR(x)    fprintf(stderr, "Socket error: %s, %d\n", x, WSAGetLastError());
@@ -41,4 +58,6 @@
 #define PRINT_SOCKET_ERROR(x) perror(x)
 #endif
 
+#endif /* SIM_MODULE */
+
 #endif /* MINIUPNPC_SOCKETDEF_H_INCLUDED */
Show on old repository browser