Warning fixes.

svn path=/trunk/netsurf/; revision=3332
This commit is contained in:
John Mark Bell 2007-06-10 18:08:22 +00:00
parent e6d754cc96
commit 87ca206e13
4 changed files with 49 additions and 39 deletions

View File

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

View File

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

View File

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

View File

@ -8,10 +8,11 @@
#include <sys/utsname.h>
#include <stdio.h>
#include <stdlib.h>
#include "useragent.h"
#include "desktop/netsurf.h"
#include "utils/log.h"
#include "utils/useragent.h"
static const char *core_user_agent_string = NULL;
@ -27,6 +28,7 @@ build_user_agent(void)
struct utsname un;
const char *sysname = "Unknown";
const char *machine = "Unknown";
char *ua_string;
int len;
if (uname(&un) == 0) {
@ -37,15 +39,21 @@ build_user_agent(void)
len = snprintf(NULL, 0, NETSURF_UA_FORMAT_STRING,
netsurf_version_major,
netsurf_version_minor,
un.sysname,
un.machine);
core_user_agent_string = malloc(len + 1);
snprintf(core_user_agent_string, len + 1,
sysname,
machine);
ua_string = malloc(len + 1);
if (!ua_string) {
/** \todo this needs handling better */
return;
}
snprintf(ua_string, len + 1,
NETSURF_UA_FORMAT_STRING,
netsurf_version_major,
netsurf_version_minor,
un.sysname,
un.machine);
sysname,
machine);
core_user_agent_string = ua_string;
LOG(("Built user agent \"%s\"", core_user_agent_string));
}