gdi32: Rename the struct representing an embedded EMF in a WMF.
Also, use an array rather than a pointer to represent the start of the data. Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
96185e23b4
commit
7be1c53d82
|
@ -1128,8 +1128,8 @@ typedef struct
|
|||
DWORD chunk_size;
|
||||
DWORD remaining_size;
|
||||
DWORD emf_size;
|
||||
BYTE *emf_data;
|
||||
} mf_comment_chunk;
|
||||
BYTE emf_data[1];
|
||||
} emf_in_wmf_comment;
|
||||
#include <poppack.h>
|
||||
|
||||
static const DWORD wmfc_magic = 0x43464d57;
|
||||
|
@ -1146,7 +1146,7 @@ static BOOL add_mf_comment(HDC hdc, HENHMETAFILE emf)
|
|||
{
|
||||
DWORD size = GetEnhMetaFileBits(emf, 0, NULL), i;
|
||||
BYTE *bits, *chunk_data;
|
||||
mf_comment_chunk *chunk = NULL;
|
||||
emf_in_wmf_comment *chunk = NULL;
|
||||
BOOL ret = FALSE;
|
||||
static const DWORD max_chunk_size = 0x2000;
|
||||
|
||||
|
@ -1155,7 +1155,7 @@ static BOOL add_mf_comment(HDC hdc, HENHMETAFILE emf)
|
|||
if(!bits) return FALSE;
|
||||
if(!GetEnhMetaFileBits(emf, size, bits)) goto end;
|
||||
|
||||
chunk = HeapAlloc(GetProcessHeap(), 0, max_chunk_size + FIELD_OFFSET(mf_comment_chunk, emf_data));
|
||||
chunk = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(emf_in_wmf_comment, emf_data[max_chunk_size]));
|
||||
if(!chunk) goto end;
|
||||
|
||||
chunk->magic = wmfc_magic;
|
||||
|
@ -1176,10 +1176,10 @@ static BOOL add_mf_comment(HDC hdc, HENHMETAFILE emf)
|
|||
chunk->chunk_size = chunk->remaining_size;
|
||||
|
||||
chunk->remaining_size -= chunk->chunk_size;
|
||||
memcpy(&chunk->emf_data, chunk_data, chunk->chunk_size);
|
||||
memcpy(chunk->emf_data, chunk_data, chunk->chunk_size);
|
||||
chunk_data += chunk->chunk_size;
|
||||
|
||||
if(!Escape(hdc, MFCOMMENT, chunk->chunk_size + FIELD_OFFSET(mf_comment_chunk, emf_data), (char*)chunk, NULL))
|
||||
if(!Escape(hdc, MFCOMMENT, FIELD_OFFSET(emf_in_wmf_comment, emf_data[chunk->chunk_size]), (char*)chunk, NULL))
|
||||
goto end;
|
||||
}
|
||||
ret = TRUE;
|
||||
|
|
Loading…
Reference in New Issue