[build] Fix a pile of gcc 10 issues

gcc got stricter about array accesses, complicating progs macros, and
much better at detecting buffer overflows.
This commit is contained in:
Bill Currie 2020-12-21 02:12:51 +09:00
parent af814ff9a8
commit ab04a1915e
30 changed files with 125 additions and 107 deletions

View file

@ -180,6 +180,8 @@ MarkLeakTrail2 (void)
vec3_t wc, pwc;
const vec_t *v;
VectorZero (wc);
leakfile = fopen (options.pointfile, "w");
if (!leakfile)
Sys_Error ("Couldn't open %s\n", options.pointfile);

View file

@ -101,8 +101,8 @@ extern pr_info_t pr;
#define D_DOUBLE(d) (*(double *) ((d)->space->data + (d)->offset))
#define D_FLOAT(d) D_var (float, d)
#define D_INT(d) D_var (integer, d)
#define D_VECTOR(d) D_var (vector, d)
#define D_QUAT(d) D_var (quat, d)
#define D_VECTOR(d) (&D_var (vector, d))
#define D_QUAT(d) (&D_var (quat, d))
#define D_STRING(d) D_var (string, d)
#define D_GETSTR(d) GETSTR (D_STRING (d))
#define D_FUNCTION(d) D_var (func, d)

View file

@ -34,7 +34,7 @@
///@{
float noise3d (vec3_t v, int num) __attribute__((pure));
float noiseXYZ (float x, float y, float z, int num) __attribute__((pure));
float noiseXYZ (float x, float y, float z, int num) __attribute__((const));
float noise_scaled (vec3_t v, float s, int num) __attribute__((pure));
float noise_perlin (vec3_t v, float p, int num) __attribute__((pure));
void snap_vector (vec3_t v_old, vec3_t v_new, float scale);

View file

@ -178,15 +178,17 @@ SetQdirFromPath (char *path)
static const char *
ExpandPath (const char *path)
{
static char full[1024];
static dstring_t *full;
//FIXME buffer overflow central
if (!full) {
full = dstring_new();
}
//if (!qdir)
// Sys_Error ("ExpandPath called without qdir set");
if (path[0] == '/' || path[0] == '\\' || path[1] == ':')
return path;
sprintf (full, "%s%s", qdir, path);
return full;
dsprintf (full, "%s%s", qdir, path);
return full->str;
}
static void