ico: fix interpretation of 0 widths/heights
This commit is contained in:
parent
5d790e08ca
commit
81647c2025
1 changed files with 7 additions and 2 deletions
|
@ -13,8 +13,8 @@ struct Icon
|
|||
{
|
||||
Icon *next;
|
||||
|
||||
uchar w; /* icon width */
|
||||
uchar h; /* icon height */
|
||||
ushort w; /* icon width */
|
||||
ushort h; /* icon height */
|
||||
ushort ncolor; /* number of colors */
|
||||
ushort nplane; /* number of bit planes */
|
||||
ushort bits; /* bits per pixel */
|
||||
|
@ -269,6 +269,11 @@ Bgeticon(Biobuf *b, Icon *icon)
|
|||
icon->nplane = gets(buf+12);
|
||||
icon->bits = gets(buf+14);
|
||||
|
||||
if(icon->w == 0)
|
||||
icon->w = 256;
|
||||
if(icon->h == 0)
|
||||
icon->h = 256;
|
||||
|
||||
/* limit what we handle */
|
||||
switch(icon->bits){
|
||||
case 1:
|
||||
|
|
Loading…
Reference in a new issue