Michael Stefaniuc : user32: Avoid sizeof on structs with variable length array.
Alexandre Julliard
julliard at winehq.org
Wed Oct 31 17:17:21 CDT 2012
Module: wine
Branch: master
Commit: 5f304e7000063f92c1e55c1def40640844179127
URL: http://source.winehq.org/git/wine.git/?a=commit;h=5f304e7000063f92c1e55c1def40640844179127
Author: Michael Stefaniuc <mstefani at redhat.de>
Date: Wed Oct 31 11:34:10 2012 +0100
user32: Avoid sizeof on structs with variable length array.
---
dlls/user32/exticon.c | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)
diff --git a/dlls/user32/exticon.c b/dlls/user32/exticon.c
index 840483c..5682c77 100644
--- a/dlls/user32/exticon.c
+++ b/dlls/user32/exticon.c
@@ -216,9 +216,6 @@ static BYTE * ICO_LoadIcon( LPBYTE peimage, LPicoICONDIRENTRY lpiIDE, ULONG *uSi
*
* Reads .ico file and build phony ICONDIR struct
*/
-#define HEADER_SIZE (sizeof(CURSORICONDIR) - sizeof (CURSORICONDIRENTRY))
-#define HEADER_SIZE_FILE (sizeof(icoICONDIR) - sizeof (icoICONDIRENTRY))
-
static BYTE * ICO_GetIconDirectory( LPBYTE peimage, LPicoICONDIR* lplpiID, ULONG *uSize )
{
CURSORICONDIR * lpcid; /* icon resource in resource-dir format */
@@ -233,7 +230,7 @@ static BYTE * ICO_GetIconDirectory( LPBYTE peimage, LPicoICONDIR* lplpiID, ULONG
return 0;
/* allocate the phony ICONDIR structure */
- *uSize = lpcid->idCount * sizeof(CURSORICONDIRENTRY) + HEADER_SIZE;
+ *uSize = FIELD_OFFSET(CURSORICONDIR, idEntries[lpcid->idCount]);
if( (lpID = HeapAlloc(GetProcessHeap(),0, *uSize) ))
{
/* copy the header */
More information about the wine-cvs
mailing list