From 033b5d815a19a05441a99cdc744a6a8752d191cc Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sun, 21 Mar 2010 13:32:59 +0000 Subject: Move code which extracts the filename from a given path into frontend. svn path=/trunk/netsurf/; revision=10139 --- content/fetchers/fetch_curl.c | 35 +++-------------------------------- 1 file changed, 3 insertions(+), 32 deletions(-) (limited to 'content') diff --git a/content/fetchers/fetch_curl.c b/content/fetchers/fetch_curl.c index e11829b46..ca2d86845 100644 --- a/content/fetchers/fetch_curl.c +++ b/content/fetchers/fetch_curl.c @@ -1219,36 +1219,9 @@ fetch_curl_post_convert(struct form_successful_control *control) for (; control; control = control->next) { if (control->file) { char *leafname = 0; -#ifdef riscos - char *temp; - int leaflen; - - temp = strrchr(control->value, '.'); - if (!temp) - temp = control->value; /* already leafname */ - else - temp += 1; - - leaflen = strlen(temp); - - leafname = malloc(leaflen + 1); - if (!leafname) { - LOG(("malloc failed")); - continue; - } - memcpy(leafname, temp, leaflen + 1); - - /* and s/\//\./g */ - for (temp = leafname; *temp; temp++) - if (*temp == '/') - *temp = '.'; -#else - leafname = strrchr(control->value, '/') ; - if (!leafname) - leafname = control->value; - else - leafname += 1; -#endif + + leafname = filename_from_path(control->value); + /* We have to special case filenames of "", so curl * a) actually attempts the fetch and * b) doesn't attempt to open the file "" @@ -1288,9 +1261,7 @@ fetch_curl_post_convert(struct form_successful_control *control) control->value)); free(mimetype); } -#ifdef riscos free(leafname); -#endif } else { code = curl_formadd(&post, &last, -- cgit v1.2.3