diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2014-01-25 09:53:54 +0000 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2014-01-25 09:53:54 +0000 |
commit | 96e5368d34d960dd1aa71dcac81079f331adfab6 (patch) | |
tree | e7819fd60386df3ebb15a9b3ee6c335d4fbdb11f | |
parent | ae6874d3088a46a3d02c64ec7e466baaf03a991f (diff) | |
download | netsurf-96e5368d34d960dd1aa71dcac81079f331adfab6.tar.gz netsurf-96e5368d34d960dd1aa71dcac81079f331adfab6.tar.bz2 |
Use corestring.
-rw-r--r-- | desktop/download.c | 12 | ||||
-rw-r--r-- | utils/corestrings.c | 3 | ||||
-rw-r--r-- | utils/corestrings.h | 1 |
3 files changed, 6 insertions, 10 deletions
diff --git a/desktop/download.c b/desktop/download.c index 14390c78a..b5427b405 100644 --- a/desktop/download.c +++ b/desktop/download.c @@ -28,6 +28,7 @@ #include "desktop/download.h" #include "desktop/gui.h" #include "desktop/gui_factory.h" +#include "utils/corestrings.h" #include "utils/http.h" #include "utils/url.h" #include "utils/utils.h" @@ -114,26 +115,18 @@ static nserror download_context_process_headers(download_context *ctx) http_header = llcache_handle_get_header(ctx->llcache, "Content-Disposition"); if (http_header != NULL) { - lwc_string *filename; lwc_string *filename_value; http_content_disposition *disposition; - if (lwc_intern_string("filename", SLEN("filename"), - &filename) != lwc_error_ok) { - http_content_type_destroy(content_type); - return NSERROR_NOMEM; - } - error = http_parse_content_disposition(http_header, &disposition); if (error != NSERROR_OK) { - lwc_string_unref(filename); http_content_type_destroy(content_type); return error; } error = http_parameter_list_find_item(disposition->parameters, - filename, &filename_value); + corestring_lwc_filename, &filename_value); if (error == NSERROR_OK) { ctx->filename = download_parse_filename( lwc_string_data(filename_value)); @@ -141,7 +134,6 @@ static nserror download_context_process_headers(download_context *ctx) } http_content_disposition_destroy(disposition); - lwc_string_unref(filename); } ctx->mime_type = lwc_string_ref(content_type->media_type); diff --git a/utils/corestrings.c b/utils/corestrings.c index 47279c335..c51a38fd7 100644 --- a/utils/corestrings.c +++ b/utils/corestrings.c @@ -48,6 +48,7 @@ lwc_string *corestring_lwc_default; lwc_string *corestring_lwc_div; lwc_string *corestring_lwc_embed; lwc_string *corestring_lwc_file; +lwc_string *corestring_lwc_filename; lwc_string *corestring_lwc_font; lwc_string *corestring_lwc_frame; lwc_string *corestring_lwc_frameset; @@ -302,6 +303,7 @@ void corestrings_fini(void) CSS_LWC_STRING_UNREF(div); CSS_LWC_STRING_UNREF(embed); CSS_LWC_STRING_UNREF(file); + CSS_LWC_STRING_UNREF(filename); CSS_LWC_STRING_UNREF(font); CSS_LWC_STRING_UNREF(frame); CSS_LWC_STRING_UNREF(frameset); @@ -580,6 +582,7 @@ nserror corestrings_init(void) CSS_LWC_STRING_INTERN(div); CSS_LWC_STRING_INTERN(embed); CSS_LWC_STRING_INTERN(file); + CSS_LWC_STRING_INTERN(filename); CSS_LWC_STRING_INTERN(font); CSS_LWC_STRING_INTERN(frame); CSS_LWC_STRING_INTERN(frameset); diff --git a/utils/corestrings.h b/utils/corestrings.h index 78fcd1560..1f34ada6a 100644 --- a/utils/corestrings.h +++ b/utils/corestrings.h @@ -52,6 +52,7 @@ extern lwc_string *corestring_lwc_default; extern lwc_string *corestring_lwc_div; extern lwc_string *corestring_lwc_embed; extern lwc_string *corestring_lwc_file; +extern lwc_string *corestring_lwc_filename; extern lwc_string *corestring_lwc_font; extern lwc_string *corestring_lwc_frame; extern lwc_string *corestring_lwc_frameset; |