Changes between Initial Version and Version 1 of Ticket #29185, comment 15


Ignore:
Timestamp:
Jan 29, 2019, 8:27:11 PM (8 weeks ago)
Author:
cypherpunks2
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #29185, comment 15

    initial v1  
    1 {{{
    2 static LPBYTE generate_icon_group(IconGroup icon, IconPairs order, bool first)
    3 {
    4   LPBYTE group = new BYTE[
    5     sizeof(IconGroupHeader) // header
    6     + order.size() * SIZEOF_RSRC_ICON_GROUP_ENTRY // entries
    7   ];
    8 
    9   IconGroupHeader* header = (IconGroupHeader*) group;
    10 
    11   header->wReserved = 0;
    12   header->wIsIcon   = FIX_ENDIAN_INT16(1);
    13   header->wCount    = FIX_ENDIAN_INT16((WORD)icon.size());
    14 
    15   order = sort_pairs(order, first);
    16 
    17   for (IconGroup::size_type i = 0; i < icon.size(); i++)
    18   {
    19     RsrcIconGroupEntry* entry = (RsrcIconGroupEntry*)
    20       &group[sizeof(IconGroupHeader) + SIZEOF_RSRC_ICON_GROUP_ENTRY * i];
    21     unsigned index = first ? order[i].index1 : order[i].index2;
    22 
    23     memcpy(&entry->header, &icon[index].meta, sizeof(IconGroupEntry));
    24     entry->wRsrcId = FIX_ENDIAN_INT16(order[i].size_index + 1);
    25   }
    26 
    27   return group;
    28 }
    29 }}}
    30 {{{
    31 #define SIZEOF_RSRC_ICON_GROUP_ENTRY 14
    32 }}}
    33 {{{
    34 typedef struct
    35 {
    36   BYTE bWidth;
    37   BYTE bHeight;
    38   BYTE bPaletteEntries;
    39   BYTE bReserved;
    40   WORD wPlanes;
    41   WORD wBitsPerPixel;
    42   DWORD dwRawSize;
    43 } IconGroupEntry;
    44 }}}
    45 Why?
    46 
    47 order.size() == icon.size()? How?
    48 
    49 ZeroMemory for group need.
     1No, I don't want to play this game. cpunks account removed. cpunks3 owned. Sorry.