mirror of
https://github.com/FWGS/xash3d-fwgs
synced 2024-11-21 17:37:32 +01:00
filesystem: fix zip_t and pack_t definition so it have true standard flexible array member
This commit is contained in:
parent
bd2a44dbdd
commit
d2d6ed8bd4
@ -69,7 +69,7 @@ struct pack_s
|
||||
{
|
||||
file_t *handle;
|
||||
int numfiles;
|
||||
dpackfile_t files[1]; // flexible
|
||||
dpackfile_t files[]; // flexible
|
||||
};
|
||||
|
||||
/*
|
||||
@ -150,7 +150,7 @@ static pack_t *FS_LoadPackPAK( const char *packfile, int *error )
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pack = (pack_t *)Mem_Calloc( fs_mempool, sizeof( pack_t ) + sizeof( dpackfile_t ) * ( numpackfiles - 1 ));
|
||||
pack = (pack_t *)Mem_Calloc( fs_mempool, sizeof( pack_t ) + sizeof( dpackfile_t ) * numpackfiles );
|
||||
FS_Seek( packhandle, header.dirofs, SEEK_SET );
|
||||
|
||||
if( header.dirlen != FS_Read( packhandle, (void *)pack->files, header.dirlen ))
|
||||
|
@ -125,7 +125,7 @@ struct zip_s
|
||||
{
|
||||
file_t *handle;
|
||||
int numfiles;
|
||||
zipfile_t files[1]; // flexible
|
||||
zipfile_t files[]; // flexible
|
||||
};
|
||||
|
||||
// #define ENABLE_CRC_CHECK // known to be buggy because of possible libpublic crc32 bug, disabled
|
||||
@ -285,7 +285,7 @@ static zip_t *FS_LoadZip( const char *zipfile, int *error )
|
||||
FS_Seek( zip->handle, header_eocd.central_directory_offset, SEEK_SET );
|
||||
|
||||
// Calc count of files in archive
|
||||
zip = (zip_t *)Mem_Realloc( fs_mempool, zip, sizeof( *zip ) + sizeof( *info ) * ( header_eocd.total_central_directory_record - 1 ));
|
||||
zip = (zip_t *)Mem_Realloc( fs_mempool, zip, sizeof( *zip ) + sizeof( *info ) * header_eocd.total_central_directory_record );
|
||||
info = zip->files;
|
||||
|
||||
for( i = 0; i < header_eocd.total_central_directory_record; i++ )
|
||||
|
Loading…
Reference in New Issue
Block a user