If that function is called with max ==0 then it is a much more serious error than a divide by zero, and we would mascarade the error by adding such code.
Best, Scuri Em sáb, 25 de mai de 2019 às 08:54, Ranier VF <[email protected]> escreveu: > Hi, > Fix iup_flatscrollbar.c: > --- ..\..\a\src\iup_flatscrollbar.c Mon Jan 28 18:13:06 2019 > +++ iup_flatscrollbar.c Sat May 25 08:53:03 2019 > @@ -138,14 +138,19 @@ > static void iFlatScrollBarCalcHandler(int size, int arrow_size, int max, > int d, int sb_size, int pos, int* pos1, int* pos2) > { > int pos_p; > - int range_p = size - 1 - 2 * arrow_size; > - > - int d_p = (d * range_p) / max; > - if (d_p < sb_size) d_p = sb_size; > + int d_p = 0; > + const int range_p = size - 1 - 2 * arrow_size; > > + if (max != 0) > + { > + d_p = (d * range_p) / max; > + } > + if (d_p < sb_size) > + { > + d_p = sb_size; > + } > pos_p = (pos * (range_p - d_p)) / (max - d); > pos_p += arrow_size; > - > *pos1 = pos_p; > *pos2 = pos_p + d_p; > } > > Best regards, > Ranier Vilela_______________________________________________ > Iup-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/iup-users >
_______________________________________________ Iup-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/iup-users
