[I know my assignment is pending but hopefully this patch is small enough to squeak-by until it's been processed.]
2004-03-02 David Fritz <[EMAIL PROTECTED]>
* retr.c (fd_read_body): Under Windows, only call ws_percenttitle() if verbose. Fix by Gisle Vanem.
* mswindows.c (ws_percenttitle): Guard against future changes by doing nothing if the proper variables have not been initialized. Clamp percentage value.
Index: src/mswindows.c =================================================================== RCS file: /pack/anoncvs/wget/src/mswindows.c,v retrieving revision 1.27 diff -u -r1.27 mswindows.c --- src/mswindows.c 2004/02/26 14:34:17 1.27 +++ src/mswindows.c 2004/03/03 03:21:27 @@ -180,19 +180,24 @@ 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); Index: src/retr.c =================================================================== RCS file: /pack/anoncvs/wget/src/retr.c,v retrieving revision 1.84 diff -u -r1.84 retr.c --- src/retr.c 2003/12/14 13:35:27 1.84 +++ src/retr.c 2004/03/03 03:21:31 @@ -311,7 +311,7 @@ if (progress) progress_update (progress, ret, wtimer_read (timer)); #ifdef WINDOWS - if (toread > 0) + if (opt.verbose && toread > 0) ws_percenttitle (100.0 * (startpos + sum_read) / (startpos + toread)); #endif