Improve const-correctness of fetch_start

svn path=/trunk/netsurf/; revision=10342
This commit is contained in:
John Mark Bell 2010-04-10 17:13:53 +00:00
parent 342fe780c6
commit b0f1b7b170
5 changed files with 12 additions and 14 deletions

View File

@ -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;

View File

@ -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 *);

View File

@ -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;

View File

@ -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));

View File

@ -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)