From b0f1b7b1704fb42675fff58a35a7ac1707bec2b2 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Sat, 10 Apr 2010 17:13:53 +0000 Subject: [PATCH] Improve const-correctness of fetch_start svn path=/trunk/netsurf/; revision=10342 --- content/fetch.c | 6 +++--- content/fetch.h | 6 +++--- content/fetchers/fetch_curl.c | 8 ++++---- content/fetchers/fetch_data.c | 2 +- content/llcache.c | 4 +--- 5 files changed, 12 insertions(+), 14 deletions(-) diff --git a/content/fetch.c b/content/fetch.c index 86671de46..02db40ba9 100644 --- a/content/fetch.c +++ b/content/fetch.c @@ -211,8 +211,8 @@ void fetch_unref_fetcher(scheme_fetcher *fetcher) struct fetch * fetch_start(const char *url, const char *referer, fetch_callback callback, void *p, bool only_2xx, const char *post_urlenc, - struct fetch_multipart_data *post_multipart, - bool verifiable, char *headers[]) + const struct fetch_multipart_data *post_multipart, + bool verifiable, const char *headers[]) { char *host; struct fetch *fetch; @@ -312,7 +312,7 @@ struct fetch * fetch_start(const char *url, const char *referer, /* Got a scheme fetcher, try and set up the fetch */ fetch->fetcher_handle = fetch->ops->setup_fetch(fetch, url, only_2xx, post_urlenc, - post_multipart, (const char **)headers); + post_multipart, headers); if (fetch->fetcher_handle == NULL) goto failed; diff --git a/content/fetch.h b/content/fetch.h index c872518c0..8bf59a17c 100644 --- a/content/fetch.h +++ b/content/fetch.h @@ -84,9 +84,9 @@ void fetch_init(void); struct fetch * fetch_start(const char *url, const char *referer, fetch_callback callback, void *p, bool only_2xx, const char *post_urlenc, - struct fetch_multipart_data *post_multipart, + const struct fetch_multipart_data *post_multipart, bool verifiable, - char *headers[]); + const char *headers[]); void fetch_abort(struct fetch *f); void fetch_poll(void); void fetch_quit(void); @@ -109,7 +109,7 @@ struct fetch_multipart_data *fetch_multipart_data_clone( typedef bool (*fetcher_initialise)(const char *); typedef void* (*fetcher_setup_fetch)(struct fetch *, const char *, bool, const char *, - struct fetch_multipart_data *, + const struct fetch_multipart_data *, const char **); typedef bool (*fetcher_start_fetch)(void *); typedef void (*fetcher_abort_fetch)(void *); diff --git a/content/fetchers/fetch_curl.c b/content/fetchers/fetch_curl.c index 62b8228d1..e3f3d492b 100644 --- a/content/fetchers/fetch_curl.c +++ b/content/fetchers/fetch_curl.c @@ -104,7 +104,7 @@ static bool fetch_curl_initialise(const char *scheme); static void fetch_curl_finalise(const char *scheme); static void * fetch_curl_setup(struct fetch *parent_fetch, const char *url, bool only_2xx, const char *post_urlenc, - struct fetch_multipart_data *post_multipart, + const struct fetch_multipart_data *post_multipart, const char **headers); static bool fetch_curl_start(void *vfetch); static bool fetch_curl_initiate_fetch(struct curl_fetch_info *fetch, @@ -132,7 +132,7 @@ static size_t fetch_curl_header(char *data, size_t size, size_t nmemb, void *_f); static bool fetch_curl_process_headers(struct curl_fetch_info *f); static struct curl_httppost *fetch_curl_post_convert( - struct fetch_multipart_data *control); + const struct fetch_multipart_data *control); static int fetch_curl_verify_callback(int preverify_ok, X509_STORE_CTX *x509_ctx); static int fetch_curl_cert_verify_callback(X509_STORE_CTX *x509_ctx, @@ -294,7 +294,7 @@ void fetch_curl_finalise(const char *scheme) void * fetch_curl_setup(struct fetch *parent_fetch, const char *url, bool only_2xx, const char *post_urlenc, - struct fetch_multipart_data *post_multipart, + const struct fetch_multipart_data *post_multipart, const char **headers) { char *host; @@ -1224,7 +1224,7 @@ bool fetch_curl_process_headers(struct curl_fetch_info *f) * struct curl_httppost for libcurl. */ struct curl_httppost * -fetch_curl_post_convert(struct fetch_multipart_data *control) +fetch_curl_post_convert(const struct fetch_multipart_data *control) { struct curl_httppost *post = 0, *last = 0; CURLFORMcode code; diff --git a/content/fetchers/fetch_data.c b/content/fetchers/fetch_data.c index 1790de56f..51fade815 100644 --- a/content/fetchers/fetch_data.c +++ b/content/fetchers/fetch_data.c @@ -77,7 +77,7 @@ static void fetch_data_finalise(const char *scheme) static void *fetch_data_setup(struct fetch *parent_fetch, const char *url, bool only_2xx, const char *post_urlenc, - struct fetch_multipart_data *post_multipart, + const struct fetch_multipart_data *post_multipart, const char **headers) { struct fetch_data_context *ctx = calloc(1, sizeof(*ctx)); diff --git a/content/llcache.c b/content/llcache.c index b15dfd1cb..177b2bd39 100644 --- a/content/llcache.c +++ b/content/llcache.c @@ -821,9 +821,7 @@ nserror llcache_object_fetch(llcache_object *object, uint32_t flags, nserror llcache_object_refetch(llcache_object *object) { const char *urlenc = NULL; - /** \todo Why is fetch_start's post_multipart parameter not const? */ struct fetch_multipart_data *multipart = NULL; - /** \todo Why is the headers parameter of fetch_start not const? */ char **headers = NULL; int header_idx = 0; @@ -895,7 +893,7 @@ nserror llcache_object_refetch(llcache_object *object) object->fetch.flags & LLCACHE_RETRIEVE_NO_ERROR_PAGES, urlenc, multipart, object->fetch.flags & LLCACHE_RETRIEVE_VERIFIABLE, - headers); + (const char **) headers); /* Clean up cache-control headers */ while (--header_idx >= 0)