Huw Davies : gdi32: Rename the struct representing an embedded EMF in a WMF.

Alexandre Julliard julliard at winehq.org
Wed Jun 8 11:07:36 CDT 2016


Module: wine
Branch: master
Commit: 7be1c53d8297561c7616b4a3ba7698dea01ffd7f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=7be1c53d8297561c7616b4a3ba7698dea01ffd7f

Author: Huw Davies <huw at codeweavers.com>
Date:   Wed Jun  8 11:00:45 2016 +0100

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 at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/gdi32/metafile.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/dlls/gdi32/metafile.c b/dlls/gdi32/metafile.c
index 0cb36af..925d648 100644
--- a/dlls/gdi32/metafile.c
+++ b/dlls/gdi32/metafile.c
@@ -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;




More information about the wine-cvs mailing list