1
0
Fork 0
forked from fte/fteqw

Bullet forces C++, so ensure the qboolean variants, when that happens

This commit is contained in:
Fix 2023-05-29 11:17:44 +02:00
parent d76d142949
commit 9da0319c15

View file

@ -264,19 +264,31 @@ qboolean ZF_ReallocElements(void **ptr, size_t *elements, size_t newelements, si
//protect against malicious overflows //protect against malicious overflows
if (newelements > SIZE_MAX / elementsize) if (newelements > SIZE_MAX / elementsize)
#ifdef __cplusplus
return qfalse;
#else
return false; return false;
#endif
oldsize = *elements * elementsize; oldsize = *elements * elementsize;
newsize = newelements * elementsize; newsize = newelements * elementsize;
n = plugfuncs->Realloc(*ptr, newsize); n = plugfuncs->Realloc(*ptr, newsize);
if (!n) if (!n)
#ifdef __cplusplus
return qfalse;
#else
return false; return false;
#endif
if (newsize > oldsize) if (newsize > oldsize)
memset((char*)n+oldsize, 0, newsize - oldsize); memset((char*)n+oldsize, 0, newsize - oldsize);
*elements = newelements; *elements = newelements;
*ptr = n; *ptr = n;
#ifdef __cplusplus
return qtrue;
#else
return true; return true;
#endif
} }