summaryrefslogtreecommitdiff
path: root/frontends
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2019-10-19 23:01:08 +0100
committerVincent Sanders <vince@kyllikki.org>2019-10-19 23:01:08 +0100
commit69d31afcdeb3851944774ae5c92603b137db1ae7 (patch)
tree329374d42b83b3e1e09ffba2d8c83dfcc7b2868c /frontends
parentf64b37b29f3a64d80f42f62c113fe81a15c5b275 (diff)
downloadnetsurf-69d31afcdeb3851944774ae5c92603b137db1ae7.tar.gz
netsurf-69d31afcdeb3851944774ae5c92603b137db1ae7.tar.bz2
fix gtk download window to cope with files larger than 2 gibibytes
Diffstat (limited to 'frontends')
-rw-r--r--frontends/gtk/download.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/frontends/gtk/download.c b/frontends/gtk/download.c
index 6fb908195..173d2e46e 100644
--- a/frontends/gtk/download.c
+++ b/frontends/gtk/download.c
@@ -89,8 +89,8 @@ struct gui_download_window {
GString *name;
GString *time_left;
- gint size_total;
- gint size_downloaded;
+ unsigned long long int size_total;
+ unsigned long long int size_downloaded;
gint progress;
gfloat time_remaining;
gfloat start_time;
@@ -418,7 +418,9 @@ static gboolean nsgtk_download_update(gboolean force_update)
GList *list;
gchar *text;
gboolean update, pulse_mode = FALSE;
- gint downloaded = 0, total = 0, dls = 0;
+ unsigned long long int downloaded = 0;
+ unsigned long long int total = 0;
+ gint dls = 0;
gfloat percent, elapsed = g_timer_elapsed(dl_ctx.timer, NULL);
dl_ctx.num_active = 0;
@@ -439,9 +441,8 @@ static gboolean nsgtk_download_update(gboolean force_update)
dl->time_remaining = (dl->size_total -
dl->size_downloaded)/
dl->speed;
- dl->progress = (gfloat)
- dl->size_downloaded /
- dl->size_total * 100;
+ dl->progress = (double)dl->size_downloaded /
+ (double)dl->size_total * 100;
} else {
dl->progress++;
}
@@ -473,9 +474,9 @@ static gboolean nsgtk_download_update(gboolean force_update)
gtk_progress_bar_pulse(dl_ctx.progress);
gtk_progress_bar_set_text(dl_ctx.progress, text);
} else {
- percent = total != 0 ? (gfloat)downloaded / total : 0;
+ percent = total != 0 ? (double)downloaded / (double)total : 0;
text = g_strdup_printf(messages_get("gtkProgressBar"),
- floor(percent*100), dls);
+ floor(percent * 100), dls);
gtk_progress_bar_set_fraction(dl_ctx.progress,
percent);
gtk_progress_bar_set_text(dl_ctx.progress, text);
@@ -763,7 +764,7 @@ static struct gui_download_window *
gui_download_window_create(download_context *ctx, struct gui_window *gui)
{
nsurl *url;
- unsigned long total_size;
+ unsigned long long int total_size;
gchar *domain;
gchar *destination;
gboolean unknown_size;