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

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

parent e67deeb8
...@@ -1982,7 +1982,7 @@ void WINAPI SetRectRgn16( HRGN16 hrgn, INT16 left, INT16 top, INT16 right, INT16 ...@@ -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 ) 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; unsigned int i;
for (i = 0; i < handles; i++) ht32->objectHandle[i] = HGDIOBJ_32(ht->objectHandle[i]); for (i = 0; i < handles; i++) ht32->objectHandle[i] = HGDIOBJ_32(ht->objectHandle[i]);
......
...@@ -213,7 +213,7 @@ BOOL16 WINAPI EnumMetaFile16( HDC16 hdc16, HMETAFILE16 hmf, ...@@ -213,7 +213,7 @@ BOOL16 WINAPI EnumMetaFile16( HDC16 hdc16, HMETAFILE16 hmf,
/* create the handle table */ /* create the handle table */
hHT = GlobalAlloc16(GMEM_MOVEABLE | GMEM_ZEROINIT, hHT = GlobalAlloc16(GMEM_MOVEABLE | GMEM_ZEROINIT,
sizeof(HANDLETABLE16) * mh->mtNoObjects); FIELD_OFFSET(HANDLETABLE16, objectHandle[mh->mtNoObjects]));
spht = WOWGlobalLock16(hHT); spht = WOWGlobalLock16(hHT);
seg = hmf | 7; seg = hmf | 7;
......
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