> From: busybox <[email protected]> On Behalf Of Anton Moryakov
> Sent: Tuesday, February 4, 2025 11:36 PM
> ...
> Corrections explained:
> 1. Use `uint64_t` for intermediate calculations to avoid overflow.
> 2. Ensure `height` is not zero to prevent division by zero.
>
> The logic of the progress bar remains unchanged, but the code is now
> more robust and safe against edge cases.
> ...
> ---
>  miscutils/fbsplash.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/miscutils/fbsplash.c b/miscutils/fbsplash.c
> index 2934d8eb7..96644865e 100644
> --- a/miscutils/fbsplash.c
> +++ b/miscutils/fbsplash.c
> @@ -353,7 +353,7 @@ static void fb_drawprogressbar(unsigned percent)
>               while (i >= 0) {
>                       // draw one-line thick "rectangle"
>                       // top line will have gray lvl 200, bottom one 100
> -                     unsigned gray_level = 100 + (unsigned)i*100 / height;
> +                     unsigned gray_level = 100 + (unsigned)i / height * 100;
>                       fb_drawfullrectangle(
>                                       left_x, y, pos_x, y,
>                                       gray_level, gray_level, gray_level);
> --
> 2.30.2

The shown change doesn't match the "Corrections explained", and it's not true 
that the result of the expression "remains unchanged".
--
Regards,
Dietmar Schindler
________________________________
manroland Goss web systems GmbH | Managing Director: Franz Kriechbaum
Registered Office: Augsburg | Trade Register: AG Augsburg | HRB-No.: 32609 | 
VAT: DE815764857

Confidentiality note:
This message and any attached documents may contain confidential or proprietary 
information of manroland|Goss. These materials are intended only for the use of 
the intended recipient. If you are not the intended recipient of this 
transmission, you are hereby notified that any distribution, disclosure, 
printing, copying, storage, modification or the taking of any action in 
reliance upon this transmission is strictly prohibited. Delivery of this 
message to any person other than the intended recipient shall not compromise or 
waive such confidentiality, privilege or exemption from disclosure as to this 
communication. If you have received this communication in error, please 
immediately notify the sender and delete the message from your system. All 
liability for viruses is excluded to the fullest extent permitted by law.
________________________________
_______________________________________________
busybox mailing list
[email protected]
https://lists.busybox.net/mailman/listinfo/busybox

Reply via email to