Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Jan 2018 14:39:33 +0000 (UTC)
From:      Jan Beich <jbeich@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r459998 - head/net-p2p/verlihub/files
Message-ID:  <201801261439.w0QEdXvq003587@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jbeich
Date: Fri Jan 26 14:39:32 2018
New Revision: 459998
URL: https://svnweb.freebsd.org/changeset/ports/459998

Log:
  net-p2p/verlihub: unbreak build with Clang 6 (C++14 by default)
  
  casyncconn.cpp:585:62: error: invalid operands to binary expression ('__bind<int &, sockaddr *, unsigned long>' and 'int')
          if(bind(sock, (struct sockaddr *)&mAddrIN, sizeof(mAddrIN)) == -1)
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~
  creguserinfo.cpp:156:32: error: non-constant-expression cannot be narrowed from type 'char' to 'unsigned char' in initializer list [-Wc++11-narrowing]
                  unsigned char charsalt[2] = {((char*)&str)[0],((char*)&str)[1]};
                                               ^~~~~~~~~~~~~~~~
  creguserinfo.cpp:156:32: note: insert an explicit cast to silence this issue
                  unsigned char charsalt[2] = {((char*)&str)[0],((char*)&str)[1]};
                                               ^~~~~~~~~~~~~~~~
                                               static_cast<unsigned char>( )
  script_api.cpp:221:10: error: cannot initialize return object of type 'char *' with an rvalue of type 'bool'
                  return false;
                         ^~~~~
  script_api.cpp:226:46: error: cannot initialize return object of type 'char *' with an rvalue of type 'bool'
          if ((!usr) || (usr && !usr->mxConn)) return false;
                                                      ^~~~~
  
  Reported by:	pkg-fallout (blocks 9 ports)
  Approved by:	portmgr blanket

Added:
  head/net-p2p/verlihub/files/patch-c++11   (contents, props changed)

Added: head/net-p2p/verlihub/files/patch-c++11
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-p2p/verlihub/files/patch-c++11	Fri Jan 26 14:39:32 2018	(r459998)
@@ -0,0 +1,71 @@
+libc++ doesn't like "using namespace std" in C++11
+
+casyncconn.cpp:585:62: error: invalid operands to binary expression ('__bind<int &, sockaddr *, unsigned long>' and 'int')
+        if(bind(sock, (struct sockaddr *)&mAddrIN, sizeof(mAddrIN)) == -1)
+           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~
+
+Part of https://github.com/Verlihub/verlihub/commit/60609e646824
+
+creguserinfo.cpp:156:32: error: non-constant-expression cannot be narrowed from type 'char' to 'unsigned char' in initializer list [-Wc++11-narrowing]
+                unsigned char charsalt[2] = {((char*)&str)[0],((char*)&str)[1]};
+                                             ^~~~~~~~~~~~~~~~
+creguserinfo.cpp:156:32: note: insert an explicit cast to silence this issue
+                unsigned char charsalt[2] = {((char*)&str)[0],((char*)&str)[1]};
+                                             ^~~~~~~~~~~~~~~~
+                                             static_cast<unsigned char>( )
+creguserinfo.cpp:156:49: error: non-constant-expression cannot be narrowed from type 'char' to 'unsigned char' in initializer list [-Wc++11-narrowing]
+                unsigned char charsalt[2] = {((char*)&str)[0],((char*)&str)[1]};
+                                                              ^~~~~~~~~~~~~~~~
+creguserinfo.cpp:156:49: note: insert an explicit cast to silence this issue
+                unsigned char charsalt[2] = {((char*)&str)[0],((char*)&str)[1]};
+                                                              ^~~~~~~~~~~~~~~~
+                                                              static_cast<unsigned char>( )
+
+ParseCommand() returns bool since 1.0.0.0.
+
+script_api.cpp:221:10: error: cannot initialize return object of type 'char *' with an rvalue of type 'bool'
+                return false;
+                       ^~~~~
+script_api.cpp:226:46: error: cannot initialize return object of type 'char *' with an rvalue of type 'bool'
+        if ((!usr) || (usr && !usr->mxConn)) return false;
+                                                    ^~~~~
+
+--- src/casyncconn.cpp.orig	2009-07-10 18:23:05 UTC
++++ src/casyncconn.cpp
+@@ -575,7 +573,7 @@ int cAsyncConn::BindSocket(int sock, int port, const c
+ 
+ 
+ 	/* Bind socket to port */
+-	if(bind(sock, (struct sockaddr *)&mAddrIN, sizeof(mAddrIN)) == -1)
++	if(::bind(sock, (struct sockaddr *)&mAddrIN, sizeof(mAddrIN)) == -1)
+ 	{
+ 		return -1;
+ 	}
+--- src/creguserinfo.cpp.orig	2009-05-16 14:56:20 UTC
++++ src/creguserinfo.cpp
+@@ -153,7 +153,7 @@ void nDirectConnect::nTables::cRegUserInfo::SetPass(st
+ 		static const char *saltchars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmlopqrstuvwxyz0123456789./";
+ 		static const int saltcharsnum = strlen(saltchars);
+ 
+-		unsigned char charsalt[2] = {((char*)&str)[0],((char*)&str)[1]};
++		unsigned char charsalt[2] = {(unsigned char)((char*)&str)[0], (unsigned char)((char*)&str)[1]};
+ 
+ #if HAVE_LIBSSL && HAVE_OPENSSL_MD5_H
+ 		unsigned char buf[MD5_DIGEST_LENGTH+1];
+--- src/script_api.cpp.orig	2009-05-16 14:42:07 UTC
++++ src/script_api.cpp
+@@ -218,12 +218,12 @@ char * ParseCommand(char *command_line)
+ 	cServerDC *server = GetCurrentVerlihub();
+ 	if(!server) {
+ 		cerr << "Server verlihub is unfortunately not running or not found." << endl;
+-		return false;
++		return NULL;
+ 	}
+ 	cUser *usr = GetUser((char *) server->mC.hub_security.c_str());
+ 	printf("%p\n", usr);
+ 	printf("%p", usr->mxConn);
+-	if ((!usr) || (usr && !usr->mxConn)) return false;
++	if ((!usr) || (usr && !usr->mxConn)) return NULL;
+ 	cout << "here" << endl;
+ 	if (!server->mP.ParseForCommands(command_line, usr->mxConn)) {
+ 		// unknown command	



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201801261439.w0QEdXvq003587>