Commit a5c621d4 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

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

parent 0b02d25f
...@@ -163,7 +163,7 @@ WORD WINAPI InitAtomTable16( WORD entries ) ...@@ -163,7 +163,7 @@ WORD WINAPI InitAtomTable16( WORD entries )
/* Allocate the table */ /* Allocate the table */
if (!entries) entries = DEFAULT_ATOMTABLE_SIZE; /* sanity check */ 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; if (!handle) return 0;
table = MapSL( MAKESEGPTR( CURRENT_DS, handle ) ); table = MapSL( MAKESEGPTR( CURRENT_DS, handle ) );
table->size = entries; table->size = entries;
......
...@@ -200,7 +200,7 @@ static SEGPTR TASK_AllocThunk(void) ...@@ -200,7 +200,7 @@ static SEGPTR TASK_AllocThunk(void)
sel = pThunk->next; sel = pThunk->next;
if (!sel) /* Allocate a new segment */ 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 ); pTask->hPDB, WINE_LDT_FLAGS_CODE );
if (!sel) return 0; if (!sel) return 0;
TASK_CreateThunks( sel, 0, MIN_THUNKS ); TASK_CreateThunks( sel, 0, MIN_THUNKS );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment