From 57547f7b1eef1f0d6384993cc60a33733b177a9e Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Wed, 28 Sep 2011 14:21:35 +0000 Subject: Make llcache_handle_get_url return a nsurl. svn path=/trunk/netsurf/; revision=12905 --- cocoa/apple_image.m | 2 +- content/content.c | 27 +++++++++++++++++---------- content/llcache.c | 6 ++---- content/llcache.h | 2 +- desktop/download.c | 5 +++-- 5 files changed, 24 insertions(+), 18 deletions(-) diff --git a/cocoa/apple_image.m b/cocoa/apple_image.m index dd2ed56de..f28ec25bf 100644 --- a/cocoa/apple_image.m +++ b/cocoa/apple_image.m @@ -175,7 +175,7 @@ bool apple_image_convert(struct content *c) c->height = [image pixelsHigh]; ai_c->bitmap = (void *)image; - NSString *url = [NSString stringWithUTF8String: llcache_handle_get_url( content_get_llcache_handle( c ) )]; + NSString *url = [NSString stringWithUTF8String: nsurl_access(llcache_handle_get_url( content_get_llcache_handle( c )) )]; NSString *title = [NSString stringWithFormat: @"%@ (%dx%d)", [url lastPathComponent], c->width, c->height]; content__set_title(c, [title UTF8String] ); diff --git a/content/content.c b/content/content.c index 4a32fa040..081674676 100644 --- a/content/content.c +++ b/content/content.c @@ -82,7 +82,7 @@ nserror content__init(struct content *c, const content_handler *handler, struct content_user *user_sentinel; nserror error; - LOG(("url %s -> %p", llcache_handle_get_url(llcache), c)); + LOG(("url %s -> %p", nsurl_access(llcache_handle_get_url(llcache)), c)); user_sentinel = talloc(c, struct content_user); if (user_sentinel == NULL) { @@ -274,7 +274,8 @@ void content_convert(struct content *c) if (c->locked == true) return; - LOG(("content %s (%p)", llcache_handle_get_url(c->llcache), c)); + LOG(("content %s (%p)", + nsurl_access(llcache_handle_get_url(c->llcache)), c)); if (c->handler->data_complete != NULL) { c->locked = true; @@ -353,7 +354,7 @@ void content__reformat(struct content *c, bool background, assert(c->status == CONTENT_STATUS_READY || c->status == CONTENT_STATUS_DONE); assert(c->locked == false); - LOG(("%p %s", c, llcache_handle_get_url(c->llcache))); + LOG(("%p %s", c, nsurl_access(llcache_handle_get_url(c->llcache)))); c->available_width = width; if (c->handler->reformat != NULL) { @@ -376,7 +377,8 @@ void content__reformat(struct content *c, bool background, void content_destroy(struct content *c) { assert(c); - LOG(("content %p %s", c, llcache_handle_get_url(c->llcache))); + LOG(("content %p %s", c, + nsurl_access(llcache_handle_get_url(c->llcache)))); assert(c->locked == false); if (c->handler->destroy != NULL) @@ -541,7 +543,8 @@ bool content_add_user(struct content *c, struct content_user *user; LOG(("content %s (%p), user %p %p", - llcache_handle_get_url(c->llcache), c, callback, pw)); + nsurl_access(llcache_handle_get_url(c->llcache)), + c, callback, pw)); user = talloc(c, struct content_user); if (!user) return false; @@ -568,7 +571,8 @@ void content_remove_user(struct content *c, { struct content_user *user, *next; LOG(("content %s (%p), user %p %p", - llcache_handle_get_url(c->llcache), c, callback, pw)); + nsurl_access(llcache_handle_get_url(c->llcache)), c, + callback, pw)); /* user_list starts with a sentinel */ for (user = c->user_list; user->next != 0 && @@ -665,7 +669,8 @@ void content_open(hlcache_handle *h, struct browser_window *bw, { struct content *c = hlcache_handle_get_content(h); assert(c != 0); - LOG(("content %p %s", c, llcache_handle_get_url(c->llcache))); + LOG(("content %p %s", c, + nsurl_access(llcache_handle_get_url(c->llcache)))); if (c->handler->open != NULL) c->handler->open(c, bw, page, box, params); } @@ -681,7 +686,8 @@ void content_close(hlcache_handle *h) { struct content *c = hlcache_handle_get_content(h); assert(c != 0); - LOG(("content %p %s", c, llcache_handle_get_url(c->llcache))); + LOG(("content %p %s", c, + nsurl_access(llcache_handle_get_url(c->llcache)))); if (c->handler->close != NULL) c->handler->close(c); } @@ -789,7 +795,7 @@ const char *content__get_url(struct content *c) if (c == NULL) return NULL; - return llcache_handle_get_url(c->llcache); + return nsurl_access(llcache_handle_get_url(c->llcache)); } /** @@ -808,7 +814,8 @@ const char *content__get_title(struct content *c) if (c == NULL) return NULL; - return c->title != NULL ? c->title : llcache_handle_get_url(c->llcache); + return c->title != NULL ? c->title : + nsurl_access(llcache_handle_get_url(c->llcache)); } /** diff --git a/content/llcache.c b/content/llcache.c index 124f98652..1c9641121 100644 --- a/content/llcache.c +++ b/content/llcache.c @@ -548,11 +548,9 @@ nserror llcache_handle_invalidate_cache_data(llcache_handle *handle) } /* See llcache.h for documentation */ -const char *llcache_handle_get_url(const llcache_handle *handle) +nsurl *llcache_handle_get_url(const llcache_handle *handle) { - /* TODO: return a nsurl? */ - return handle->object != NULL ? - nsurl_access(handle->object->url) : NULL; + return handle->object != NULL ? handle->object->url : NULL; } /* See llcache.h for documentation */ diff --git a/content/llcache.h b/content/llcache.h index 337408167..b596310e9 100644 --- a/content/llcache.h +++ b/content/llcache.h @@ -254,7 +254,7 @@ nserror llcache_handle_invalidate_cache_data(llcache_handle *handle); * \param handle Handle to retrieve URL from * \return Post-redirect URL of cache object */ -const char *llcache_handle_get_url(const llcache_handle *handle); +nsurl *llcache_handle_get_url(const llcache_handle *handle); /** * Retrieve source data of a low-level cache object diff --git a/desktop/download.c b/desktop/download.c index b0ca700d0..fd91ed396 100644 --- a/desktop/download.c +++ b/desktop/download.c @@ -146,7 +146,8 @@ static nserror download_context_process_headers(download_context *ctx) ctx->total_length = length; if (ctx->filename == NULL) { ctx->filename = download_default_filename( - llcache_handle_get_url(ctx->llcache)); + nsurl_access( + llcache_handle_get_url(ctx->llcache))); } http_content_type_destroy(content_type); @@ -287,7 +288,7 @@ void download_context_abort(download_context *ctx) /* See download.h for documentation */ const char *download_context_get_url(const download_context *ctx) { - return llcache_handle_get_url(ctx->llcache); + return nsurl_access(llcache_handle_get_url(ctx->llcache)); } /* See download.h for documentation */ -- cgit v1.2.3