mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
[svn] Cosmetic fixes.
This commit is contained in:
parent
101f896e47
commit
e7998ad916
@ -1,3 +1,7 @@
|
|||||||
|
2003-09-20 Hrvoje Niksic <hniksic@xemacs.org>
|
||||||
|
|
||||||
|
* retr.c (get_contents): Cosmetic fixes.
|
||||||
|
|
||||||
2003-09-20 Hrvoje Niksic <hniksic@xemacs.org>
|
2003-09-20 Hrvoje Niksic <hniksic@xemacs.org>
|
||||||
|
|
||||||
* url.c (uri_merge): Get rid of uri_merge_1.
|
* url.c (uri_merge): Get rid of uri_merge_1.
|
||||||
|
27
src/retr.c
27
src/retr.c
@ -79,9 +79,8 @@ limit_bandwidth_reset (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Limit the bandwidth by pausing the download for an amount of time.
|
/* Limit the bandwidth by pausing the download for an amount of time.
|
||||||
BYTES is the number of bytes received from the network, DELTA is
|
BYTES is the number of bytes received from the network, and DELTA
|
||||||
how long it took to receive them, DLTIME the current download time,
|
is how long it took to receive them. */
|
||||||
TIMER the timer, and ADJUSTMENT the previous. */
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
limit_bandwidth (long bytes, double delta)
|
limit_bandwidth (long bytes, double delta)
|
||||||
@ -196,12 +195,14 @@ get_contents (int fd, FILE *fp, long *len, long restval, long expected,
|
|||||||
#endif /* HAVE_SSL */
|
#endif /* HAVE_SSL */
|
||||||
res = iread (fd, dlbuf, amount_to_read);
|
res = iread (fd, dlbuf, amount_to_read);
|
||||||
|
|
||||||
if (res > 0)
|
if (res <= 0)
|
||||||
{
|
break;
|
||||||
|
|
||||||
fwrite (dlbuf, 1, res, fp);
|
fwrite (dlbuf, 1, res, fp);
|
||||||
/* Always flush the contents of the network packet. This
|
/* Always flush the contents of the network packet. This should
|
||||||
should not be adverse to performance, as the network
|
not hinder performance: fast downloads will be received in
|
||||||
packets typically won't be too tiny anyway. */
|
16K chunks (which stdio would write out anyway), and slow
|
||||||
|
downloads won't be limited with disk performance. */
|
||||||
fflush (fp);
|
fflush (fp);
|
||||||
if (ferror (fp))
|
if (ferror (fp))
|
||||||
{
|
{
|
||||||
@ -209,8 +210,8 @@ get_contents (int fd, FILE *fp, long *len, long restval, long expected,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If bandwidth is not limited, one call to wtimer_elapsed
|
/* If bandwidth is not limited, one call to wtimer_elapsed is
|
||||||
is sufficient. */
|
sufficient. */
|
||||||
dltime = wtimer_elapsed (timer);
|
dltime = wtimer_elapsed (timer);
|
||||||
if (opt.limit_rate)
|
if (opt.limit_rate)
|
||||||
{
|
{
|
||||||
@ -223,9 +224,6 @@ get_contents (int fd, FILE *fp, long *len, long restval, long expected,
|
|||||||
progress_update (progress, res, dltime);
|
progress_update (progress, res, dltime);
|
||||||
*len += res;
|
*len += res;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (res < -1)
|
if (res < -1)
|
||||||
res = -1;
|
res = -1;
|
||||||
|
|
||||||
@ -284,8 +282,7 @@ calc_rate (long bytes, double msecs, int *units)
|
|||||||
else if (dlrate < 1024.0 * 1024.0 * 1024.0)
|
else if (dlrate < 1024.0 * 1024.0 * 1024.0)
|
||||||
*units = 2, dlrate /= (1024.0 * 1024.0);
|
*units = 2, dlrate /= (1024.0 * 1024.0);
|
||||||
else
|
else
|
||||||
/* Maybe someone will need this one day. More realistically, it
|
/* Maybe someone will need this, one day. */
|
||||||
will get tickled by buggy timers. */
|
|
||||||
*units = 3, dlrate /= (1024.0 * 1024.0 * 1024.0);
|
*units = 3, dlrate /= (1024.0 * 1024.0 * 1024.0);
|
||||||
|
|
||||||
return dlrate;
|
return dlrate;
|
||||||
|
Loading…
Reference in New Issue
Block a user