Skip to content

Commit

Permalink
x64bit builds seem to be stable, but needs testing
Browse files Browse the repository at this point in the history
const pollution arrrgh
  • Loading branch information
BraXi committed Sep 14, 2024
1 parent 053644d commit f56f4fc
Show file tree
Hide file tree
Showing 22 changed files with 95 additions and 95 deletions.
2 changes: 1 addition & 1 deletion src/common/crc.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ void CRC_Init(unsigned short* crcvalue);
void CRC_ProcessByte(unsigned short* crcvalue, byte data);
unsigned short CRC_Value(unsigned short crcvalue);
unsigned short CRC_Block(byte* start, int count);
unsigned short CRC_ChecksumFile(char* name, qboolean fatal);
unsigned short CRC_ChecksumFile(const char* name, qboolean fatal);

#endif /*_PRAGMA_CRC_H_*/
18 changes: 9 additions & 9 deletions src/common/shared.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ char *COM_FileExtension (char *in)
COM_FileBase
============
*/
void COM_FileBase (char *in, char *out)
void COM_FileBase (const char *in, char *out)
{
char *s, *s2;

s = in + strlen(in) - 1;
s = (char*)(in + strlen(in) - 1);

while (s != in && *s != '.')
s--;
Expand All @@ -138,11 +138,11 @@ COM_FilePath
Returns the path up to, but not including the last /
============
*/
void COM_FilePath (char *in, char *out)
void COM_FilePath (const char *in, char *out)
{
char *s;

s = in + strlen(in) - 1;
s = (char*)(in + strlen(in) - 1);

while (s != in && *s != '/')
s--;
Expand Down Expand Up @@ -575,7 +575,7 @@ int Q_strcasecmp (const char *s1, const char *s2)



void Com_sprintf (char *dest, int size, char *fmt, ...)
void Com_sprintf (char *dest, int size, const char *fmt, ...)
{
int len;
va_list argptr;
Expand Down Expand Up @@ -605,7 +605,7 @@ Searches the string for the given
key and returns the associated value, or an empty string.
===============
*/
char *Info_ValueForKey (char *s, char *key)
const char *Info_ValueForKey (const char *s, const char *key)
{
char pkey[512];
static char value[2][512]; // use two buffers so compares
Expand Down Expand Up @@ -647,7 +647,7 @@ char *Info_ValueForKey (char *s, char *key)
}
}

void Info_RemoveKey (char *s, char *key)
void Info_RemoveKey (char *s, const char *key)
{
char *start;
char pkey[512];
Expand Down Expand Up @@ -705,7 +705,7 @@ Some characters are illegal in info strings because they
can mess up the server's parsing
==================
*/
qboolean Info_Validate (char *s)
qboolean Info_Validate (const char *s)
{
if (strstr (s, "\""))
return false;
Expand All @@ -714,7 +714,7 @@ qboolean Info_Validate (char *s)
return true;
}

void Info_SetValueForKey (char *s, char *key, char *value)
void Info_SetValueForKey (char *s, const char *key, const char *value)
{
char newi[MAX_INFO_STRING], *v;
int c;
Expand Down
18 changes: 9 additions & 9 deletions src/common/shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ extern char* GetTimeStamp(qboolean full);

char *COM_SkipPath (char *pathname);
void COM_StripExtension (char *in, char *out);
void COM_FileBase (char *in, char *out);
void COM_FilePath (char *in, char *out);
void COM_FileBase (const char *in, char *out);
void COM_FilePath (const char *in, char *out);
void COM_DefaultExtension (char *path, char *extension);

char *COM_Parse (char **data_p); // data is an in/out parm, returns a parsed out token
Expand All @@ -155,7 +155,7 @@ char* COM_TokenGetArg(int arg);
char* COM_TokenArgs();


void Com_sprintf (char *dest, int size, char *fmt, ...);
void Com_sprintf (char *dest, int size, const char *fmt, ...);

void Com_PageInMemory (byte *buffer, int size);

Expand Down Expand Up @@ -189,10 +189,10 @@ char *va(char *format, ...);
#define MAX_INFO_VALUE 64
#define MAX_INFO_STRING 512

char *Info_ValueForKey (char *s, char *key);
void Info_RemoveKey (char *s, char *key);
void Info_SetValueForKey (char *s, char *key, char *value);
qboolean Info_Validate (char *s);
const char *Info_ValueForKey (const char *s, const char *key);
void Info_RemoveKey (char *s, const char *key);
void Info_SetValueForKey (char *s, const char *key, const char *value);
qboolean Info_Validate (const char *s);

/*
==============================================================
Expand All @@ -205,7 +205,7 @@ SYSTEM SPECIFIC
extern int curtime; // time returned by last Sys_Milliseconds, FIXME: 64BIT

int Sys_Milliseconds (void);
void Sys_Mkdir (char *path);
void Sys_Mkdir (const char *path);

// large block stack allocation routines
void *Hunk_Begin (const int maxsize, const char *name);
Expand All @@ -223,7 +223,7 @@ int Hunk_End (void);
/*
** pass in an attribute mask of things you wish to REJECT
*/
char *Sys_FindFirst (char *path, unsigned musthave, unsigned canthave );
char *Sys_FindFirst (const char *path, unsigned musthave, unsigned canthave );
char *Sys_FindNext ( unsigned musthave, unsigned canthave );
void Sys_FindClose (void);

Expand Down
6 changes: 3 additions & 3 deletions src/common/shared_windows.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ int Sys_Milliseconds (void)
return curtime;
}

void Sys_Mkdir (char *path)
void Sys_Mkdir (const char *path)
{
_mkdir (path);
int ret = _mkdir (path);
}

//============================================
Expand Down Expand Up @@ -171,7 +171,7 @@ static qboolean CompareAttributes( unsigned found, unsigned musthave, unsigned c
return true;
}

char *Sys_FindFirst (char *path, unsigned musthave, unsigned canthave )
char *Sys_FindFirst (const char *path, unsigned musthave, unsigned canthave )
{
struct _finddata_t findinfo;

Expand Down
2 changes: 1 addition & 1 deletion src/engine/astar_navigation.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ Nav_DebugDrawNodes
extern void SV_AddDebugLine(vec3_t p1, vec3_t p2, vec3_t color, float thickness, float drawtime, qboolean depthtested);
extern void SV_AddDebugPoint(vec3_t pos, vec3_t color, float thickness, float drawtime, qboolean depthtested);
extern void SV_AddDebugBox(vec3_t pos, vec3_t p1, vec3_t p2, vec3_t color, float thickness, float drawtime, qboolean depthtested);
extern void SV_AddDebugString(vec3_t pos, vec3_t color, float fontSize, float drawtime, qboolean depthtested, char* text);
extern void SV_AddDebugString(vec3_t pos, vec3_t color, float fontSize, float drawtime, qboolean depthtested, const char* text);
#endif
static void Nav_DebugDrawNodes()
{
Expand Down
4 changes: 2 additions & 2 deletions src/engine/client/cgame/cg_builtins.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,13 @@ static void PFCG_trace(void)

if (trace.surface)
{
cg.script_globals->trace_surface_name = Scr_SetString(trace.surface->name);
cg.script_globals->trace_surface_name = Scr_SetTempString(trace.surface->name);
cg.script_globals->trace_surface_flags = trace.surface->flags;
cg.script_globals->trace_surface_value = trace.surface->value;
}
else
{
cg.script_globals->trace_surface_name = Scr_SetString("");
cg.script_globals->trace_surface_name = Scr_SetTempString("");
cg.script_globals->trace_surface_flags = 0;
cg.script_globals->trace_surface_value = 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/engine/client/ui/ui_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ void UI_Draw()

current_gui = ui.guis[i];

ui.script_globals->currentGuiName = Scr_SetString(current_gui->name);
ui.script_globals->currentGuiName = Scr_SetTempString(current_gui->name);

for (j = 0; j < current_gui->numItems; j++)
{
Expand Down
4 changes: 2 additions & 2 deletions src/engine/filesystem.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ void FS_CreatePath(const char *path)
{
char *ofs;

for (ofs = path+1 ; *ofs ; ofs++)
for (ofs = (char*)(path+1) ; *ofs ; ofs++)
{
if (*ofs == '/')
{ // create the directory
Expand Down Expand Up @@ -442,7 +442,7 @@ Loads the header and directory, adding the files at the beginning
of the list so they override previous pack files.
=================
*/
pack_t *FS_LoadPackFile (char *packfile)
pack_t *FS_LoadPackFile (const char *packfile)
{
dpackheader_t header;
int i;
Expand Down
2 changes: 1 addition & 1 deletion src/engine/pragma.c
Original file line number Diff line number Diff line change
Expand Up @@ -1125,7 +1125,7 @@ byte COM_BlockSequenceCRCByte (byte *base, int length, int sequence)
CRC_ChecksumFile
================
*/
unsigned short CRC_ChecksumFile(char* name, qboolean fatal)
unsigned short CRC_ChecksumFile(const char* name, qboolean fatal)
{
int length;
byte* buf;
Expand Down
10 changes: 5 additions & 5 deletions src/engine/script/qcvm_strings.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ Sets temporary string in script (the string will be overwritten later),
used for builtins that return strings such as vtos(), ftos(), argv() etc..
============
*/
int Scr_SetTempString(char* str)
int Scr_SetTempString(const char* str)
{
int strindex;

Expand All @@ -120,7 +120,7 @@ Scr_SetString
Sets persistant string in program
============
*/
int Scr_SetString(char* str)
int Scr_SetString(const char* str)
{
int strindex;

Expand Down Expand Up @@ -153,7 +153,7 @@ int Scr_SetString(char* str)
pr_stringTable[strindex] = str;

#ifdef _DEBUG
Com_Printf("New string '%s' (%i strings, strtable for %i)\n", str, str, pr_numStringsInTable, pr_stringTableSize);
Com_Printf("New string '%s' (%i strings, strtable for %i)\n", str, pr_numStringsInTable, pr_stringTableSize);
#endif
return -1 - strindex;
}
Expand Down Expand Up @@ -269,8 +269,8 @@ const char* Scr_VarString(int first)
for (i = first; i < Scr_NumArgs(); i++)
{
//strcat(str[varstring], Scr_GetParmString(i));
len = Q_strlcat(str, Scr_GetParmString(i), sizeof(str));
if (len >= sizeof(str))
len = Q_strlcat(str, Scr_GetParmString(i), sizeof(pr_tempStrings[0]));
if (len >= sizeof(pr_tempStrings[0]))
{
Com_Printf("%s: string truncated.\n", __FUNCTION__);
return str;
Expand Down
4 changes: 2 additions & 2 deletions src/engine/script/qcvm_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ Returns string to script
void Scr_ReturnString(char* str)
{
CheckScriptVM(__FUNCTION__);
G_INT(OFS_RETURN) = Scr_SetString(str);//(str - active_qcvm->pStrings);
G_INT(OFS_RETURN) = Scr_SetTempString(str); //Scr_SetString(str);
}

/*
Expand Down Expand Up @@ -307,7 +307,7 @@ void Scr_AddString(unsigned int parm, char* str)
{
int ofs = ScrInternal_GetParmOffset(parm);
CheckScriptVM(__FUNCTION__);
G_INT(ofs) = Scr_SetString(str);
G_INT(ofs) = Scr_SetTempString(str); //Scr_SetString(str);
}


Expand Down
10 changes: 5 additions & 5 deletions src/engine/script/scr_builtins_shared.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ float strlen(string)
*/
void PF_strlen(void)
{
char* str;
const char* str;
size_t len;

str = Scr_GetParmString(0);
Expand All @@ -420,7 +420,7 @@ string letter_b = strat(str,1); // letter_b == b
*/
void PF_strat(void)
{
char* str;
const char* str;
size_t len;
int at;

Expand Down Expand Up @@ -450,7 +450,7 @@ float strstr(string a,string b)
*/
void PF_strstr(void)
{
char* str1, *str2;
const char* str1, *str2;

str1 = Scr_GetParmString(0);
str2 = Scr_GetParmString(1);
Expand Down Expand Up @@ -489,7 +489,7 @@ logprint(true, self.name, " killed ", other.name, "\n" );
*/
void PF_logprint(void)
{
char *str;
const char *str;
qboolean timestamp;

timestamp = Scr_GetParmFloat(0) > 0 ? true : false;
Expand Down Expand Up @@ -523,7 +523,7 @@ float crc_checksum = crcfile("models/player.md3");
void PF_crcfile(void)
{
unsigned short checksum;
char* str;
const char* str;
str = Scr_GetParmString(0);

if (strlen(str) <= 0)
Expand Down
4 changes: 2 additions & 2 deletions src/engine/script/scriptvm.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ void Scr_DefineBuiltin(void (*function)(void), pb_t type, char* fname, char* qcs

scr_func_t Scr_FindFunctionIndex(const char* funcname);

int Scr_SetTempString(char* str);
int Scr_SetString(char* str);
int Scr_SetTempString(const char* str);
int Scr_SetString(const char* str);
const char* Scr_GetString(int num);
const char* Scr_VarString(int first);

Expand Down
2 changes: 1 addition & 1 deletion src/engine/server/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ void SV_UserinfoChanged (client_t *cl);

void Master_Heartbeat (void);

void SV_SetConfigString(int index, char *valueString);
void SV_SetConfigString(int index, const char *valueString);

//
// sv_init.c
Expand Down
Loading

0 comments on commit f56f4fc

Please sign in to comment.