summaryrefslogtreecommitdiff
path: root/framebuffer
diff options
context:
space:
mode:
Diffstat (limited to 'framebuffer')
-rw-r--r--framebuffer/fetch.c62
1 files changed, 2 insertions, 60 deletions
diff --git a/framebuffer/fetch.c b/framebuffer/fetch.c
index 6d97cfda7..b32a95168 100644
--- a/framebuffer/fetch.c
+++ b/framebuffer/fetch.c
@@ -26,66 +26,15 @@
#include <limits.h>
#include "utils/nsurl.h"
-#include "utils/url.h"
#include "utils/log.h"
#include "utils/filepath.h"
+#include "utils/file.h"
#include "desktop/gui.h"
#include "framebuffer/findfile.h"
#include "framebuffer/fetch.h"
-/**
- * Convert a pathname to a file: URL.
- *
- * \param path pathname
- * \return URL, allocated on heap, or NULL on failure
- */
-static char *path_to_url(const char *path)
-{
- int urllen;
- char *url;
-
- if (path == NULL)
- return NULL;
-
- urllen = strlen(path) + FILE_SCHEME_PREFIX_LEN + 1;
- url = malloc(urllen);
-
- if (*path == '/') {
- path++; /* file: paths are already absolute */
- }
-
- snprintf(url, urllen, "%s%s", FILE_SCHEME_PREFIX, path);
-
- return url;
-}
-
-/**
- * Convert a file: URL to a pathname.
- *
- * \param url a file: URL
- * \return pathname, allocated on heap, or NULL on failure
- */
-static char *url_to_path(const char *url)
-{
- char *path;
- char *respath;
- nserror res; /* result from url routines */
-
- res = url_path(url, &path);
- if (res != NSERROR_OK) {
- return NULL;
- }
-
- res = url_unescape(path, &respath);
- free(path);
- if (res != NSERROR_OK) {
- return NULL;
- }
-
- return respath;
-}
/**
* Translate resource to full url.
@@ -101,17 +50,12 @@ static char *url_to_path(const char *url)
static nsurl *get_resource_url(const char *path)
{
char buf[PATH_MAX];
- char *raw;
nsurl *url = NULL;
if (strcmp(path, "favicon.ico") == 0)
path = "favicon.png";
- raw = path_to_url(filepath_sfind(respaths, buf, path));
- if (raw != NULL) {
- nsurl_create(raw, &url);
- free(raw);
- }
+ netsurf_path_to_nsurl(filepath_sfind(respaths, buf, path), &url);
return url;
}
@@ -148,8 +92,6 @@ static const char *fetch_filetype(const char *unix_path)
/* table for fetch operations */
static struct gui_fetch_table fetch_table = {
.filetype = fetch_filetype,
- .path_to_url = path_to_url,
- .url_to_path = url_to_path,
.get_resource_url = get_resource_url,
};