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 >
