Merge pull request #1132 from turol/const

Const correctness fixes in setup program
This commit is contained in:
Simon Howard 2019-01-23 11:28:25 -05:00 committed by GitHub
commit 4127fabfb3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 26 additions and 26 deletions

View file

@ -291,7 +291,7 @@ char *M_DirName(const char *path)
// allocated. // allocated.
const char *M_BaseName(const char *path) const char *M_BaseName(const char *path)
{ {
char *p; const char *p;
p = strrchr(path, DIR_SEPARATOR); p = strrchr(path, DIR_SEPARATOR);
if (p == NULL) if (p == NULL)

View file

@ -54,9 +54,9 @@ struct execute_context_s
// Returns the path to a temporary file of the given name, stored // Returns the path to a temporary file of the given name, stored
// inside the system temporary directory. // inside the system temporary directory.
static char *TempFile(char *s) static char *TempFile(const char *s)
{ {
char *tempdir; const char *tempdir;
#ifdef _WIN32 #ifdef _WIN32
// Check the TEMP environment variable to find the location. // Check the TEMP environment variable to find the location.
@ -130,7 +130,7 @@ execute_context_t *NewExecuteContext(void)
return result; return result;
} }
void AddCmdLineParameter(execute_context_t *context, char *s, ...) void AddCmdLineParameter(execute_context_t *context, const char *s, ...)
{ {
va_list args; va_list args;

View file

@ -28,7 +28,7 @@ typedef struct execute_context_s execute_context_t;
#define IWAD_CHEX (1 << 5) /* chex.wad */ #define IWAD_CHEX (1 << 5) /* chex.wad */
execute_context_t *NewExecuteContext(void); execute_context_t *NewExecuteContext(void);
void AddCmdLineParameter(execute_context_t *context, char *s, ...) PRINTF_ATTR(2, 3); void AddCmdLineParameter(execute_context_t *context, const char *s, ...) PRINTF_ATTR(2, 3);
void PassThroughArguments(execute_context_t *context); void PassThroughArguments(execute_context_t *context);
int ExecuteDoom(execute_context_t *context); int ExecuteDoom(execute_context_t *context);
int FindInstalledIWADs(void); int FindInstalledIWADs(void);

View file

@ -33,13 +33,13 @@
typedef struct typedef struct
{ {
char *name; // Config file name const char *name; // Config file name
int value; int value;
} joystick_config_t; } joystick_config_t;
typedef struct typedef struct
{ {
char *name; const char *name;
int axes, buttons, hats; int axes, buttons, hats;
const joystick_config_t *configs; const joystick_config_t *configs;
} known_joystick_t; } known_joystick_t;
@ -972,7 +972,7 @@ static void CalibrateJoystick(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(unused))
// GUI // GUI
// //
static void AddJoystickControl(TXT_UNCAST_ARG(table), char *label, int *var) static void AddJoystickControl(TXT_UNCAST_ARG(table), const char *label, int *var)
{ {
TXT_CAST_ARG(txt_table_t, table); TXT_CAST_ARG(txt_table_t, table);
txt_joystick_input_t *joy_input; txt_joystick_input_t *joy_input;

View file

@ -146,7 +146,7 @@ static void KeySetCallback(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(variable))
// Add a label and keyboard input to the specified table. // Add a label and keyboard input to the specified table.
static void AddKeyControl(TXT_UNCAST_ARG(table), char *name, int *var) static void AddKeyControl(TXT_UNCAST_ARG(table), const char *name, int *var)
{ {
TXT_CAST_ARG(txt_table_t, table); TXT_CAST_ARG(txt_table_t, table);
txt_key_input_t *key_input; txt_key_input_t *key_input;
@ -158,7 +158,7 @@ static void AddKeyControl(TXT_UNCAST_ARG(table), char *name, int *var)
TXT_SignalConnect(key_input, "set", KeySetCallback, var); TXT_SignalConnect(key_input, "set", KeySetCallback, var);
} }
static void AddSectionLabel(TXT_UNCAST_ARG(table), char *title, static void AddSectionLabel(TXT_UNCAST_ARG(table), const char *title,
boolean add_space) boolean add_space)
{ {
TXT_CAST_ARG(txt_table_t, table); TXT_CAST_ARG(txt_table_t, table);

View file

@ -181,7 +181,7 @@ static void LaunchDoom(void *unused1, void *unused2)
static txt_button_t *GetLaunchButton(void) static txt_button_t *GetLaunchButton(void)
{ {
char *label; const char *label;
switch (gamemission) switch (gamemission)
{ {

View file

@ -44,13 +44,13 @@ static const iwad_t **iwads;
typedef struct typedef struct
{ {
char *label; const char *label;
GameMission_t mission; GameMission_t mission;
int mask; int mask;
char *name; const char *name;
char *config_file; const char *config_file;
char *extra_config_file; const char *extra_config_file;
char *executable; const char *executable;
} mission_config_t; } mission_config_t;
// Default mission to fall back on, if no IWADs are found at all: // Default mission to fall back on, if no IWADs are found at all:
@ -106,7 +106,7 @@ static int screenblocks = 9;
static int detailLevel = 0; static int detailLevel = 0;
static char *savedir = NULL; static char *savedir = NULL;
static char *executable = NULL; static char *executable = NULL;
static char *game_title = "Doom"; static const char *game_title = "Doom";
static char *back_flat = "F_PAVE01"; static char *back_flat = "F_PAVE01";
static int comport = 0; static int comport = 0;
static char *nickname = NULL; static char *nickname = NULL;
@ -367,12 +367,12 @@ void SetupMission(GameSelectCallback callback)
} }
} }
char *GetExecutableName(void) const char *GetExecutableName(void)
{ {
return executable; return executable;
} }
char *GetGameTitle(void) const char *GetGameTitle(void)
{ {
return game_title; return game_title;
} }

View file

@ -23,8 +23,8 @@ extern GameMission_t gamemission;
void SetupMission(GameSelectCallback callback); void SetupMission(GameSelectCallback callback);
void InitBindings(void); void InitBindings(void);
char *GetExecutableName(void); const char *GetExecutableName(void);
char *GetGameTitle(void); const char *GetGameTitle(void);
const iwad_t **GetIwads(void); const iwad_t **GetIwads(void);
#endif /* #ifndef SETUP_MODE_H */ #endif /* #ifndef SETUP_MODE_H */

View file

@ -67,7 +67,7 @@ static void MouseSetCallback(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(variable))
} }
} }
static void AddMouseControl(TXT_UNCAST_ARG(table), char *label, int *var) static void AddMouseControl(TXT_UNCAST_ARG(table), const char *label, int *var)
{ {
TXT_CAST_ARG(txt_table_t, table); TXT_CAST_ARG(txt_table_t, table);
txt_mouse_input_t *mouse_input; txt_mouse_input_t *mouse_input;

View file

@ -705,7 +705,7 @@ static txt_dropdown_list_t *GameTypeDropdown(void)
// and the single player warp menu. The parameters specify // and the single player warp menu. The parameters specify
// the window title and whether to display multiplayer options. // the window title and whether to display multiplayer options.
static void StartGameMenu(char *window_title, int multiplayer) static void StartGameMenu(const char *window_title, int multiplayer)
{ {
txt_window_t *window; txt_window_t *window;
txt_widget_t *iwad_selector; txt_widget_t *iwad_selector;
@ -984,7 +984,7 @@ static void QueryWindowClosed(TXT_UNCAST_ARG(window), void *unused)
TXT_SetPeriodicCallback(NULL, NULL, 0); TXT_SetPeriodicCallback(NULL, NULL, 0);
} }
static void ServerQueryWindow(char *title) static void ServerQueryWindow(const char *title)
{ {
txt_table_t *results_table; txt_table_t *results_table;
@ -1067,7 +1067,7 @@ void JoinMultiGame(TXT_UNCAST_ARG(widget), void *user_data)
void SetChatMacroDefaults(void) void SetChatMacroDefaults(void)
{ {
int i; int i;
char *defaults[] = const char *const defaults[] =
{ {
HUSTR_CHATMACRO0, HUSTR_CHATMACRO0,
HUSTR_CHATMACRO1, HUSTR_CHATMACRO1,

View file

@ -32,7 +32,7 @@
#define JOYSTICK_AXIS_WIDTH 20 #define JOYSTICK_AXIS_WIDTH 20
static char *CalibrationLabel(txt_joystick_axis_t *joystick_axis) static const char *CalibrationLabel(txt_joystick_axis_t *joystick_axis)
{ {
switch (joystick_axis->config_stage) switch (joystick_axis->config_stage)
{ {