[Bf-committers] Fix for bug: 1035, for review

Kenneth Styrberg bf-committers@blender.org
Sun, 29 Feb 2004 00:30:34 +0100


This is a multi-part message in MIME format.

------=_NextPart_000_0022_01C3FE5B.3E89C080
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi I found a solution for bug:1035.

in file: filesel.c

line: 1005


static int calc_filesel_regel(SpaceFile *sfile, int nr, int *valx, int =
*valy)
{
 /* get screen coordinate of a 'regel', dutch for line */
 int val, coll;

 nr-=3D sfile->ofs;

 /* amount of lines */
 val=3D (textrct.ymax-textrct.ymin)/FILESEL_DY;

/*bugfix start*/

-> if(val =3D=3D 0)
->  coll =3D 0;
-> else

/* Bugfix end */
  coll=3D nr/val;
 nr -=3D coll*val;
=20
 *valy=3D textrct.ymax-FILESEL_DY+3 - nr*FILESEL_DY;
 *valx=3D coll*collumwidth + textrct.xmin+20;
=20
 if(nr<0 || coll > sfile->collums) return 0;
 return 1;
}


This adds a check for division by zero which occurs if fileselector =
window is minimized so that (textrct.ymax-textrct.ymin)/FILESEL_DY =
return zero.


regards

styken
------=_NextPart_000_0022_01C3FE5B.3E89C080
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff><FONT face=3DArial size=3D2>
<DIV><FONT face=3DArial size=3D2>Hi I found a solution for =
bug:1035.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>in file: filesel.c</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>line: 1005</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>static int calc_filesel_regel(SpaceFile *sfile, int nr, int *valx, =
int=20
*valy)<BR>{<BR>&nbsp;/* get screen coordinate of a 'regel', dutch for =
line=20
*/<BR>&nbsp;int val, coll;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;nr-=3D =
sfile-&gt;ofs;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;/* amount of lines =
*/<BR>&nbsp;val=3D=20
(textrct.ymax-textrct.ymin)/FILESEL_DY;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>/*bugfix start*/</DIV>
<DIV><BR>-&gt;&nbsp;if(val =3D=3D 0)<BR>-&gt;&nbsp;&nbsp;coll =3D=20
0;<BR>-&gt;&nbsp;else</DIV>
<DIV>&nbsp;</DIV>
<DIV>/* Bugfix end */<BR>&nbsp;&nbsp;coll=3D nr/val;<BR>&nbsp;nr -=3D=20
coll*val;<BR>&nbsp;<BR>&nbsp;*valy=3D textrct.ymax-FILESEL_DY+3 -=20
nr*FILESEL_DY;<BR>&nbsp;*valx=3D coll*collumwidth +=20
textrct.xmin+20;<BR>&nbsp;<BR>&nbsp;if(nr&lt;0 || coll &gt; =
sfile-&gt;collums)=20
return 0;<BR>&nbsp;return 1;<BR>}</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>This adds a check for division by zero which occurs if fileselector =
window=20
is minimized so that (textrct.ymax-textrct.ymin)/FILESEL_DY return =
zero.</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>regards</DIV>
<DIV>&nbsp;</DIV>
<DIV>styken</FONT></DIV></BODY></HTML>

------=_NextPart_000_0022_01C3FE5B.3E89C080--