shithub: choc

Download patch

ref: 7d238f61488d550b5bfbe5075b923723bb5d0cfb
parent: 48e96443151db631e1153d459e850c49a96ccb29
author: Simon Howard <[email protected]>
date: Fri Apr 18 23:39:55 EDT 2014

setup: Make iwad_t pointers const.

The table of IWAD data is stored in const memory, so make all iwad_t
pointers const to fix compiler warnings.

--- a/src/setup/mode.c
+++ b/src/setup/mode.c
@@ -47,7 +47,7 @@
 #include "mode.h"
 
 GameMission_t gamemission;
-static iwad_t **iwads;
+static const iwad_t **iwads;
 
 typedef struct
 {
@@ -280,7 +280,7 @@
 {
     mission_config_t *mission = NULL;
     txt_window_t *window;
-    iwad_t **iwads;
+    const iwad_t **iwads;
     int num_games;
     int i;
 
@@ -380,7 +380,7 @@
     return game_title;
 }
 
-iwad_t **GetIwads(void)
+const iwad_t **GetIwads(void)
 {
     return iwads;
 }
--- a/src/setup/mode.h
+++ b/src/setup/mode.h
@@ -32,7 +32,7 @@
 void InitBindings(void);
 char *GetExecutableName(void);
 char *GetGameTitle(void);
-iwad_t **GetIwads(void);
+const iwad_t **GetIwads(void);
 
 #endif /* #ifndef SETUP_MODE_H */
 
--- a/src/setup/multiplayer.c
+++ b/src/setup/multiplayer.c
@@ -52,7 +52,7 @@
 
 // Fallback IWADs to use if no IWADs are detected.
 
-static iwad_t fallback_iwads[] = {
+static const iwad_t fallback_iwads[] = {
     { "doom.wad",     doom,     registered,  "Doom" },
     { "heretic.wad",  heretic,  retail,      "Heretic" },
     { "hexen.wad",    hexen,    commercial,  "Hexen" },
@@ -61,7 +61,7 @@
 
 // Array of IWADs found to be installed
 
-static iwad_t **found_iwads;
+static const iwad_t **found_iwads;
 static char *iwad_labels[8];
 
 // Index of the currently selected IWAD
@@ -153,7 +153,7 @@
 
 // Find an IWAD from its description
 
-static iwad_t *GetCurrentIWAD(void)
+static const iwad_t *GetCurrentIWAD(void)
 {
     return found_iwads[found_iwad_selected];
 }
@@ -160,7 +160,7 @@
 
 // Is the currently selected IWAD the Chex Quest chex.wad?
 
-static boolean IsChexQuest(iwad_t *iwad)
+static boolean IsChexQuest(const iwad_t *iwad)
 {
     return !strcmp(iwad->name, "chex.wad");
 }
@@ -320,7 +320,7 @@
 
 static void UpdateSkillButton(void)
 {
-    iwad_t *iwad = GetCurrentIWAD();
+    const iwad_t *iwad = GetCurrentIWAD();
 
     if (IsChexQuest(iwad))
     {
@@ -393,7 +393,7 @@
     txt_window_t *window;
     txt_table_t *table;
     txt_button_t *button;
-    iwad_t *iwad;
+    const iwad_t *iwad;
     char buf[10];
     int episodes;
     int x, y;
@@ -477,7 +477,7 @@
 
 static void IWADSelected(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(unused))
 {
-    iwad_t *iwad;
+    const iwad_t *iwad;
 
     // Find the iwad_t selected
 
@@ -493,7 +493,7 @@
 static void UpdateWarpType(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(unused))
 {
     warptype_t new_warptype;
-    iwad_t *iwad;
+    const iwad_t *iwad;
 
     // Get the selected IWAD
 
@@ -527,9 +527,9 @@
 // Get an IWAD list with a default fallback IWAD that is appropriate
 // for the game we are configuring (matches gamemission global variable).
 
-static iwad_t **GetFallbackIwadList(void)
+static const iwad_t **GetFallbackIwadList(void)
 {
-    static iwad_t *fallback_iwad_list[2];
+    static const iwad_t *fallback_iwad_list[2];
     unsigned int i;
 
     // Default to use if we don't find something better.