Make llcache_handle_get_url return a nsurl.

svn path=/trunk/netsurf/; revision=12905
This commit is contained in:
Michael Drake 2011-09-28 14:21:35 +00:00
parent 861f88aa43
commit 57547f7b1e
5 changed files with 24 additions and 18 deletions

View File

@ -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] );

View File

@ -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));
}
/**

View File

@ -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 */

View File

@ -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

View File

@ -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 */