+2004-03-02 David Fritz <zeroxdf@att.net>
+
+ * mswindows.c (ws_percenttitle): Guard against future changes by
+ doing nothing if the proper variables have not been initialized.
+ Clamp percentage value.
+
2004-03-04 Gisle Vanem <giva@bgnett.no>
* retr.c (fd_read_body): Don't change console title if quiet.
void
ws_percenttitle (double percentage_float)
{
- int percentage = (int) percentage_float;
+ int percentage;
- /* Only update the title when the percentage has changed. */
- if (percentage == old_percentage)
+ if (!title_buf || !curr_url)
return;
- old_percentage = percentage;
+ percentage = (int) percentage_float;
+ /* Clamp percentage value. */
+ if (percentage < 0)
+ percentage = 0;
if (percentage > 100)
+ percentage = 100;
+
+ /* Only update the title when the percentage has changed. */
+ if (percentage == old_percentage)
return;
- assert (title_buf != NULL);
- assert (curr_url != NULL);
+ old_percentage = percentage;
sprintf (title_buf, "Wget [%d%%] %s", percentage, curr_url);
SetConsoleTitle (title_buf);