clang6 c++ fixes from upstream repo

This commit is contained in:
sthen 2018-04-11 14:43:21 +00:00
parent 4c21bc5c61
commit 4a45df0710
5 changed files with 109 additions and 2 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.10 2018/01/11 19:27:07 rpe Exp $
# $OpenBSD: Makefile,v 1.11 2018/04/11 14:43:21 sthen Exp $
COMMENT= network traffic probe with web ui and deep packet inspection
@ -6,8 +6,9 @@ GH_ACCOUNT= ntop
GH_PROJECT= ntopng
GH_TAGNAME= 3.0
NDPI_V= 2.0
# XXX I have a preliminary update to 3.2, but many crashes with SSDP
DISTFILES= ntopng-${GH_TAGNAME}.tar.gz ndpi-${NDPI_V}.tar.gz:0
REVISION= 0
REVISION= 1
CATEGORIES= net

View File

@ -0,0 +1,22 @@
$OpenBSD: patch-src_AddressResolution_cpp,v 1.1 2018/04/11 14:43:21 sthen Exp $
From 3603f3b6c85b9fa884101ba6e4a1b351787b12f9 Mon Sep 17 00:00:00 2001
From: emanuele-f <black.silver@hotmail.it>
Date: Tue, 6 Jun 2017 10:16:44 +0200
Subject: [PATCH] Fix comparison between pointer and integer error
src/AddressResolution.cpp:55:35: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
if((at = strchr(query, '@')) != '\0') at[0] = '\0';
Index: src/AddressResolution.cpp
--- src/AddressResolution.cpp.orig
+++ src/AddressResolution.cpp
@@ -52,7 +52,7 @@ void AddressResolution::resolveHostName(char *_numeric
u_int numeric_ip_len;
snprintf(query, sizeof(query), "%s", _numeric_ip);
- if((at = strchr(query, '@')) != '\0') at[0] = '\0';
+ if((at = strchr(query, '@')) != NULL) at[0] = '\0';
numeric_ip = query;
numeric_ip_len = strlen(numeric_ip)-1;

View File

@ -0,0 +1,22 @@
$OpenBSD: patch-src_DivertInterface_cpp,v 1.3 2018/04/11 14:43:21 sthen Exp $
Adapted from
From f0877a0475d94de4d496acfd8f1617873801858f Mon Sep 17 00:00:00 2001
From: Guido Falsi <mad@madpilot.net>
Date: Fri, 26 Jan 2018 12:38:40 +0100
Subject: [PATCH] Modify files to allow compiling using llvm/clang 6.0.0 as
recently imported in FreeBSD 12-CURRENT. (#1634)
Index: src/DivertInterface.cpp
--- src/DivertInterface.cpp.orig
+++ src/DivertInterface.cpp
@@ -99,7 +99,7 @@ DivertInterface::DivertInterface(const char *name) : N
sin.sin_family = AF_INET, sin.sin_port = htons(port);
sin_len = sizeof(struct sockaddr_in);
- if(bind(sock, (struct sockaddr *) &sin, sin_len) == -1) {
+ if(::bind(sock, (struct sockaddr *) &sin, sin_len) == -1) {
ntop->getTrace()->traceEvent(TRACE_ERROR, "Unable to bind divert socket to port %d", port);
throw 1;
}

View File

@ -0,0 +1,40 @@
$OpenBSD: patch-third-party_mongoose_mongoose_c,v 1.1 2018/04/11 14:43:21 sthen Exp $
Adapted from
From f0877a0475d94de4d496acfd8f1617873801858f Mon Sep 17 00:00:00 2001
From: Guido Falsi <mad@madpilot.net>
Date: Fri, 26 Jan 2018 12:38:40 +0100
Subject: [PATCH] Modify files to allow compiling using llvm/clang 6.0.0 as
recently imported in FreeBSD 12-CURRENT. (#1634)
Index: third-party/mongoose/mongoose.c
--- third-party/mongoose/mongoose.c.orig
+++ third-party/mongoose/mongoose.c
@@ -727,7 +727,7 @@ struct mg_request_info *mg_get_request_info(struct mg_
return &conn->request_info;
}
-static void mg_strlcpy(register char *dst, register const char *src, size_t n) {
+static void mg_strlcpy(char *dst, const char *src, size_t n) {
for (; *src != '\0' && n > 1; n--) {
*dst++ = *src++;
}
@@ -2127,7 +2127,7 @@ static void MD5Init(MD5_CTX *ctx) {
}
static void MD5Transform(uint32_t buf[4], uint32_t const in[16]) {
- register uint32_t a, b, c, d;
+ uint32_t a, b, c, d;
a = buf[0];
b = buf[1];
@@ -4499,7 +4499,7 @@ static int set_ports_option(struct mg_context *ctx) {
(void *)
#endif
&on, sizeof(on))) != 0 ||
- (rc_bind = bind(so.sock,
+ (rc_bind = ::bind(so.sock,
&sa->sa,
(sa->sa.sa_family == AF_INET) ? sizeof(sa->sin) : sizeof(sa->sin6))
) != 0 ||

View File

@ -0,0 +1,22 @@
$OpenBSD: patch-third-party_snmp_net_c,v 1.1 2018/04/11 14:43:21 sthen Exp $
Adapted from
From f0877a0475d94de4d496acfd8f1617873801858f Mon Sep 17 00:00:00 2001
From: Guido Falsi <mad@madpilot.net>
Date: Fri, 26 Jan 2018 12:38:40 +0100
Subject: [PATCH] Modify files to allow compiling using llvm/clang 6.0.0 as
recently imported in FreeBSD 12-CURRENT. (#1634)
Index: third-party/snmp/net.c
--- third-party/snmp/net.c.orig
+++ third-party/snmp/net.c
@@ -64,7 +64,7 @@ int open_udp_socket(int port)
si_me.sin_family = AF_INET;
si_me.sin_port = htons(port);
si_me.sin_addr.s_addr = htonl(INADDR_ANY);
- if (bind(s, (struct sockaddr *) &si_me, sizeof(si_me)) != 0)
+ if (::bind(s, (struct sockaddr *) &si_me, sizeof(si_me)) != 0)
return(-1); //diep("bind");
return s;