summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2014-10-26 10:04:24 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2014-10-26 10:18:31 +0000
commit87b1da592111c6b30775edcb0a84e38ee26cd520 (patch)
tree4805e32e722782e6c68a0976c19ccfc424942e93
parente39606c411bad57de5891965628f6ac278df42ee (diff)
downloadnetsurf-87b1da592111c6b30775edcb0a84e38ee26cd520.tar.gz
netsurf-87b1da592111c6b30775edcb0a84e38ee26cd520.tar.bz2
Use nsurl to extract scheme.
-rwxr-xr-xamiga/launch.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/amiga/launch.c b/amiga/launch.c
index d3c9ff11e..e8b64f65b 100755
--- a/amiga/launch.c
+++ b/amiga/launch.c
@@ -42,17 +42,25 @@ struct MinList ami_unsupportedprotocols;
struct ami_protocol
{
struct MinNode node;
- char *protocol;
+ lwc_string *protocol;
};
struct ami_protocol *ami_openurl_add_protocol(const char *url)
{
+ nsurl *ns_url
struct ami_protocol *ami_p =
(struct ami_protocol *)AllocVecTagList(sizeof(struct ami_protocol), NULL);
- if(url_scheme(url, &ami_p->protocol) != NSERROR_OK)
+ if (nsurl_create(url, &ns_url) != NSERROR_OK) {
+ FreeVec(ami_p);
+ return NULL;
+ }
+
+ ami_p->protocol = nsurl_get_component(ns_url, NSURL_SCHEME);
+ if (ami_p->protocol == NULL)
{
FreeVec(ami_p);
+ nsurl_unref(ns_url);
return NULL;
}
@@ -73,7 +81,7 @@ void ami_openurl_free_list(struct MinList *list)
nnode=(struct ami_protocol *)GetSucc((struct Node *)node);
Remove((struct Node *)node);
- if(node->protocol) free(node->protocol);
+ if (node->protocol) lwc_string_unref(node->protocol);
FreeVec(node);
node = NULL;
}while(node=nnode);
@@ -91,7 +99,8 @@ BOOL ami_openurl_check_list(struct MinList *list, const char *url)
{
nnode=(struct ami_protocol *)GetSucc((struct Node *)node);
- if(!strncasecmp(url, node->protocol, strlen(node->protocol)))
+ if (!strncasecmp(url, lwc_string_data(node->protocol),
+ lwc_string_length(node->protocol)))
return TRUE;
}while(node=nnode);