[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-devel
Subject:    comctl32: fix MSVC build in imagelist.c
From:       carlo.bramix () libero ! it
Date:       2012-01-30 14:24:03
Message-ID: 31138179.29882.1327933443926.JavaMail.liberogw () smtp ! libero ! it
[Download RAW message or body]

If I can say my opinion, I disagree on the usage of HeapAlloc/HeapFree for that known \
amount of memory. Instead, for granting compatibility with MSVC, I would continue to \
use a structure in stack memory by simply using _alloca() and something like this:

LPBITMAPINFO bmi = (LPBITMAPINFO)
_alloca(FIELD_OFFSET(BITMAPINFO, bmiColors[256]));

or this:

LPBITMAPINFO bmi = (LPBITMAPINFO)
_alloca(sizeof(BITMAPINFO)+sizeof(RGBQUAD)*256);

and leaving all other lines of code unchanged.

Sincerely,

Carlo Bramini.


> Thomas Faber <thfabba at gmx.de> writes:
> 
> > This removes the use of a Variable-Length Array in ImageList_CreateImage
> > and replaces it with HeapAlloc/HeapFree, as it is done in several
> > other functions in this file.
> > Alas, FIELD_OFFSET is "not const enough" for ANSI C.
> 
> Using sizeof instead would be preferable.
> 
> -- 
> Alexandre Julliard
> julliard at winehq.org
> 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic