diff options
author | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2010-03-21 13:32:59 +0000 |
---|---|---|
committer | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2010-03-21 13:32:59 +0000 |
commit | 033b5d815a19a05441a99cdc744a6a8752d191cc (patch) | |
tree | ad0aadcb6bcfd10362fbe7f266906ecd9fa8fde3 /content/fetchers/fetch_curl.c | |
parent | 1f67fed782a2c20e5b8222ef5fb9867f036ff054 (diff) | |
download | netsurf-033b5d815a19a05441a99cdc744a6a8752d191cc.tar.gz netsurf-033b5d815a19a05441a99cdc744a6a8752d191cc.tar.bz2 |
Move code which extracts the filename from a given path into frontend.
svn path=/trunk/netsurf/; revision=10139
Diffstat (limited to 'content/fetchers/fetch_curl.c')
-rw-r--r-- | content/fetchers/fetch_curl.c | 35 |
1 files changed, 3 insertions, 32 deletions
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, |