Merge pull request #364 from tkoeppe/memsize

[tools/quake3/q3map2] Fix memset size bugs
This commit is contained in:
Timothee "TTimo" Besset 2016-08-20 16:03:57 -06:00 committed by GitHub
commit 28e9b8ec59
2 changed files with 4 additions and 4 deletions

View file

@ -113,7 +113,7 @@ void SetDrawSurfacesBuffer(){
bspDrawSurfaces = safe_malloc_info( sizeof( bspDrawSurface_t ) * numBSPDrawSurfacesBuffer, "IncDrawSurfaces" ); bspDrawSurfaces = safe_malloc_info( sizeof( bspDrawSurface_t ) * numBSPDrawSurfacesBuffer, "IncDrawSurfaces" );
memset( bspDrawSurfaces, 0, MAX_MAP_DRAW_SURFS * sizeof( bspDrawVert_t ) ); memset( bspDrawSurfaces, 0, MAX_MAP_DRAW_SURFS * sizeof( bspDrawSurface_t ) );
} }
void SetDrawSurfaces( int n ){ void SetDrawSurfaces( int n ){
@ -126,7 +126,7 @@ void SetDrawSurfaces( int n ){
bspDrawSurfaces = safe_malloc_info( sizeof( bspDrawSurface_t ) * numBSPDrawSurfacesBuffer, "IncDrawSurfaces" ); bspDrawSurfaces = safe_malloc_info( sizeof( bspDrawSurface_t ) * numBSPDrawSurfacesBuffer, "IncDrawSurfaces" );
memset( bspDrawSurfaces, 0, n * sizeof( bspDrawVert_t ) ); memset( bspDrawSurfaces, 0, n * sizeof( bspDrawSurface_t ) );
} }
void BSPFilesCleanup(){ void BSPFilesCleanup(){

View file

@ -1467,8 +1467,8 @@ static void MetaTrianglesToSurface( int numPossibles, metaTriangle_t *possibles,
ClearBounds( ds->mins, ds->maxs ); ClearBounds( ds->mins, ds->maxs );
/* clear verts/indexes */ /* clear verts/indexes */
memset( verts, 0, sizeof( verts ) ); memset( verts, 0, sizeof( *verts ) * maxSurfaceVerts );
memset( indexes, 0, sizeof( indexes ) ); memset( indexes, 0, sizeof( *indexes ) * maxSurfaceIndexes );
/* add the first triangle */ /* add the first triangle */
if ( AddMetaTriangleToSurface( ds, seed, qfalse ) ) { if ( AddMetaTriangleToSurface( ds, seed, qfalse ) ) {