Skip to content

Commit a8e2d68

Browse files
committed
Large-file support for 64-bit systems
Apparently, only a few lines have to be changed in order to support large(r) files on 64-bit machines. This commit doesn't (yet) fix the issue on 32-bit machines (it also doesn't test this explicitly). In comparison to #59, however, it uses types that help get this to work on 32-bit machines as well, as it doesn't use compiler-dependent types, but types that are known to be large enough even there. Closes #59. CC #31.
1 parent 86cfd3a commit a8e2d68

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/legacy_http.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ struct http_file
7474
} handle;
7575

7676
char *buffer;
77-
size_t buffer_len;
78-
size_t buffer_pos;
77+
uint64_t buffer_len;
78+
uint64_t buffer_pos;
7979
int still_running;
8080
};
8181

@@ -340,9 +340,9 @@ static int fill_buffer(HTTP_FILE *file, size_t want, CURLM* multi_handle)
340340
*
341341
* Removes `want` bytes from the front of the buffer.
342342
*/
343-
static int use_buffer(HTTP_FILE *file, int want)
343+
static int use_buffer(HTTP_FILE *file, uint64_t want)
344344
{
345-
if((file->buffer_pos - want) <= 0){
345+
if(file->buffer_pos <= want){
346346
/* trash the buffer */
347347
if(file->buffer){
348348
free(file->buffer);
@@ -509,7 +509,7 @@ static void buflwr(char *s) {
509509
int range_fetch_read_http_headers(struct range_fetch *rf) {
510510
char buf[512];
511511
int status;
512-
int seen_location = 0;
512+
uint64_t seen_location = 0;
513513

514514
{ /* read status line */
515515
char *p;
@@ -580,7 +580,7 @@ int range_fetch_read_http_headers(struct range_fetch *rf) {
580580
if (status == 206 && !strcmp(buf, "content-range")) {
581581
/* Okay, we're getting a non-MIME block from the remote. Get the
582582
* range and set our state appropriately */
583-
int from, to;
583+
uint64_t from, to;
584584
sscanf(p, "bytes " OFF_T_PF "-" OFF_T_PF "/", &from, &to);
585585
if (from <= to) {
586586
rf->block_left = to + 1 - from;

0 commit comments

Comments
 (0)