From f64b37b29f3a64d80f42f62c113fe81a15c5b275 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Sat, 19 Oct 2019 19:43:00 +0100 Subject: make download core store size in at least 64bits to allow for large files --- desktop/download.c | 14 ++++++++------ desktop/download.h | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/desktop/download.c b/desktop/download.c index e17855aa1..4931371fb 100644 --- a/desktop/download.c +++ b/desktop/download.c @@ -42,7 +42,7 @@ struct download_context { struct gui_window *parent; /**< Parent window */ lwc_string *mime_type; /**< MIME type of download */ - unsigned long total_length; /**< Length of data, in bytes */ + unsigned long long int total_length; /**< Length of data, in bytes */ char *filename; /**< Suggested filename */ struct gui_download_window *window; /**< GUI download window */ @@ -94,7 +94,7 @@ static nserror download_context_process_headers(download_context *ctx) { const char *http_header; http_content_type *content_type; - unsigned long length; + unsigned long long int length; nserror error; /* Retrieve and parse Content-Type */ @@ -108,10 +108,11 @@ static nserror download_context_process_headers(download_context *ctx) /* Retrieve and parse Content-Length */ http_header = llcache_handle_get_header(ctx->llcache, "Content-Length"); - if (http_header == NULL) + if (http_header == NULL) { length = 0; - else - length = strtoul(http_header, NULL, 10); + } else { + length = strtoull(http_header, NULL, 10); + } /* Retrieve and parse Content-Disposition */ http_header = llcache_handle_get_header(ctx->llcache, @@ -299,7 +300,8 @@ const char *download_context_get_mime_type(const download_context *ctx) } /* See download.h for documentation */ -unsigned long download_context_get_total_length(const download_context *ctx) +unsigned long long int +download_context_get_total_length(const download_context *ctx) { return ctx->total_length; } diff --git a/desktop/download.h b/desktop/download.h index dc2befd90..b704c4c7d 100644 --- a/desktop/download.h +++ b/desktop/download.h @@ -91,7 +91,7 @@ const char *download_context_get_mime_type(const download_context *ctx); * \param ctx Context to retrieve byte length from * \return Total length, in bytes, or 0 if unknown */ -unsigned long download_context_get_total_length(const download_context *ctx); +unsigned long long int download_context_get_total_length(const download_context *ctx); /** * Retrieve the filename for a download -- cgit v1.2.3