krnl386.exe16: Use FIELD_OFFSET for the size of structs with varlength arrays.

This commit is contained in:
Michael Stefaniuc 2012-11-16 11:15:06 +01:00 committed by Alexandre Julliard
parent 0b02d25f6d
commit a5c621d40e
2 changed files with 2 additions and 2 deletions

View File

@ -163,7 +163,7 @@ WORD WINAPI InitAtomTable16( WORD entries )
/* Allocate the table */
if (!entries) entries = DEFAULT_ATOMTABLE_SIZE; /* sanity check */
handle = LocalAlloc16( LMEM_FIXED, sizeof(ATOMTABLE) + (entries-1) * sizeof(HANDLE16) );
handle = LocalAlloc16( LMEM_FIXED, FIELD_OFFSET( ATOMTABLE, entries[entries] ));
if (!handle) return 0;
table = MapSL( MAKESEGPTR( CURRENT_DS, handle ) );
table->size = entries;

View File

@ -200,7 +200,7 @@ static SEGPTR TASK_AllocThunk(void)
sel = pThunk->next;
if (!sel) /* Allocate a new segment */
{
sel = GLOBAL_Alloc( GMEM_FIXED, sizeof(THUNKS) + (MIN_THUNKS-1)*8,
sel = GLOBAL_Alloc( GMEM_FIXED, FIELD_OFFSET( THUNKS, thunks[MIN_THUNKS] ),
pTask->hPDB, WINE_LDT_FLAGS_CODE );
if (!sel) return 0;
TASK_CreateThunks( sel, 0, MIN_THUNKS );