From 87ca206e13ab4245280e0208b46b7b4b6682d2c9 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Sun, 10 Jun 2007 18:08:22 +0000 Subject: Warning fixes. svn path=/trunk/netsurf/; revision=3332 --- content/fetch.c | 31 ++++++++++++++++--------------- content/fetch.h | 5 +++-- content/fetchers/fetch_curl.c | 26 +++++++++++++------------- 3 files changed, 32 insertions(+), 30 deletions(-) (limited to 'content') diff --git a/content/fetch.c b/content/fetch.c index e18893499..a81de56f9 100644 --- a/content/fetch.c +++ b/content/fetch.c @@ -255,7 +255,7 @@ struct fetch * fetch_start(const char *url, const char *referer, fetch->referer = 0; fetch->ops = 0; fetch->fetch_is_active = false; - + if (referer != NULL) { fetch->referer = strdup(referer); if (fetch->referer == NULL) @@ -276,33 +276,33 @@ struct fetch * fetch_start(const char *url, const char *referer, } fetcher = fetcher->next_fetcher; } - + if (fetch->ops == NULL) goto failed; - + /* Got a scheme fetcher, try and set up the fetch */ - fetch->fetcher_handle = + fetch->fetcher_handle = fetch->ops->setup_fetch(fetch, url, only_2xx, post_urlenc, post_multipart, verifiable, parent_url, (const char **)headers); - + if (fetch->fetcher_handle == NULL) goto failed; - + /* Rah, got it, so ref the fetcher. */ fetch_ref_fetcher(fetch->ops); - + /* these aren't needed past here */ if (ref1) { free(ref1); ref1 = 0; } - + if (ref2) { free(ref2); ref2 = 0; } - + /* Dump us in the queue and ask the queue to run. */ RING_INSERT(queue_ring, fetch); fetch_dispatch_jobs(); @@ -446,18 +446,18 @@ bool fetch_can_fetch(const char *url) const char *semi; size_t len; scheme_fetcher *fetcher = fetchers; - + if ((semi = strchr(url, ':')) == NULL) return false; len = semi - url; - + while (fetcher != NULL) { if (strlen(fetcher->scheme_name) == len && strncmp(fetcher->scheme_name, url, len) == 0) return true; fetcher = fetcher->next_fetcher; } - + return false; } @@ -498,9 +498,10 @@ const char *fetch_get_referer(struct fetch *fetch) } void -fetch_send_callback(fetch_msg msg, struct fetch *fetch, void *data, unsigned long size) +fetch_send_callback(fetch_msg msg, struct fetch *fetch, const void *data, + unsigned long size) { - LOG(("Fetcher sending callback. Fetch %p, fetcher %p data %p size %d", + LOG(("Fetcher sending callback. Fetch %p, fetcher %p data %p size %lu", fetch, fetch->fetcher_handle, data, size)); fetch->callback(msg, fetch->p, data, size); } @@ -525,7 +526,7 @@ fetch_can_be_freed(struct fetch *fetch) void fetch_set_http_code(struct fetch *fetch, long http_code) { - LOG(("Setting HTTP code to %d", http_code)); + LOG(("Setting HTTP code to %ld", http_code)); fetch->http_code = http_code; } diff --git a/content/fetch.h b/content/fetch.h index 348171d2c..819f29fa9 100644 --- a/content/fetch.h +++ b/content/fetch.h @@ -90,7 +90,7 @@ const char *fetch_get_referer(struct fetch *fetch); typedef bool (*fetcher_initialise)(const char *); typedef void* (*fetcher_setup_fetch)(struct fetch *, const char *, - bool, const char *, + bool, const char *, struct form_successful_control *, bool, const char *, const char **); typedef bool (*fetcher_start_fetch)(void *); @@ -108,7 +108,8 @@ bool fetch_add_fetcher(const char *scheme, fetcher_poll_fetcher poll_fetcher, fetcher_finalise finaliser); -void fetch_send_callback(fetch_msg msg, struct fetch *fetch, void *data, unsigned long size); +void fetch_send_callback(fetch_msg msg, struct fetch *fetch, + const void *data, unsigned long size); void fetch_can_be_freed(struct fetch *fetch); void fetch_set_http_code(struct fetch *fetch, long http_code); const char *fetch_get_referer_to_send(struct fetch *fetch); diff --git a/content/fetchers/fetch_curl.c b/content/fetchers/fetch_curl.c index 4103e18f1..96517b659 100644 --- a/content/fetchers/fetch_curl.c +++ b/content/fetchers/fetch_curl.c @@ -162,9 +162,9 @@ fetch_curl_setup(struct fetch *parent_fetch, const char *url, fetch = malloc(sizeof (*fetch)); if (!fetch) return 0; - + fetch->fetch_handle = parent_fetch; - + res = url_host(url, &host); if (res != URL_FUNC_OK) { /* we only fail memory exhaustion */ @@ -175,7 +175,7 @@ fetch_curl_setup(struct fetch *parent_fetch, const char *url, if (!host) goto failed; } - + LOG(("fetch %p, url '%s'", fetch, url)); /* construct a new fetch structure */ @@ -255,13 +255,13 @@ fetch_curl_setup(struct fetch *parent_fetch, const char *url, /* And add any headers specified by the caller */ for (i = 0; headers[i]; i++) { if (strncasecmp(headers[i], "If-Modified-Since:", 18) == 0) { - char *d = headers[i] + 18; + const char *d = headers[i] + 18; for (; *d && (*d == ' ' || *d == '\t'); d++) /* do nothing */; fetch->last_modified = curl_getdate(d, NULL); } else if (strncasecmp(headers[i], "If-None-Match:", 14) == 0) { - char *d = headers[i] + 14; + const char *d = headers[i] + 14; for (; *d && (*d == ' ' || *d == '\t' || *d == '"'); d++) /* do nothing */; @@ -758,7 +758,7 @@ static void fetch_curl_done(CURL *curl_handle, CURLcode result) #endif else if (error) fetch_send_callback(FETCH_ERROR, f->fetch_handle, fetch_error_buffer, 0); - + fetch_curl_stop(f); } @@ -1277,13 +1277,13 @@ fetch_curl_finalise(const char *scheme) /* All the fetchers have been finalised. */ LOG(("All cURL fetchers finalised, closing down cURL")); CURLMcode codem; - + curl_easy_cleanup(fetch_blank_curl); - + codem = curl_multi_cleanup(fetch_curl_multi); if (codem != CURLM_OK) LOG(("curl_multi_cleanup failed: ignoring")); - + curl_global_cleanup(); } } @@ -1299,7 +1299,7 @@ void register_curl_fetchers(void) CURLcode code; curl_version_info_data *data; int i; - + LOG(("curl_version %s", curl_version())); code = curl_global_init(CURL_GLOBAL_ALL); @@ -1318,7 +1318,7 @@ void register_curl_fetchers(void) if (!fetch_blank_curl) die("Failed to initialise the fetch module " "(curl_easy_init failed)."); - + #undef SETOPT #define SETOPT(option, value) \ code = curl_easy_setopt(fetch_blank_curl, option, value); \ @@ -1344,9 +1344,9 @@ void register_curl_fetchers(void) if (option_ca_bundle) SETOPT(CURLOPT_CAINFO, option_ca_bundle); - + /* cURL initialised okay, register the fetchers */ - + data = curl_version_info(CURLVERSION_NOW); for (i = 0; data->protocols[i]; i++) -- cgit v1.2.3