summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2014-05-08 17:54:44 +0100
committerVincent Sanders <vince@kyllikki.org>2014-05-08 17:54:44 +0100
commitcd7f1eceea81a69e5b4dcdef90d45aab44f8a11f (patch)
treeaa9ac5ffab173f59b590b39f665356e7127e02bf /desktop
parent096bd47ab0018e7b9c3affd58b6134463e2aaa65 (diff)
downloadnetsurf-cd7f1eceea81a69e5b4dcdef90d45aab44f8a11f.tar.gz
netsurf-cd7f1eceea81a69e5b4dcdef90d45aab44f8a11f.tar.bz2
make download_context_get_url() return an nsurl and adapt callers to cope
Diffstat (limited to 'desktop')
-rw-r--r--desktop/download.c11
-rw-r--r--desktop/download.h10
2 files changed, 12 insertions, 9 deletions
diff --git a/desktop/download.c b/desktop/download.c
index cad04779f..0f3fcb6f5 100644
--- a/desktop/download.c
+++ b/desktop/download.c
@@ -71,11 +71,11 @@ static char *download_parse_filename(const char *filename)
* \param url URL of item being fetched
* \return Default filename, or NULL on memory exhaustion
*/
-static char *download_default_filename(const char *url)
+static char *download_default_filename(nsurl *url)
{
char *nice;
- if (url_nice(url, &nice, false) == NSERROR_OK)
+ if (url_nice(nsurl_access(url), &nice, false) == NSERROR_OK)
return nice;
return NULL;
@@ -140,8 +140,7 @@ static nserror download_context_process_headers(download_context *ctx)
ctx->total_length = length;
if (ctx->filename == NULL) {
ctx->filename = download_default_filename(
- nsurl_access(
- llcache_handle_get_url(ctx->llcache)));
+ llcache_handle_get_url(ctx->llcache));
}
http_content_type_destroy(content_type);
@@ -283,9 +282,9 @@ void download_context_abort(download_context *ctx)
}
/* See download.h for documentation */
-const char *download_context_get_url(const download_context *ctx)
+nsurl *download_context_get_url(const download_context *ctx)
{
- return nsurl_access(llcache_handle_get_url(ctx->llcache));
+ return llcache_handle_get_url(ctx->llcache);
}
/* See download.h for documentation */
diff --git a/desktop/download.h b/desktop/download.h
index f53f38b95..4084fa148 100644
--- a/desktop/download.h
+++ b/desktop/download.h
@@ -67,10 +67,14 @@ void download_context_abort(download_context *ctx);
/**
* Retrieve the URL for a download
*
- * \param ctx Context to retrieve URL from
- * \return URL string
+ * The caller is borrowing the url reference from the underlying low
+ * level cache object. If it is used beyond the immediate scope of the
+ * caller an additional reference should be made.
+ *
+ * \param ctx Context to retrieve URL from
+ * \return URL object
*/
-const char *download_context_get_url(const download_context *ctx);
+nsurl *download_context_get_url(const download_context *ctx);
/**
* Retrieve the MIME type for a download