int CopyLump_Allocate( bspHeader_t *header, int lump, void **dest, int size, int *allocationVariable )
{
- int length, offset;
-
/* get lump length and offset */
*allocationVariable = header->lumps[ lump ].length / size;
*dest = realloc(*dest, size * *allocationVariable);
/* setup */
+ AUTOEXPAND_BY_REALLOC(bspEntData, 0, allocatedBSPEntData, 1024);
buf = bspEntData;
end = buf;
*end = 0;
+
/* run through entity list */
for( i = 0; i < numBSPEntities && i < numEntities; i++ )
{
+ {
+ int sz = end - buf;
+ AUTOEXPAND_BY_REALLOC(bspEntData, sz + 65536, allocatedBSPEntData, 1024);
+ buf = bspEntData;
+ end = buf + sz;
+ }
+
/* get epair */
ep = entities[ i ].epairs;
if( ep == NULL )
end += 2;
/* check for overflow */
- if( end > buf + MAX_MAP_ENTSTRING )
+ if( end > buf + allocatedBSPEntData )
Error( "Entity text too long" );
}