diff options
author | Adam Weinberger <adamw@FreeBSD.org> | 2014-07-29 17:12:47 +0000 |
---|---|---|
committer | Adam Weinberger <adamw@FreeBSD.org> | 2014-07-29 17:12:47 +0000 |
commit | 08a006d08a4c35d2c3ecc9a3d10cf7fd14661a84 (patch) | |
tree | 0cfc4f0736babb895eb97a65c6defe632a0249c7 /games/xevil/files/patch-x11__serverping.cpp | |
parent | editors/fte: update to 20110708 (diff) |
Rename all patches that contain '::' as a path separator, and use
'__' instead.
Diffstat (limited to 'games/xevil/files/patch-x11__serverping.cpp')
-rw-r--r-- | games/xevil/files/patch-x11__serverping.cpp | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/games/xevil/files/patch-x11__serverping.cpp b/games/xevil/files/patch-x11__serverping.cpp new file mode 100644 index 000000000000..debc89bafc73 --- /dev/null +++ b/games/xevil/files/patch-x11__serverping.cpp @@ -0,0 +1,111 @@ +--- x11/serverping.cpp.orig 2012-05-27 06:52:29.000000000 +0900 ++++ x11/serverping.cpp 2012-05-27 07:12:12.000000000 +0900 +@@ -25,14 +25,15 @@ + // code and should be reasonably easy to compile on Windows. + + +-#include <iostream.h> +-#include <strstream.h> ++#include <iostream> ++#include <sstream> + #include "utils.h" + #include "streams.h" + #include "xetp_basic.h" + #include "neth.h" + #include "id.h" + ++using namespace std; + + + class ServerPing { +@@ -113,7 +114,7 @@ + + + char* sString = argv[argc - 1]; +- char* port = Utils::strchr(sString,':'); ++ const char* port = Utils::strchr(sString,':'); + // server:port + if (port) { + serverName = new char[port - sString + 1]; +@@ -140,10 +141,9 @@ + error("Error opening client UDP socket."); + } + +- ostrstream str; +- str << "Looking up IP address for server " << serverName << ends; +- message(str.str()); +- delete str.str(); ++ stringstream str; ++ str << "Looking up IP address for server " << serverName; ++ message(str.str().c_str()); + + // Create server address. + memset((void *)&serverAddr,'\0',sizeof(serverAddr)); +@@ -171,10 +171,9 @@ + client.sin_addr.s_addr = htonl(INADDR_ANY); + client.sin_port = htons((u_short)clientPort); + 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(); ++ stringstream str; ++ str << "Could not bind local UDP port " << clientPort; ++ error(str.str().c_str()); + return; + } + +@@ -197,11 +196,10 @@ + // Send "count" number of SERVER_PINGs. + for (int tries = 0; tries < count; tries++) { + // Send the ping. +- ostrstream msg; ++ stringstream msg; + msg << "Sending XETP::SERVER_PING to " +- << serverName << ':' << serverPort << ends; +- message(msg.str()); +- delete msg.str(); ++ << serverName << ':' << serverPort; ++ message(msg.str().c_str()); + XETPBasic::send_server_ping(udpOut); + // Don't buffer the ping. + udpOut->flush(); +@@ -248,11 +246,10 @@ + } + + // If we get here, we failed to reach the server. +- ostrstream msg; ++ stringstream msg; + msg << "No return from " << serverName << ':' << serverPort << " after " +- << count << " tries." << ends; +- error(msg.str()); +- delete msg.str(); ++ << count << " tries."; ++ error(msg.str().c_str()); + } + + +@@ -271,12 +268,9 @@ + + + void ServerPing::error(const char* msg1,const char* msg2) { +- ostrstream str; +- str << msg1 << msg2 << ends; +- error(str.str()); +- +- // Will never get here, but WTF. +- delete str.str(); ++ stringstream str; ++ str << msg1 << msg2; ++ error(str.str().c_str()); + } + + +@@ -355,6 +349,7 @@ + + + ++int + main(int argc,char** argv) { + ServerPing ping(argc,argv); + ping.go(); |