gdi.exe16: Use FIELD_OFFSET to calculate the size of structs with variable length array.

This commit is contained in:
Michael Stefaniuc 2012-11-02 15:13:55 +01:00 committed by Alexandre Julliard
parent e67deeb8a1
commit fb724cfd7b
2 changed files with 2 additions and 2 deletions

View File

@ -1982,7 +1982,7 @@ void WINAPI SetRectRgn16( HRGN16 hrgn, INT16 left, INT16 top, INT16 right, INT16
*/
void WINAPI PlayMetaFileRecord16( HDC16 hdc, HANDLETABLE16 *ht, METARECORD *mr, UINT16 handles )
{
HANDLETABLE *ht32 = HeapAlloc( GetProcessHeap(), 0, handles * sizeof(*ht32) );
HANDLETABLE *ht32 = HeapAlloc( GetProcessHeap(), 0, FIELD_OFFSET(HANDLETABLE, objectHandle[handles] ));
unsigned int i;
for (i = 0; i < handles; i++) ht32->objectHandle[i] = HGDIOBJ_32(ht->objectHandle[i]);

View File

@ -213,7 +213,7 @@ BOOL16 WINAPI EnumMetaFile16( HDC16 hdc16, HMETAFILE16 hmf,
/* create the handle table */
hHT = GlobalAlloc16(GMEM_MOVEABLE | GMEM_ZEROINIT,
sizeof(HANDLETABLE16) * mh->mtNoObjects);
FIELD_OFFSET(HANDLETABLE16, objectHandle[mh->mtNoObjects]));
spht = WOWGlobalLock16(hHT);
seg = hmf | 7;