Commit 7be1c53d authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

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: 's avatarHuw Davies <huw@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 96185e23
...@@ -1128,8 +1128,8 @@ typedef struct ...@@ -1128,8 +1128,8 @@ typedef struct
DWORD chunk_size; DWORD chunk_size;
DWORD remaining_size; DWORD remaining_size;
DWORD emf_size; DWORD emf_size;
BYTE *emf_data; BYTE emf_data[1];
} mf_comment_chunk; } emf_in_wmf_comment;
#include <poppack.h> #include <poppack.h>
static const DWORD wmfc_magic = 0x43464d57; static const DWORD wmfc_magic = 0x43464d57;
...@@ -1146,7 +1146,7 @@ static BOOL add_mf_comment(HDC hdc, HENHMETAFILE emf) ...@@ -1146,7 +1146,7 @@ static BOOL add_mf_comment(HDC hdc, HENHMETAFILE emf)
{ {
DWORD size = GetEnhMetaFileBits(emf, 0, NULL), i; DWORD size = GetEnhMetaFileBits(emf, 0, NULL), i;
BYTE *bits, *chunk_data; BYTE *bits, *chunk_data;
mf_comment_chunk *chunk = NULL; emf_in_wmf_comment *chunk = NULL;
BOOL ret = FALSE; BOOL ret = FALSE;
static const DWORD max_chunk_size = 0x2000; static const DWORD max_chunk_size = 0x2000;
...@@ -1155,7 +1155,7 @@ static BOOL add_mf_comment(HDC hdc, HENHMETAFILE emf) ...@@ -1155,7 +1155,7 @@ static BOOL add_mf_comment(HDC hdc, HENHMETAFILE emf)
if(!bits) return FALSE; if(!bits) return FALSE;
if(!GetEnhMetaFileBits(emf, size, bits)) goto end; 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; if(!chunk) goto end;
chunk->magic = wmfc_magic; chunk->magic = wmfc_magic;
...@@ -1176,10 +1176,10 @@ static BOOL add_mf_comment(HDC hdc, HENHMETAFILE emf) ...@@ -1176,10 +1176,10 @@ static BOOL add_mf_comment(HDC hdc, HENHMETAFILE emf)
chunk->chunk_size = chunk->remaining_size; chunk->chunk_size = chunk->remaining_size;
chunk->remaining_size -= chunk->chunk_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; 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; goto end;
} }
ret = TRUE; ret = TRUE;
......
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