1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

fsp: Try to support large files.

FSP v2 uses 32-bit file offsets in its UDP packets and cannot get past
4 GiB.  ELinks should however try not to wrap the numbers to negative
at 2 GiB, if it is built with large file support.
This commit is contained in:
Kalle Olavi Niemitalo 2007-03-05 22:09:17 +02:00 committed by Kalle Olavi Niemitalo
parent 1d0a3e9f7c
commit 9f47368894

View File

@ -279,7 +279,7 @@ do_fsp(struct connection *conn)
} }
/* Send filesize */ /* Send filesize */
fprintf(stderr, "%d\n", (unsigned int)(sb.st_size)); fprintf(stderr, "%" OFF_T_FORMAT "\n", (off_t)(sb.st_size));
fclose(stderr); fclose(stderr);
while ((r = fsp_fread(buf, 1, READ_SIZE, file)) > 0) while ((r = fsp_fread(buf, 1, READ_SIZE, file)) > 0)
@ -397,7 +397,11 @@ fsp_got_header(struct socket *socket, struct read_buffer *rb)
mem_free(ctype); mem_free(ctype);
} else { } else {
if (ctype[0] >= '0' && ctype[0] <= '9') { if (ctype[0] >= '0' && ctype[0] <= '9') {
conn->est_length = (off_t)atoi(ctype); #ifdef HAVE_ATOLL
conn->est_length = (off_t)atoll(ctype);
#else
conn->est_length = (off_t)atol(ctype);
#endif
mem_free(ctype); mem_free(ctype);
/* avoid read from socket error */ /* avoid read from socket error */