Merge remote-tracking branch 'turol/const'

This commit is contained in:
Mike Swanson 2018-06-01 15:46:15 -07:00
commit dd283bcfdc
10 changed files with 47 additions and 47 deletions

View file

@ -504,7 +504,7 @@ static char *CheckDirectoryHasIWAD(const char *dir, const char *iwadname)
// Search a directory to try to find an IWAD
// Returns the location of the IWAD if found, otherwise NULL.
static char *SearchDirectoryForIWAD(char *dir, int mask, GameMission_t *mission)
static char *SearchDirectoryForIWAD(const char *dir, int mask, GameMission_t *mission)
{
char *filename;
size_t i;
@ -571,14 +571,14 @@ static GameMission_t IdentifyIWADByName(char *name, int mask)
// Add IWAD directories parsed from splitting a path string containing
// paths separated by PATH_SEPARATOR. 'suffix' is a string to concatenate
// to the end of the paths before adding them.
static void AddIWADPath(char *path, char *suffix)
static void AddIWADPath(const char *path, const char *suffix)
{
char *left, *p;
char *left, *p, *dup_path;
path = M_StringDuplicate(path);
dup_path = M_StringDuplicate(path);
// Split into individual dirs within the list.
left = path;
left = dup_path;
for (;;)
{
@ -600,7 +600,7 @@ static void AddIWADPath(char *path, char *suffix)
AddIWADDir(M_StringJoin(left, suffix, NULL));
free(path);
free(dup_path);
}
#ifndef _WIN32
@ -890,7 +890,7 @@ const iwad_t **D_FindAllIWADs(int mask)
// Get the IWAD name used for savegames.
//
char *D_SaveGameIWADName(GameMission_t gamemission)
const char *D_SaveGameIWADName(GameMission_t gamemission)
{
size_t i;

View file

@ -43,7 +43,7 @@ char *D_FindWADByName(const char *filename);
char *D_TryFindWADByName(char *filename);
char *D_FindIWAD(int mask, GameMission_t *mission);
const iwad_t **D_FindAllIWADs(int mask);
char *D_SaveGameIWADName(GameMission_t gamemission);
const char *D_SaveGameIWADName(GameMission_t gamemission);
char *D_SuggestIWADName(GameMission_t mission, GameMode_t mode);
char *D_SuggestGameName(GameMission_t mission, GameMode_t mode);
void D_CheckCorrectIWAD(GameMission_t mission);

View file

@ -823,7 +823,7 @@ static boolean StrictDemos(void)
// this extension (no extensions are allowed if -strictdemos is given
// on the command line). A warning is shown on the console using the
// provided string describing the non-vanilla expansion.
boolean D_NonVanillaRecord(boolean conditional, char *feature)
boolean D_NonVanillaRecord(boolean conditional, const char *feature)
{
if (!conditional || StrictDemos())
{
@ -861,7 +861,7 @@ static boolean IsDemoFile(int lumpnum)
// demo that comes from a .lmp file, not a .wad file.
// - Before proceeding, a warning is shown to the user on the console.
boolean D_NonVanillaPlayback(boolean conditional, int lumpnum,
char *feature)
const char *feature)
{
if (!conditional || StrictDemos())
{

View file

@ -78,11 +78,11 @@ extern boolean singletics;
extern int gametic, ticdup;
// Check if it is permitted to record a demo with a non-vanilla feature.
boolean D_NonVanillaRecord(boolean conditional, char *feature);
boolean D_NonVanillaRecord(boolean conditional, const char *feature);
// Check if it is permitted to play back a demo with a non-vanilla feature.
boolean D_NonVanillaPlayback(boolean conditional, int lumpnum,
char *feature);
const char *feature);
#endif

View file

@ -74,7 +74,7 @@ struct sfxinfo_struct
typedef struct
{
// up to 6-character name
char *name;
const char *name;
// lump number of music
int lumpnum;

View file

@ -55,7 +55,7 @@ static SDL_Renderer *renderer;
// Window title
static char *window_title = "";
static const char *window_title = "";
// These are (1) the 320x200x8 paletted buffer that we draw to (i.e. the one
// that holds I_VideoBuffer), (2) the 320x200x32 RGBA intermediate buffer that
@ -862,7 +862,7 @@ int I_GetPaletteIndex(int r, int g, int b)
// Set the window title
//
void I_SetWindowTitle(char *title)
void I_SetWindowTitle(const char *title)
{
window_title = title;
}

View file

@ -53,7 +53,7 @@ void I_ReadScreen (pixel_t* scr);
void I_BeginRead (void);
void I_SetWindowTitle(char *title);
void I_SetWindowTitle(const char *title);
void I_CheckIsScreensaver(void);
void I_SetGrabMouseCallback(grabmouse_callback_t func);

View file

@ -48,8 +48,8 @@ const char *configdir;
// Default filenames for configuration files.
static char *default_main_config;
static char *default_extra_config;
static const char *default_main_config;
static const char *default_extra_config;
typedef enum
{
@ -63,7 +63,7 @@ typedef enum
typedef struct
{
// Name of the variable
char *name;
const char *name;
// Pointer to the location in memory of the variable
union {
@ -95,7 +95,7 @@ typedef struct
{
default_t *defaults;
int numdefaults;
char *filename;
const char *filename;
} default_collection_t;
#define CONFIG_VARIABLE_GENERIC(name, type) \
@ -1660,7 +1660,7 @@ static default_collection_t extra_defaults =
// Search a collection for a variable
static default_t *SearchCollection(default_collection_t *collection, char *name)
static default_t *SearchCollection(default_collection_t *collection, const char *name)
{
int i;
@ -1811,7 +1811,7 @@ static void SaveDefaultCollection(default_collection_t *collection)
// Parses integer values in the configuration file
static int ParseIntParameter(char *strparm)
static int ParseIntParameter(const char *strparm)
{
int parm;
@ -1823,7 +1823,7 @@ static int ParseIntParameter(char *strparm)
return parm;
}
static void SetVariable(default_t *def, char *value)
static void SetVariable(default_t *def, const char *value)
{
int intparm;
@ -1929,7 +1929,7 @@ static void LoadDefaultCollection(default_collection_t *collection)
// Set the default filenames to use for configuration files.
void M_SetConfigFilenames(char *main_config, char *extra_config)
void M_SetConfigFilenames(const char *main_config, const char *extra_config)
{
default_main_config = main_config;
default_extra_config = extra_config;
@ -1949,10 +1949,10 @@ void M_SaveDefaults (void)
// Save defaults to alternate filenames
//
void M_SaveDefaultsAlternate(char *main, char *extra)
void M_SaveDefaultsAlternate(const char *main, const char *extra)
{
char *orig_main;
char *orig_extra;
const char *orig_main;
const char *orig_extra;
// Temporarily change the filenames
@ -2030,7 +2030,7 @@ void M_LoadDefaults (void)
// Get a configuration file variable by its name
static default_t *GetDefaultForName(char *name)
static default_t *GetDefaultForName(const char *name)
{
default_t *result;
@ -2057,7 +2057,7 @@ static default_t *GetDefaultForName(char *name)
// Bind a variable to a given configuration file variable, by name.
//
void M_BindIntVariable(char *name, int *location)
void M_BindIntVariable(const char *name, int *location)
{
default_t *variable;
@ -2070,7 +2070,7 @@ void M_BindIntVariable(char *name, int *location)
variable->bound = true;
}
void M_BindFloatVariable(char *name, float *location)
void M_BindFloatVariable(const char *name, float *location)
{
default_t *variable;
@ -2081,7 +2081,7 @@ void M_BindFloatVariable(char *name, float *location)
variable->bound = true;
}
void M_BindStringVariable(char *name, char **location)
void M_BindStringVariable(const char *name, char **location)
{
default_t *variable;
@ -2095,7 +2095,7 @@ void M_BindStringVariable(char *name, char **location)
// Set the value of a particular variable; an API function for other
// parts of the program to assign values to config variables by name.
boolean M_SetVariable(char *name, char *value)
boolean M_SetVariable(const char *name, const char *value)
{
default_t *variable;
@ -2113,7 +2113,7 @@ boolean M_SetVariable(char *name, char *value)
// Get the value of a variable.
int M_GetIntVariable(char *name)
int M_GetIntVariable(const char *name)
{
default_t *variable;
@ -2128,7 +2128,7 @@ int M_GetIntVariable(char *name)
return *variable->location.i;
}
const char *M_GetStringVariable(char *name)
const char *M_GetStringVariable(const char *name)
{
default_t *variable;
@ -2143,7 +2143,7 @@ const char *M_GetStringVariable(char *name)
return *variable->location.s;
}
float M_GetFloatVariable(char *name)
float M_GetFloatVariable(const char *name)
{
default_t *variable;
@ -2213,7 +2213,7 @@ void M_SetConfigDir(const char *dir)
// Creates the directory as necessary.
//
char *M_GetSaveGameDir(char *iwadname)
char *M_GetSaveGameDir(const char *iwadname)
{
char *savegamedir;
char *topdir;

View file

@ -24,17 +24,17 @@
void M_LoadDefaults(void);
void M_SaveDefaults(void);
void M_SaveDefaultsAlternate(char *main, char *extra);
void M_SaveDefaultsAlternate(const char *main, const char *extra);
void M_SetConfigDir(const char *dir);
void M_BindIntVariable(char *name, int *variable);
void M_BindFloatVariable(char *name, float *variable);
void M_BindStringVariable(char *name, char **variable);
boolean M_SetVariable(char *name, char *value);
int M_GetIntVariable(char *name);
const char *M_GetStringVariable(char *name);
float M_GetFloatVariable(char *name);
void M_SetConfigFilenames(char *main_config, char *extra_config);
char *M_GetSaveGameDir(char *iwadname);
void M_BindIntVariable(const char *name, int *variable);
void M_BindFloatVariable(const char *name, float *variable);
void M_BindStringVariable(const char *name, char **variable);
boolean M_SetVariable(const char *name, const char *value);
int M_GetIntVariable(const char *name);
const char *M_GetStringVariable(const char *name);
float M_GetFloatVariable(const char *name);
void M_SetConfigFilenames(const char *main_config, const char *extra_config);
char *M_GetSaveGameDir(const char *iwadname);
extern const char *configdir;

View file

@ -67,7 +67,7 @@ static int found_iwad_selected = -1;
// Filename to pass to '-iwad'.
static char *iwadfile;
static const char *iwadfile;
static const char *wad_extensions[] = { "wad", "lmp", "deh", NULL };