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

@@ -31,7 +31,7 @@ extern "C" {
#endif
char STDCALL InitializeDLL(tOSIRISModuleInit *func_list);
void STDCALL ShutdownDLL(void);
int STDCALL GetGOScriptID(char *name, ubyte isdoor);
int STDCALL GetGOScriptID(const char *name, ubyte isdoor);
void STDCALLPTR CreateInstance(int id);
void STDCALL DestroyInstance(int id, void *ptr);
short STDCALL CallInstanceEvent(int id, void *ptr, int event, tOSIRISEventInfo *data);
@@ -48,7 +48,7 @@ int STDCALL SaveRestoreState(void *file_ptr, ubyte saving_state);
#define MAX_IDS 0x02 // maximum number of IDs
typedef struct {
int id;
char *name;
const char *name;
} tScriptInfo;
tScriptInfo ScriptInfo[MAX_IDS] = {{ID_SHIELD_ORB, "Shield"}, {ID_ENERGY_ORB, "Energy"}};
@@ -94,7 +94,7 @@ char STDCALL InitializeDLL(tOSIRISModuleInit *func_list) {
void STDCALL ShutdownDLL(void) {}
int STDCALL GetGOScriptID(char *name, ubyte isdoor) {
int STDCALL GetGOScriptID(const char *name, ubyte isdoor) {
for (int i = 0; i < MAX_IDS; i++) {
if (!stricmp(name, ScriptInfo[i].name)) {
return ScriptInfo[i].id;