diff options
Diffstat (limited to 'content')
-rw-r--r-- | content/dirlist.c | 9 | ||||
-rw-r--r-- | content/dirlist.h | 2 | ||||
-rw-r--r-- | content/fetchers/about.c | 1 | ||||
-rw-r--r-- | content/fetchers/file.c | 20 | ||||
-rw-r--r-- | content/fetchers/resource.c | 1 |
5 files changed, 18 insertions, 15 deletions
diff --git a/content/dirlist.c b/content/dirlist.c index 0c0e2aee2..1d7a67e1f 100644 --- a/content/dirlist.c +++ b/content/dirlist.c @@ -24,9 +24,12 @@ #include <string.h> #include <stdio.h> #include <stdlib.h> -#include "content/dirlist.h" + +#include "utils/nsurl.h" #include "utils/messages.h" +#include "content/dirlist.h" + static int dirlist_filesize_calculate(unsigned long *bytesize); static int dirlist_filesize_value(unsigned long bytesize); static char* dirlist_filesize_unit(unsigned long bytesize); @@ -262,7 +265,7 @@ bool dirlist_generate_headings(char *buffer, int buffer_length) * dirlist_generate_bottom() */ -bool dirlist_generate_row(bool even, bool directory, char *url, char *name, +bool dirlist_generate_row(bool even, bool directory, nsurl *url, char *name, const char *mimetype, long long size, char *date, char *time, char *buffer, int buffer_length) { @@ -288,7 +291,7 @@ bool dirlist_generate_row(bool even, bool directory, char *url, char *name, "\t<span class=\"date\">%s</span>\n" "\t<span class=\"time\">%s</span>\n" "</a>\n", - url, even ? "even" : "odd", + nsurl_access(url), even ? "even" : "odd", directory ? "dir" : "file", name, mimetype, size_string, unit, date, time); if (error < 0 || error >= buffer_length) diff --git a/content/dirlist.h b/content/dirlist.h index bf90ec6d4..687f50688 100644 --- a/content/dirlist.h +++ b/content/dirlist.h @@ -39,7 +39,7 @@ bool dirlist_generate_title(const char *title, char *buffer, int buffer_length); bool dirlist_generate_parent_link(const char *parent, char *buffer, int buffer_length); bool dirlist_generate_headings(char *buffer, int buffer_length); -bool dirlist_generate_row(bool even, bool directory, char *url, char *name, +bool dirlist_generate_row(bool even, bool directory, nsurl *url, char *name, const char *mimetype, long long size, char *date, char *time, char *buffer, int buffer_length); bool dirlist_generate_bottom(char *buffer, int buffer_length); diff --git a/content/fetchers/about.c b/content/fetchers/about.c index d6a8c202c..b2aeeb35e 100644 --- a/content/fetchers/about.c +++ b/content/fetchers/about.c @@ -44,7 +44,6 @@ #include "testament.h" #include "utils/config.h" -#include "content/dirlist.h" #include "content/fetch.h" #include "content/fetchers/about.h" #include "content/urldb.h" diff --git a/content/fetchers/file.c b/content/fetchers/file.c index 7e7229649..7834b2702 100644 --- a/content/fetchers/file.c +++ b/content/fetchers/file.c @@ -138,13 +138,14 @@ fetch_file_setup(struct fetch *fetchh, { struct fetch_file_context *ctx; int i; + nserror ret; ctx = calloc(1, sizeof(*ctx)); if (ctx == NULL) return NULL; - ctx->path = guit->fetch->url_to_path(nsurl_access(url)); - if (ctx->path == NULL) { + ret = guit->file->nsurl_to_path(url, &ctx->path); + if (ret != NSERROR_OK) { free(ctx); return NULL; } @@ -503,11 +504,11 @@ process_dir_ent(struct fetch_file_context *ctx, size_t buffer_len) { nserror ret; - char *path; /* url for list entries */ char *urlpath = NULL; /* buffer for leaf entry path */ struct stat ent_stat; /* stat result of leaf entry */ char datebuf[64]; /* buffer for date text */ char timebuf[64]; /* buffer for time text */ + nsurl *url; /* skip hidden files */ if (ent->d_name[0] == '.') { @@ -539,16 +540,17 @@ process_dir_ent(struct fetch_file_context *ctx, } } - if ((path = guit->fetch->path_to_url(urlpath)) == NULL) { + ret = guit->file->path_to_nsurl(urlpath, &url); + if (ret != NSERROR_OK) { free(urlpath); - return NSERROR_NOMEM; + return ret; } if (S_ISREG(ent_stat.st_mode)) { /* regular file */ dirlist_generate_row(even, false, - path, + url, ent->d_name, guit->fetch->filetype(urlpath), ent_stat.st_size, @@ -558,7 +560,7 @@ process_dir_ent(struct fetch_file_context *ctx, /* directory */ dirlist_generate_row(even, true, - path, + url, ent->d_name, messages_get("FileDirectory"), -1, @@ -568,7 +570,7 @@ process_dir_ent(struct fetch_file_context *ctx, /* something else */ dirlist_generate_row(even, false, - path, + url, ent->d_name, "", -1, @@ -576,7 +578,7 @@ process_dir_ent(struct fetch_file_context *ctx, buffer, buffer_len); } - free(path); + nsurl_unref(url); free(urlpath); return NSERROR_OK; diff --git a/content/fetchers/resource.c b/content/fetchers/resource.c index 4ce49a06b..664c45720 100644 --- a/content/fetchers/resource.c +++ b/content/fetchers/resource.c @@ -37,7 +37,6 @@ #include <libwapcaplet/libwapcaplet.h> #include "utils/config.h" -#include "content/dirlist.h" #include "content/fetch.h" #include "content/fetchers/resource.h" #include "content/urldb.h" |