mirror of
https://github.com/kevinbentley/Descent3.git
synced 2025-12-23 11:23:28 -05:00
Heavy patching for compiler warnings.
The vast majority of this is fixing up `char *` that should be `const char *` but a handful of other fixes, like potential buffer overflows that GCC noticed, etc, were applied as well. This removes `-Wno-write-strings` from CMakeLists.txt, as it is no longer necessary, as there is no longer a flood of compiler warning spam when building. This does not fix all compiler warnings; there are still a handful, and they are legitimate, but they can be dealt with in a future commit.
This commit is contained in:
@@ -37,7 +37,7 @@ extern "C" {
|
||||
#endif
|
||||
char STDCALL InitializeDLL(tOSIRISModuleInit *func_list);
|
||||
void STDCALL ShutdownDLL(void);
|
||||
int STDCALL GetGOScriptID(char *name, ubyte is_door);
|
||||
int STDCALL GetGOScriptID(const char *name, ubyte is_door);
|
||||
void STDCALLPTR CreateInstance(int id);
|
||||
void STDCALL DestroyInstance(int id, void *ptr);
|
||||
short STDCALL CallInstanceEvent(int id, void *ptr, int event, tOSIRISEventInfo *data);
|
||||
@@ -226,7 +226,7 @@ char *SkipInitialWhitespace(char *s) {
|
||||
}
|
||||
|
||||
// Read in the Messages
|
||||
int ReadMessageFile(char *filename) {
|
||||
int ReadMessageFile(const char *filename) {
|
||||
void *infile;
|
||||
char filebuffer[MAX_MSG_FILEBUF_LEN + 1];
|
||||
char *line, *msg_start;
|
||||
@@ -294,7 +294,7 @@ int ReadMessageFile(char *filename) {
|
||||
}
|
||||
|
||||
// Find a message
|
||||
char *GetMessage(char *name) {
|
||||
const char *GetMessage(const char *name) {
|
||||
// Make sure given name is valid
|
||||
if (name == NULL)
|
||||
return INV_MSGNAME_STRING;
|
||||
@@ -313,46 +313,46 @@ char *GetMessage(char *name) {
|
||||
//======================
|
||||
|
||||
#define NUM_DOOR_NAMES 0
|
||||
char **Door_names = NULL;
|
||||
const char **Door_names = NULL;
|
||||
int *Door_handles = NULL;
|
||||
|
||||
#define NUM_OBJECT_NAMES 1
|
||||
char *Object_names[NUM_OBJECT_NAMES] = {"Train1Position"};
|
||||
const char *Object_names[NUM_OBJECT_NAMES] = {"Train1Position"};
|
||||
int Object_handles[NUM_OBJECT_NAMES];
|
||||
|
||||
#define NUM_ROOM_NAMES 0
|
||||
char **Room_names = NULL;
|
||||
const char **Room_names = NULL;
|
||||
int *Room_indexes = NULL;
|
||||
|
||||
#define NUM_TRIGGER_NAMES 0
|
||||
char **Trigger_names = NULL;
|
||||
const char **Trigger_names = NULL;
|
||||
int *Trigger_indexes = NULL;
|
||||
int *Trigger_faces = NULL;
|
||||
int *Trigger_rooms = NULL;
|
||||
|
||||
#define NUM_SOUND_NAMES 0
|
||||
char **Sound_names = NULL;
|
||||
const char **Sound_names = NULL;
|
||||
int *Sound_indexes = NULL;
|
||||
|
||||
#define NUM_TEXTURE_NAMES 0
|
||||
char **Texture_names = NULL;
|
||||
const char **Texture_names = NULL;
|
||||
int *Texture_indexes = NULL;
|
||||
|
||||
#define NUM_PATH_NAMES 1
|
||||
char *Path_names[NUM_PATH_NAMES] = {"Train1"};
|
||||
const char *Path_names[NUM_PATH_NAMES] = {"Train1"};
|
||||
int Path_indexes[NUM_PATH_NAMES];
|
||||
|
||||
#define NUM_MATCEN_NAMES 1
|
||||
char *Matcen_names[NUM_MATCEN_NAMES] = {"Train 1"};
|
||||
const char *Matcen_names[NUM_MATCEN_NAMES] = {"Train 1"};
|
||||
int Matcen_indexes[NUM_MATCEN_NAMES];
|
||||
|
||||
#define NUM_GOAL_NAMES 0
|
||||
char **Goal_names = NULL;
|
||||
const char **Goal_names = NULL;
|
||||
int *Goal_indexes = NULL;
|
||||
|
||||
#define NUM_MESSAGE_NAMES 0
|
||||
char **Message_names = NULL;
|
||||
char **Message_strings = NULL;
|
||||
const char **Message_names = NULL;
|
||||
const char **Message_strings = NULL;
|
||||
|
||||
// ===============
|
||||
// InitializeDLL()
|
||||
@@ -370,7 +370,7 @@ char STDCALL InitializeDLL(tOSIRISModuleInit *func_list) {
|
||||
InitMessageList();
|
||||
|
||||
// Build the filename of the message file
|
||||
char filename[_MAX_PATH + 1];
|
||||
char filename[_MAX_PATH + 32];
|
||||
int lang_type;
|
||||
if (func_list->script_identifier != NULL) {
|
||||
_splitpath(func_list->script_identifier, NULL, NULL, filename, NULL);
|
||||
@@ -448,7 +448,7 @@ void STDCALL ShutdownDLL(void) { ClearMessageList(); }
|
||||
// ===============
|
||||
// GetGOScriptID()
|
||||
// ===============
|
||||
int STDCALL GetGOScriptID(char *name, ubyte isdoor) { return -1; }
|
||||
int STDCALL GetGOScriptID(const char *name, ubyte isdoor) { return -1; }
|
||||
|
||||
// ================
|
||||
// CreateInstance()
|
||||
|
||||
Reference in New Issue
Block a user