mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-19 07:20:50 +00:00
Clear the padding in the light data buffers.
Getting uninitialized memory in calloced space was interesting :P
This commit is contained in:
parent
7c1d9d2b84
commit
d2909cd4dd
1 changed files with 6 additions and 0 deletions
|
@ -84,16 +84,22 @@ float minlights[MAX_MAP_FACES];
|
|||
int
|
||||
GetFileSpace (int size)
|
||||
{
|
||||
int oldsize;
|
||||
int ofs;
|
||||
|
||||
LOCK;
|
||||
oldsize = lightdata->size;
|
||||
lightdata->size = (lightdata->size + 3) & ~3;
|
||||
ofs = lightdata->size;
|
||||
lightdata->size += size;
|
||||
dstring_adjust (lightdata);
|
||||
memset (lightdata->str + oldsize, 0, ofs - oldsize);
|
||||
memset (lightdata->str + ofs, 0, size);
|
||||
|
||||
rgblightdata->size = (ofs + size) * 3;
|
||||
dstring_adjust (rgblightdata);
|
||||
memset (rgblightdata->str + oldsize * 3, 0, (ofs - oldsize) * 3);
|
||||
memset (rgblightdata->str + ofs * 3, 0, size * 3);
|
||||
UNLOCK;
|
||||
return ofs;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue