From dbc761fbbf1e3e4821383ab1b18e50a8df5f8649 Mon Sep 17 00:00:00 2001 From: havoc Date: Sun, 8 Nov 2015 19:33:00 +0000 Subject: [PATCH] Fix several warnings with gcc-5 and an error with mingw (where HAVE_CLOCKGETTIME was somehow being defined) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12230 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::merge=641d75aeb3b3934d9bbe1e2603bdd05d14a15ff1 --- prvm_cmds.c | 2 +- prvm_cmds.h | 2 +- prvm_edict.c | 4 ++++ sys_shared.c | 3 +-- vid_sdl.c | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/prvm_cmds.c b/prvm_cmds.c index ba832b81..e1b248dd 100644 --- a/prvm_cmds.c +++ b/prvm_cmds.c @@ -4639,7 +4639,7 @@ static int BufStr_SortStringsDOWN (const void *in1, const void *in2) return strncmp(b, a, stringbuffers_sortlength); } -prvm_stringbuffer_t *BufStr_FindCreateReplace (prvm_prog_t *prog, int bufindex, int flags, char *format) +prvm_stringbuffer_t *BufStr_FindCreateReplace (prvm_prog_t *prog, int bufindex, int flags, const char *format) { prvm_stringbuffer_t *stringbuffer; int i; diff --git a/prvm_cmds.h b/prvm_cmds.h index 708a3621..01209758 100644 --- a/prvm_cmds.h +++ b/prvm_cmds.h @@ -220,7 +220,7 @@ void PR_Cmd_Init(void); // general functions void VM_CheckEmptyString (prvm_prog_t *prog, const char *s); void VM_VarString(prvm_prog_t *prog, int first, char *out, int outlength); -prvm_stringbuffer_t *BufStr_FindCreateReplace (prvm_prog_t *prog, int bufindex, int flags, char *format); +prvm_stringbuffer_t *BufStr_FindCreateReplace (prvm_prog_t *prog, int bufindex, int flags, const char *format); void BufStr_Set(prvm_prog_t *prog, prvm_stringbuffer_t *stringbuffer, int strindex, const char *str); void BufStr_Del(prvm_prog_t *prog, prvm_stringbuffer_t *stringbuffer); void BufStr_Flush(prvm_prog_t *prog); diff --git a/prvm_edict.c b/prvm_edict.c index bc6c5ad5..a002fd43 100644 --- a/prvm_edict.c +++ b/prvm_edict.c @@ -3105,7 +3105,11 @@ int PRVM_AllocString(prvm_prog_t *prog, size_t bufferlength, char **pointer) { int i; if (!bufferlength) + { + if (pointer) + *pointer = NULL; return 0; + } for (i = prog->firstfreeknownstring;i < prog->numknownstrings;i++) if (!prog->knownstrings[i]) break; diff --git a/sys_shared.c b/sys_shared.c index 03c05985..c32e9d23 100644 --- a/sys_shared.c +++ b/sys_shared.c @@ -238,11 +238,10 @@ void* Sys_GetProcAddress (dllhandle_t handle, const char* name) # define HAVE_Sleep 1 #endif +#ifndef WIN32 #if defined(CLOCK_MONOTONIC) || defined(CLOCK_HIRES) # define HAVE_CLOCKGETTIME 1 #endif - -#ifndef WIN32 // FIXME improve this check, manpage hints to DST_NONE # define HAVE_GETTIMEOFDAY 1 #endif diff --git a/vid_sdl.c b/vid_sdl.c index a6edf127..a1bef3b3 100644 --- a/vid_sdl.c +++ b/vid_sdl.c @@ -2453,7 +2453,7 @@ static void AdjustWindowBounds(viddef_mode_t *mode, RECT *rect) else { rect->left = workArea.left + max(0, (workWidth - width) / 2); - rect->top = workArea.top + (0, (workHeight - height) / 2); + rect->top = workArea.top + ((workHeight - height) / 2); } } #endif -- 2.39.2