mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
[svn] * mswindows.c (ws_percenttitle): Guard against future changes by
doing nothing if the proper variables have not been initialized. Clamp percentage value. Submitted by David Fritz.
This commit is contained in:
parent
5c07512ec9
commit
3f374f6db1
@ -1,3 +1,9 @@
|
||||
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.
|
||||
|
@ -180,7 +180,18 @@ ws_changetitle (const char *url)
|
||||
void
|
||||
ws_percenttitle (double percentage_float)
|
||||
{
|
||||
int percentage = (int) percentage_float;
|
||||
int percentage;
|
||||
|
||||
if (!title_buf || !curr_url)
|
||||
return;
|
||||
|
||||
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)
|
||||
@ -188,12 +199,6 @@ ws_percenttitle (double percentage_float)
|
||||
|
||||
old_percentage = percentage;
|
||||
|
||||
if (percentage > 100)
|
||||
return;
|
||||
|
||||
assert (title_buf != NULL);
|
||||
assert (curr_url != NULL);
|
||||
|
||||
sprintf (title_buf, "Wget [%d%%] %s", percentage, curr_url);
|
||||
SetConsoleTitle (title_buf);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user