shithub: choc

Download patch

ref: 6a299e2f0245d2b33fc5558c99bbf8f764e6dfda
parent: 84fa6864cbee697f2529a4b86663259df1e8fb2a
parent: 4768d328835635f485f5fb0552b9d25a2ae3cefe
author: Turo Lamminen <turol@users.noreply.github.com>
date: Sat May 2 15:50:30 EDT 2020

Merge pull request #1278 from turol/const

Even more const correctness

--- a/src/d_iwad.c
+++ b/src/d_iwad.c
@@ -622,7 +622,7 @@
 
     if (env == NULL)
     {
-        char *homedir = getenv("HOME");
+        const char *homedir = getenv("HOME");
         if (homedir == NULL)
         {
             homedir = "/";
@@ -840,7 +840,7 @@
 char *D_FindIWAD(int mask, GameMission_t *mission)
 {
     char *result;
-    char *iwadfile;
+    const char *iwadfile;
     int iwadparm;
     int i;
 
--- a/src/doom/g_game.c
+++ b/src/doom/g_game.c
@@ -2024,7 +2024,7 @@
 //
 // G_RecordDemo
 //
-void G_RecordDemo (char *name)
+void G_RecordDemo (const char *name)
 {
     size_t demoname_size;
     int i;
--- a/src/doom/g_game.h
+++ b/src/doom/g_game.h
@@ -49,7 +49,7 @@
 void G_SaveGame (int slot, char* description);
 
 // Only called by startup code.
-void G_RecordDemo (char* name);
+void G_RecordDemo (const char* name);
 
 void G_BeginRecording (void);
 
--- a/src/heretic/deh_htic.c
+++ b/src/heretic/deh_htic.c
@@ -72,7 +72,7 @@
     NULL
 };
 
-static void SetHHEVersionByName(char *name)
+static void SetHHEVersionByName(const char *name)
 {
     int i;
 
--- a/src/heretic/doomdef.h
+++ b/src/heretic/doomdef.h
@@ -680,7 +680,7 @@
 extern char *savegamedir;
 
 void G_RecordDemo(skill_t skill, int numplayers, int episode, int map,
-                  char *name);
+                  const char *name);
 // only called by startup code
 
 void G_PlayDemo(char *name);
--- a/src/heretic/g_game.c
+++ b/src/heretic/g_game.c
@@ -1857,7 +1857,7 @@
 */
 
 void G_RecordDemo(skill_t skill, int numplayers, int episode, int map,
-                  char *name)
+                  const char *name)
 {
     int i;
     int maxsize;
--- a/src/hexen/g_game.c
+++ b/src/hexen/g_game.c
@@ -1950,7 +1950,7 @@
 */
 
 void G_RecordDemo(skill_t skill, int numplayers, int episode, int map,
-                  char *name)
+                  const char *name)
 {
     int i;
     int maxsize;
--- a/src/hexen/h2def.h
+++ b/src/hexen/h2def.h
@@ -775,7 +775,7 @@
 // called by M_Responder
 
 void G_RecordDemo(skill_t skill, int numplayers, int episode, int map,
-                  char *name);
+                  const char *name);
 // only called by startup code
 
 void G_PlayDemo(char *name);
--- a/src/i_musicpack.c
+++ b/src/i_musicpack.c
@@ -1008,7 +1008,7 @@
 // Dump an example config file containing checksums for all MIDI music
 // found in the WAD directory.
 
-static void DumpSubstituteConfig(char *filename)
+static void DumpSubstituteConfig(const char *filename)
 {
     sha1_context_t context;
     sha1_digest_t digest;
--- a/src/net_query.c
+++ b/src/net_query.c
@@ -808,7 +808,7 @@
     }
 }
 
-void NET_QueryAddress(char *addr_str)
+void NET_QueryAddress(const char *addr_str)
 {
     net_addr_t *addr;
     query_target_t *target;
--- a/src/net_query.h
+++ b/src/net_query.h
@@ -30,7 +30,7 @@
 
 extern void NET_LANQuery(void);
 extern void NET_MasterQuery(void);
-extern void NET_QueryAddress(char *addr);
+extern void NET_QueryAddress(const char *addr);
 extern net_addr_t *NET_FindLANServer(void);
 
 extern int NET_Query_Poll(net_query_callback_t callback, void *user_data);
--- a/src/setup/execute.c
+++ b/src/setup/execute.c
@@ -76,9 +76,9 @@
     return M_StringJoin(tempdir, DIR_SEPARATOR_S, s, NULL);
 }
 
-static int ArgumentNeedsEscape(char *arg)
+static int ArgumentNeedsEscape(const char *arg)
 {
-    char *p;
+    const char *p;
 
     for (p = arg; *p != '\0'; ++p)
     {
--- a/src/setup/mode.c
+++ b/src/setup/mode.c
@@ -224,7 +224,7 @@
     M_SetConfigFilenames(config->config_file, config->extra_config_file);
 }
 
-static mission_config_t *GetMissionForName(char *name)
+static mission_config_t *GetMissionForName(const char *name)
 {
     int i;
 
@@ -335,7 +335,7 @@
 void SetupMission(GameSelectCallback callback)
 {
     mission_config_t *config;
-    char *mission_name;
+    const char *mission_name;
     int p;
 
     //!
--- a/src/strife/d_main.c
+++ b/src/strife/d_main.c
@@ -860,7 +860,7 @@
         // filepath.
         if((p = M_CheckParm("-iwad")) && p < myargc - 1)
         {
-            char   *iwad     = myargv[p + 1];
+            const char *iwad = myargv[p + 1];
             size_t  len      = strlen(iwad) + 1;
             char   *iwadpath = Z_Malloc(len, PU_STATIC, NULL);
             char   *voiceswad;
--- a/src/strife/g_game.c
+++ b/src/strife/g_game.c
@@ -2187,7 +2187,7 @@
 // 
 // [STRIFE] Verified unmodified
 //
-void G_RecordDemo (char* name)
+void G_RecordDemo (const char* name)
 {
     size_t demoname_size;
     int             i;
--- a/src/strife/g_game.h
+++ b/src/strife/g_game.h
@@ -51,7 +51,7 @@
 void G_SaveGame (int slot, char* description);
 
 // Only called by startup code.
-void G_RecordDemo (char* name);
+void G_RecordDemo (const char* name);
 
 void G_BeginRecording (void);