shithub: choc

Download patch

ref: 1332c5aaa2d389b899cd3093e2aee93839f8db33
parent: bdb14111e00c37da25fbbb863d4b93088bf88469
parent: f186ecd1ae72f3a76336cc6be983ea1d549b8e6b
author: Simon Howard <fraggle+github@gmail.com>
date: Tue Mar 27 13:51:20 EDT 2018

Merge pull request #1006 from turol/const

More const correctness fixes

--- a/src/setup/multiplayer.c
+++ b/src/setup/multiplayer.c
@@ -59,7 +59,7 @@
 // Array of IWADs found to be installed
 
 static const iwad_t **found_iwads;
-static char **iwad_labels;
+static const char **iwad_labels;
 
 // Index of the currently selected IWAD
 
@@ -71,49 +71,49 @@
 
 static const char *wad_extensions[] = { "wad", "lmp", "deh", NULL };
 
-static char *doom_skills[] =
+static const char *doom_skills[] =
 {
     "I'm too young to die.", "Hey, not too rough.", "Hurt me plenty.",
     "Ultra-Violence.", "NIGHTMARE!",
 };
 
-static char *chex_skills[] =
+static const char *chex_skills[] =
 {
     "Easy does it", "Not so sticky", "Gobs of goo", "Extreme ooze",
     "SUPER SLIMEY!"
 };
 
-static char *heretic_skills[] =
+static const char *heretic_skills[] =
 {
     "Thou needeth a wet-nurse", "Yellowbellies-R-us", "Bringest them oneth",
     "Thou art a smite-meister", "Black plague possesses thee"
 };
 
-static char *hexen_fighter_skills[] =
+static const char *hexen_fighter_skills[] =
 {
     "Squire", "Knight", "Warrior", "Berserker", "Titan"
 };
 
-static char *hexen_cleric_skills[] =
+static const char *hexen_cleric_skills[] =
 {
     "Altar boy", "Acolyte", "Priest", "Cardinal", "Pope"
 };
 
-static char *hexen_mage_skills[] =
+static const char *hexen_mage_skills[] =
 {
     "Apprentice", "Enchanter", "Sorceror", "Warlock", "Archimage"
 };
 
-static char *strife_skills[] =
+static const char *strife_skills[] =
 {
     "Training", "Rookie", "Veteran", "Elite", "Bloodbath"
 };
 
-static char *character_classes[] = { "Fighter", "Cleric", "Mage" };
+static const char *character_classes[] = { "Fighter", "Cleric", "Mage" };
 
-static char *gamemodes[] = { "Co-operative", "Deathmatch", "Deathmatch 2.0" };
+static const char *gamemodes[] = { "Co-operative", "Deathmatch", "Deathmatch 2.0" };
 
-static char *strife_gamemodes[] =
+static const char *strife_gamemodes[] =
 {
     "Normal deathmatch",
     "Items respawn", // (altdeath)
--- a/src/setup/sound.c
+++ b/src/setup/sound.c
@@ -34,7 +34,7 @@
     NUM_OPLMODES,
 } oplmode_t;
 
-static char *opltype_strings[] =
+static const char *opltype_strings[] =
 {
     "OPL2",
     "OPL3"
--- a/textscreen/examples/calculator.c
+++ b/textscreen/examples/calculator.c
@@ -81,7 +81,7 @@
     starting_input = 1;
 }
 
-void AddOperatorButton(txt_table_t *table, char *label, operator_t op)
+void AddOperatorButton(txt_table_t *table, const char *label, operator_t op)
 {
     char buf[10];
     operator_t *op_copy;
--- a/textscreen/examples/guitest.c
+++ b/textscreen/examples/guitest.c
@@ -34,7 +34,7 @@
 // also put some crazy extensions to test the escape function. a"b"c"""dd
 const char *extensions[] = { "wad", "lmp", "txt", "a\"b\"c\"\"\"dd", "",
      "\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"", NULL };
-char *radio_values[] = { "Badger", "Mushroom", "Snake" };
+const char *radio_values[] = { "Badger", "Mushroom", "Snake" };
 char *textbox_value = NULL;
 int numbox_value = 0;
 int radiobutton_value;
@@ -88,7 +88,7 @@
 
 void UnicodeWindow(TXT_UNCAST_ARG(widget), void *user_data)
 {
-    static char *strings[] = {
+    static const char *strings[] = {
         "lunedì", "martedì", "mercoledì", "giovedì",
         "venerdì", "sabato", "domenica",
     };
--- a/textscreen/txt_dropdown.c
+++ b/textscreen/txt_dropdown.c
@@ -288,7 +288,7 @@
     NULL,
 };
 
-txt_dropdown_list_t *TXT_NewDropdownList(int *variable, char **values, 
+txt_dropdown_list_t *TXT_NewDropdownList(int *variable, const char **values,
                                          int num_values)
 {
     txt_dropdown_list_t *list;
--- a/textscreen/txt_dropdown.h
+++ b/textscreen/txt_dropdown.h
@@ -43,7 +43,7 @@
 {
     txt_widget_t widget;
     int *variable;
-    char **values;
+    const char **values;
     int num_values;
 };
 
@@ -62,7 +62,7 @@
  */
 
 txt_dropdown_list_t *TXT_NewDropdownList(int *variable, 
-                                         char **values, int num_values);
+                                         const char **values, int num_values);
 
 #endif /* #ifndef TXT_DROPDOWN_H */
 
--- a/textscreen/txt_fileselect.c
+++ b/textscreen/txt_fileselect.c
@@ -32,7 +32,7 @@
     txt_widget_t widget;
     txt_inputbox_t *inputbox;
     int size;
-    char *prompt;
+    const char *prompt;
     const char **extensions;
 };
 
@@ -808,7 +808,7 @@
 }
 
 txt_fileselect_t *TXT_NewFileSelector(char **variable, int size,
-                                      char *prompt, const char **extensions)
+                                      const char *prompt, const char **extensions)
 {
     txt_fileselect_t *fileselect;
 
--- a/textscreen/txt_fileselect.h
+++ b/textscreen/txt_fileselect.h
@@ -66,7 +66,7 @@
  */
 
 txt_fileselect_t *TXT_NewFileSelector(char **variable, int size,
-                                      char *prompt, const char **extensions);
+                                      const char *prompt, const char **extensions);
 
 /**
  * Special value to use for 'extensions' that selects a directory