From 4f46402afb993336fa12a1421aec1515e0f9d14b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= Date: Mon, 27 Nov 2017 22:22:49 +0100 Subject: [PATCH] Haiku build fix --- deps/miniupnpc/minissdpc.c | 4 ++-- deps/miniupnpc/portlistingparse.c | 10 +++++----- qb/config.libs.sh | 1 + 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/deps/miniupnpc/minissdpc.c b/deps/miniupnpc/minissdpc.c index c015298b97..6cf1570787 100644 --- a/deps/miniupnpc/minissdpc.c +++ b/deps/miniupnpc/minissdpc.c @@ -67,13 +67,13 @@ struct sockaddr_un { #define PRINT_SOCKET_ERROR(x) perror(x) #endif -#if !defined(__DragonFly__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__APPLE__) && !defined(_WIN32) && !defined(__CYGWIN__) && !defined(__sun) && !defined(__GNU__) && !defined(__FreeBSD_kernel__) +#if !defined(__DragonFly__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__APPLE__) && !defined(_WIN32) && !defined(__CYGWIN__) && !defined(__sun) && !defined(__GNU__) && !defined(__FreeBSD_kernel__) && !defined(__HAIKU__) #define HAS_IP_MREQN #endif #if !defined(HAS_IP_MREQN) && !defined(_WIN32) #include -#if defined(__sun) +#if defined(__sun) || defined(__HAIKU__) #include #endif #endif diff --git a/deps/miniupnpc/portlistingparse.c b/deps/miniupnpc/portlistingparse.c index e864c0eb70..de596698aa 100644 --- a/deps/miniupnpc/portlistingparse.c +++ b/deps/miniupnpc/portlistingparse.c @@ -31,7 +31,7 @@ static const struct { /* Helper function */ static UNSIGNED_INTEGER -atoui(const char * p, int l) +my_atoui(const char * p, int l) { UNSIGNED_INTEGER r = 0; while(l > 0 && *p) @@ -106,7 +106,7 @@ static void portlisting_data(void * d, const char * data, int l) pm->remoteHost[l] = '\0'; break; case NewExternalPort: - pm->externalPort = (unsigned short)atoui(data, l); + pm->externalPort = (unsigned short)my_atoui(data, l); break; case NewProtocol: if(l > 3) @@ -115,21 +115,21 @@ static void portlisting_data(void * d, const char * data, int l) pm->protocol[l] = '\0'; break; case NewInternalPort: - pm->internalPort = (unsigned short)atoui(data, l); + pm->internalPort = (unsigned short)my_atoui(data, l); break; case NewInternalClient: memcpy(pm->internalClient, data, l); pm->internalClient[l] = '\0'; break; case NewEnabled: - pm->enabled = (unsigned char)atoui(data, l); + pm->enabled = (unsigned char)my_atoui(data, l); break; case NewDescription: memcpy(pm->description, data, l); pm->description[l] = '\0'; break; case NewLeaseTime: - pm->leaseTime = atoui(data, l); + pm->leaseTime = my_atoui(data, l); break; default: break; diff --git a/qb/config.libs.sh b/qb/config.libs.sh index 9d382ad36a..615c36853c 100644 --- a/qb/config.libs.sh +++ b/qb/config.libs.sh @@ -29,6 +29,7 @@ elif [ "$OS" = 'Haiku' ]; then CLIB=-lroot PTHREADLIB=-lroot SOCKETLIB=-lnetwork + CFLAGS="$CFLAGS -D_BSD_SOURCE" elif [ "$OS" = 'Win32' ]; then SOCKETLIB=-lws2_32 SOCKETHEADER="#include "