Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Jan 2018 15:16:48 +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: r460007 - head/games/xevil/files
Message-ID:  <201801261516.w0QFGmD3024096@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jbeich
Date: Fri Jan 26 15:16:48 2018
New Revision: 460007
URL: https://svnweb.freebsd.org/changeset/ports/460007

Log:
  games/xevil: unbreak build with Clang 6 (C++14 by default)
  
  libc++ doesn't like "using namespace std" in C++11
  
  role.cpp:656:62: error: invalid operands to binary expression ('__bind<int &, sockaddr *, unsigned long>' and 'int')
      if (bind(udpSock,(CMN_SOCKADDR *)&client,sizeof(client)) >= 0) {
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~
  role.cpp:1829:70: error: invalid operands to binary expression ('__bind<int &, sockaddr *, unsigned long>' and 'int')
    if (bind(tcpSock, (CMN_SOCKADDR *)&serverAddr, sizeof(serverAddr)) < 0) {
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~
  role.cpp:1836:70: error: invalid operands to binary expression ('__bind<int &, sockaddr *, unsigned long>' and 'int')
    if (bind(udpSock, (CMN_SOCKADDR *)&serverAddr, sizeof(serverAddr)) < 0) {
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~
  serverping.cpp:173:60: error: invalid operands to binary expression ('__bind<int &, sockaddr *, unsigned long>' and 'int')
    if (bind(udpSock,(CMN_SOCKADDR *)&client,sizeof(client)) < 0) {
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~
  
  Reported by:	pkg-fallout

Modified:
  head/games/xevil/files/patch-cmn__role.cpp   (contents, props changed)
  head/games/xevil/files/patch-x11__serverping.cpp   (contents, props changed)

Modified: head/games/xevil/files/patch-cmn__role.cpp
==============================================================================
--- head/games/xevil/files/patch-cmn__role.cpp	Fri Jan 26 15:16:30 2018	(r460006)
+++ head/games/xevil/files/patch-cmn__role.cpp	Fri Jan 26 15:16:48 2018	(r460007)
@@ -82,7 +82,14 @@
    // Probably would be better to use Role::message(), but we want it to stay
    // up for a long time.  Should add argument to Role::message().
  
-@@ -663,12 +659,10 @@
+@@ -657,18 +653,16 @@ void Client::connect_server() {  
+     client.sin_family = AF_INET;
+     client.sin_addr.s_addr = htonl(INADDR_ANY);
+     client.sin_port = htons((u_short)(clientPortBase + n));
+-    if (bind(udpSock,(CMN_SOCKADDR *)&client,sizeof(client)) >= 0) {
++    if (::bind(udpSock,(CMN_SOCKADDR *)&client,sizeof(client)) >= 0) {
+       // Success.
+       break;
      }
    }
    if (n == CLIENT_PORT_TRIES) {
@@ -247,11 +254,13 @@
    // Hack, using errLocator for more than reporting errors.
    errLocator->set_remember_deleted(True);
    errLocator->set_remember_sounds(True); 
-@@ -1843,19 +1827,17 @@
+@@ -1842,20 +1826,18 @@ void Server::run() {
+   serverAddr.sin_port = htons(port);
  
    // Give address to both the TCP and UDP sockets.
-   if (bind(tcpSock, (CMN_SOCKADDR *)&serverAddr, sizeof(serverAddr)) < 0) {
+-  if (bind(tcpSock, (CMN_SOCKADDR *)&serverAddr, sizeof(serverAddr)) < 0) {
 -    ostrstream str;
++  if (::bind(tcpSock, (CMN_SOCKADDR *)&serverAddr, sizeof(serverAddr)) < 0) {
 +    stringstream str;
      str << "Couldn't bind socket name to TCP socket on port " 
 -        << port << "."  << ends;
@@ -261,8 +270,9 @@
 +    error(str.str().c_str());
      return;
    }
-   if (bind(udpSock, (CMN_SOCKADDR *)&serverAddr, sizeof(serverAddr)) < 0) {
+-  if (bind(udpSock, (CMN_SOCKADDR *)&serverAddr, sizeof(serverAddr)) < 0) {
 -    ostrstream str;
++  if (::bind(udpSock, (CMN_SOCKADDR *)&serverAddr, sizeof(serverAddr)) < 0) {
 +    stringstream str;
      str << "Couldn't bind socket name to UDP socket on port " 
 -        << port << "."  << ends;

Modified: head/games/xevil/files/patch-x11__serverping.cpp
==============================================================================
--- head/games/xevil/files/patch-x11__serverping.cpp	Fri Jan 26 15:16:30 2018	(r460006)
+++ head/games/xevil/files/patch-x11__serverping.cpp	Fri Jan 26 15:16:48 2018	(r460007)
@@ -41,14 +41,16 @@
  
    // Create server address.
    memset((void *)&serverAddr,'\0',sizeof(serverAddr));
-@@ -171,10 +171,9 @@
+@@ -170,11 +170,10 @@ ServerPing::ServerPing(int argc,char** argv) {
+   client.sin_family = AF_INET;
    client.sin_addr.s_addr = htonl(INADDR_ANY);
    client.sin_port = htons((u_short)clientPort);
-   if (bind(udpSock,(CMN_SOCKADDR *)&client,sizeof(client)) < 0) {
+-  if (bind(udpSock,(CMN_SOCKADDR *)&client,sizeof(client)) < 0) {
 -    ostrstream str;
 -    str << "Could not bind local UDP port " << clientPort << ends;
 -    error(str.str());
 -    delete str.str();
++  if (::bind(udpSock,(CMN_SOCKADDR *)&client,sizeof(client)) < 0) {
 +    stringstream str;
 +    str << "Could not bind local UDP port " << clientPort;
 +    error(str.str().c_str());



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