From 197cffb7f5ccb5d2d52f8206588a873b8ec01f0b Mon Sep 17 00:00:00 2001
From: James R <justsomejames2@gmail.com>
Date: Mon, 13 Apr 2020 23:31:26 -0700
Subject: [PATCH] Compiler errors: won't stop, can't stop

---
 src/d_clisrv.c  | 34 ++++++++++++----------------------
 src/hms123311.c | 11 ++++++-----
 src/mserv.c     | 10 ----------
 src/mserv.h     | 10 ++++++++++
 4 files changed, 28 insertions(+), 37 deletions(-)

diff --git a/src/d_clisrv.c b/src/d_clisrv.c
index 7164a4d5fe..8bb761d74e 100644
--- a/src/d_clisrv.c
+++ b/src/d_clisrv.c
@@ -1723,7 +1723,7 @@ static void CL_LoadReceivedSavegame(void)
 #endif
 
 #ifndef NONET
-static void SendAskInfo(INT32 node, boolean viams)
+static void SendAskInfo(INT32 node)
 {
 	const tic_t asktime = I_GetTime();
 	netbuffer->packettype = PT_ASKINFO;
@@ -1816,7 +1816,7 @@ void CL_UpdateServerList(boolean internetsearch, INT32 room)
 
 	// search for local servers
 	if (netgame)
-		SendAskInfo(BROADCASTADDR, false);
+		SendAskInfo(BROADCASTADDR);
 
 	if (internetsearch)
 	{
@@ -1844,7 +1844,6 @@ void CL_UpdateServerList(boolean internetsearch, INT32 room)
 					INT32 node = I_NetMakeNodewPort(server_list[i].ip, server_list[i].port);
 					if (node == -1)
 						break; // no more node free
-					SendAskInfo(node, true);
 					// Force close the connection so that servers can't eat
 					// up nodes forever if we never get a reply back from them
 					// (usually when they've not forwarded their ports).
@@ -1874,14 +1873,13 @@ void CL_UpdateServerList(boolean internetsearch, INT32 room)
 
 /** Called by CL_ServerConnectionTicker
   *
-  * \param viams ???
-  * \param asksent ???
+  * \param asksent The last time we asked the server to join. We re-ask every second in case our request got lost in transmit.
   * \return False if the connection was aborted
   * \sa CL_ServerConnectionTicker
   * \sa CL_ConnectToServer
   *
   */
-static boolean CL_ServerConnectionSearchTicker(boolean viams, tic_t *asksent)
+static boolean CL_ServerConnectionSearchTicker(tic_t *asksent)
 {
 #ifndef NONET
 	INT32 i;
@@ -1987,7 +1985,7 @@ static boolean CL_ServerConnectionSearchTicker(boolean viams, tic_t *asksent)
 	// Ask the info to the server (askinfo packet)
 	if (*asksent + NEWTICRATE < I_GetTime())
 	{
-		SendAskInfo(servernode, viams);
+		SendAskInfo(servernode);
 		*asksent = I_GetTime();
 	}
 #else
@@ -2002,7 +2000,6 @@ static boolean CL_ServerConnectionSearchTicker(boolean viams, tic_t *asksent)
 
 /** Called by CL_ConnectToServer
   *
-  * \param viams ???
   * \param tmpsave The name of the gamestate file???
   * \param oldtic Used for knowing when to poll events and redraw
   * \param asksent ???
@@ -2011,7 +2008,7 @@ static boolean CL_ServerConnectionSearchTicker(boolean viams, tic_t *asksent)
   * \sa CL_ConnectToServer
   *
   */
-static boolean CL_ServerConnectionTicker(boolean viams, const char *tmpsave, tic_t *oldtic, tic_t *asksent)
+static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic_t *asksent)
 {
 	boolean waitmore;
 	INT32 i;
@@ -2023,7 +2020,7 @@ static boolean CL_ServerConnectionTicker(boolean viams, const char *tmpsave, tic
 	switch (cl_mode)
 	{
 		case CL_SEARCHING:
-			if (!CL_ServerConnectionSearchTicker(viams, asksent))
+			if (!CL_ServerConnectionSearchTicker(asksent))
 				return false;
 			break;
 
@@ -2129,11 +2126,10 @@ static boolean CL_ServerConnectionTicker(boolean viams, const char *tmpsave, tic
 
 /** Use adaptive send using net_bandwidth and stat.sendbytes
   *
-  * \param viams ???
   * \todo Better description...
   *
   */
-static void CL_ConnectToServer(boolean viams)
+static void CL_ConnectToServer(void)
 {
 	INT32 pnumnodes, nodewaited = doomcom->numnodes, i;
 	tic_t oldtic;
@@ -2197,9 +2193,9 @@ static void CL_ConnectToServer(boolean viams)
 	{
 		// If the connection was aborted for some reason, leave
 #ifndef NONET
-		if (!CL_ServerConnectionTicker(viams, tmpsave, &oldtic, &asksent))
+		if (!CL_ServerConnectionTicker(tmpsave, &oldtic, &asksent))
 #else
-		if (!CL_ServerConnectionTicker(viams, (char*)NULL, &oldtic, (tic_t *)NULL))
+		if (!CL_ServerConnectionTicker((char*)NULL, &oldtic, (tic_t *)NULL))
 #endif
 			return;
 
@@ -2376,9 +2372,6 @@ static void Command_ReloadBan(void)  //recheck ban.txt
 
 static void Command_connect(void)
 {
-	// Assume we connect directly.
-	boolean viams = false;
-
 	if (COM_Argc() < 2 || *COM_Argv(1) == 0)
 	{
 		CONS_Printf(M_GetText(
@@ -2414,9 +2407,6 @@ static void Command_connect(void)
 		if (netgame && !stricmp(COM_Argv(1), "node"))
 		{
 			servernode = (SINT8)atoi(COM_Argv(2));
-
-			// Use MS to traverse NAT firewalls.
-			viams = true;
 		}
 		else if (netgame)
 		{
@@ -2453,7 +2443,7 @@ static void Command_connect(void)
 	SplitScreen_OnChange();
 	botingame = false;
 	botskin = 0;
-	CL_ConnectToServer(viams);
+	CL_ConnectToServer();
 }
 #endif
 
@@ -3513,7 +3503,7 @@ boolean SV_SpawnServer(void)
 
 		// non dedicated server just connect to itself
 		if (!dedicated)
-			CL_ConnectToServer(false);
+			CL_ConnectToServer();
 		else doomcom->numslots = 1;
 	}
 
diff --git a/src/hms123311.c b/src/hms123311.c
index 7025aff585..2be8205fbe 100644
--- a/src/hms123311.c
+++ b/src/hms123311.c
@@ -56,8 +56,9 @@ static size_t
 HMS_on_read (char *s, size_t _1, size_t n, void *userdata)
 {
 	struct HMS_buffer *buffer;
+	(void)_1;
 	buffer = userdata;
-	if (n < ( buffer->end - buffer->needle ))
+	if (n < (size_t)( buffer->end - buffer->needle ))
 	{
 		memcpy(&buffer->buffer[buffer->needle], s, n);
 		buffer->needle += n;
@@ -199,7 +200,7 @@ HMS_fetch_rooms (int joining)
 
 	char *id;
 	char *title;
-	char *motd;
+	char *room_motd;
 
 	int id_no;
 
@@ -220,9 +221,9 @@ HMS_fetch_rooms (int joining)
 
 			id    = strtok(p, "\n");
 			title = strtok(0, "\n");
-			motd  = strtok(0, "");
+			room_motd = strtok(0, "");
 
-			if (id && title && motd)
+			if (id && title && room_motd)
 			{
 				id_no = atoi(id);
 
@@ -236,7 +237,7 @@ HMS_fetch_rooms (int joining)
 
 					room_list[i].id = id_no;
 					strlcpy(room_list[i].name, title, sizeof room_list[i].name);
-					strlcpy(room_list[i].motd, motd, sizeof room_list[i].motd);
+					strlcpy(room_list[i].motd, room_motd, sizeof room_list[i].motd);
 
 					i++;
 				}
diff --git a/src/mserv.c b/src/mserv.c
index 20c2754305..92a6399f36 100644
--- a/src/mserv.c
+++ b/src/mserv.c
@@ -22,16 +22,6 @@
 #include "m_menu.h"
 #include "z_zone.h"
 
-/* HTTP */
-int  HMS_in_use (void);
-int  HMS_fetch_rooms (int joining);
-int  HMS_register (void);
-void HMS_unlist (void);
-int  HMS_update (void);
-void HMS_list_servers (void);
-int  HMS_fetch_servers (msg_server_t *list, int room);
-int  HMS_compare_mod_version (char *buffer, size_t size_of_buffer);
-
 static time_t MSLastPing;
 
 static inline void SendPingToMasterServer(void);
diff --git a/src/mserv.h b/src/mserv.h
index 564f71fe74..b59b7b2b6a 100644
--- a/src/mserv.h
+++ b/src/mserv.h
@@ -90,4 +90,14 @@ extern msg_rooms_t room_list[NUM_LIST_ROOMS+1];
 
 void AddMServCommands(void);
 
+/* HTTP */
+int  HMS_in_use (void);
+int  HMS_fetch_rooms (int joining);
+int  HMS_register (void);
+void HMS_unlist (void);
+int  HMS_update (void);
+void HMS_list_servers (void);
+msg_server_t * HMS_fetch_servers (msg_server_t *list, int room);
+int  HMS_compare_mod_version (char *buffer, size_t size_of_buffer);
+
 #endif
-- 
GitLab