gdi.exe16: Use FIELD_OFFSET to calculate the size of structs with variable length array.
This commit is contained in:
parent
e67deeb8a1
commit
fb724cfd7b
|
@ -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,
|
||||||
/* 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;
|
||||||
|
|
Loading…
Reference in New Issue