diff options
author | Vincent Sanders <vince@kyllikki.org> | 2014-05-08 17:54:44 +0100 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2014-05-08 17:54:44 +0100 |
commit | cd7f1eceea81a69e5b4dcdef90d45aab44f8a11f (patch) | |
tree | aa9ac5ffab173f59b590b39f665356e7127e02bf /windows/download.c | |
parent | 096bd47ab0018e7b9c3affd58b6134463e2aaa65 (diff) | |
download | netsurf-cd7f1eceea81a69e5b4dcdef90d45aab44f8a11f.tar.gz netsurf-cd7f1eceea81a69e5b4dcdef90d45aab44f8a11f.tar.bz2 |
make download_context_get_url() return an nsurl and adapt callers to cope
Diffstat (limited to 'windows/download.c')
-rw-r--r-- | windows/download.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/windows/download.c b/windows/download.c index b721d1fdc..2045864f5 100644 --- a/windows/download.c +++ b/windows/download.c @@ -30,6 +30,7 @@ #include "utils/log.h" #include "utils/messages.h" #include "utils/url.h" +#include "utils/nsurl.h" #include "utils/utils.h" #include "windows/download.h" @@ -64,21 +65,25 @@ gui_download_window_create(download_context *ctx, struct gui_window *gui) } int total_size = download_context_get_total_length(ctx); char *domain, *filename, *destination; - const char *url=download_context_get_url(ctx); + nsurl *url = download_context_get_url(ctx); bool unknown_size = (total_size == 0); const char *size = (unknown_size) ? messages_get("UnknownSize") : human_friendly_bytesize(total_size); - if (url_nice(url, &filename, false) != NSERROR_OK) + if (url_nice(nsurl_access(url), &filename, false) != NSERROR_OK) filename = strdup(messages_get("UnknownFile")); if (filename == NULL) { warn_user(messages_get("NoMemory"), 0); free(w); return NULL; } - if (url_host(url, &domain) != NSERROR_OK) + + if (nsurl_has_component(url, NSURL_HOST)) { + domain = strdup(lwc_string_data(nsurl_get_component(url, NSURL_HOST))); + } else { domain = strdup(messages_get("UnknownHost")); + } if (domain == NULL) { warn_user(messages_get("NoMemory"), 0); free(filename); |