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:
Ryan C. Gordon
2024-04-28 00:39:29 -04:00
parent 9d2aa8d809
commit 6c8977caf0
300 changed files with 2053 additions and 2031 deletions

View File

@@ -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);
@@ -199,7 +199,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;
@@ -267,7 +267,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;
@@ -286,46 +286,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 0
char **Object_names = NULL;
const char **Object_names = NULL;
int *Object_handles = NULL;
#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 0
char **Path_names = NULL;
const char **Path_names = NULL;
int *Path_indexes = NULL;
#define NUM_MATCEN_NAMES 0
char **Matcen_names = NULL;
const char **Matcen_names = NULL;
int *Matcen_indexes = NULL;
#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()
@@ -399,7 +399,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()