summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDan Fandrich <dan@coneharvesters.com>2007-08-27 06:31:28 +0000
committerDan Fandrich <dan@coneharvesters.com>2007-08-27 06:31:28 +0000
commit8cf0814a143d99de813fbd1653b785252b4c58a6 (patch)
treeea8aac5e7a720e0a6147c69e7b58cd460c82c14a /lib
parent523767660c05cf359091694fcaccb763ebb7b2d7 (diff)
downloadcurl-8cf0814a143d99de813fbd1653b785252b4c58a6.tar.gz
Fixed some minor type mismatches and missing consts mainly found by splint.
Diffstat (limited to 'lib')
-rw-r--r--lib/formdata.c18
-rw-r--r--lib/ftp.c8
-rw-r--r--lib/http.c34
-rw-r--r--lib/http.h4
-rw-r--r--lib/http_digest.c8
-rw-r--r--lib/http_digest.h6
-rw-r--r--lib/http_negotiate.c2
-rw-r--r--lib/http_negotiate.h2
-rw-r--r--lib/http_ntlm.c4
-rw-r--r--lib/http_ntlm.h3
-rw-r--r--lib/socks.c4
-rw-r--r--lib/socks.h4
-rw-r--r--lib/sslgen.c8
-rw-r--r--lib/sslgen.h2
-rw-r--r--lib/ssluse.c8
-rw-r--r--lib/transfer.c22
-rw-r--r--lib/transfer.h2
17 files changed, 71 insertions, 68 deletions
diff --git a/lib/formdata.c b/lib/formdata.c
index e4d0922bb..64414f57b 100644
--- a/lib/formdata.c
+++ b/lib/formdata.c
@@ -481,7 +481,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
return_value = CURL_FORMADD_OPTION_TWICE;
else
current_form->namelength =
- array_state?(long)array_value:(long)va_arg(params, long);
+ array_state?(size_t)array_value:(size_t)va_arg(params, long);
break;
/*
@@ -506,7 +506,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
return_value = CURL_FORMADD_OPTION_TWICE;
else
current_form->contentslength =
- array_state?(long)array_value:va_arg(params, long);
+ array_state?(size_t)array_value:(size_t)va_arg(params, long);
break;
/* Get contents from a given file name */
@@ -514,7 +514,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
if (current_form->flags != 0)
return_value = CURL_FORMADD_OPTION_TWICE;
else {
- char *filename = array_state?
+ const char *filename = array_state?
array_value:va_arg(params, char *);
if (filename) {
current_form->value = strdup(filename);
@@ -533,7 +533,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
/* We upload a file */
case CURLFORM_FILE:
{
- char *filename = array_state?array_value:
+ const char *filename = array_state?array_value:
va_arg(params, char *);
if (current_form->value) {
@@ -567,7 +567,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
case CURLFORM_BUFFER:
{
- char *filename = array_state?array_value:
+ const char *filename = array_state?array_value:
va_arg(params, char *);
if (current_form->value) {
@@ -615,12 +615,12 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
return_value = CURL_FORMADD_OPTION_TWICE;
else
current_form->bufferlength =
- array_state?(long)array_value:va_arg(params, long);
+ array_state?(size_t)array_value:(size_t)va_arg(params, long);
break;
case CURLFORM_CONTENTTYPE:
{
- char *contenttype =
+ const char *contenttype =
array_state?array_value:va_arg(params, char *);
if (current_form->contenttype) {
if (current_form->flags & HTTPPOST_FILENAME) {
@@ -666,7 +666,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
}
case CURLFORM_FILENAME:
{
- char *filename = array_state?array_value:
+ const char *filename = array_state?array_value:
va_arg(params, char *);
if( current_form->showfilename )
return_value = CURL_FORMADD_OPTION_TWICE;
@@ -1055,7 +1055,7 @@ static char *basename(char *path)
}
#endif
-static char *strippath(char *fullfile)
+static char *strippath(const char *fullfile)
{
char *filename;
char *base;
diff --git a/lib/ftp.c b/lib/ftp.c
index 7d00b7ccf..3bdfaff33 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -374,7 +374,7 @@ static CURLcode ftp_readresp(curl_socket_t sockfd,
/* we got a whole chunk of data, which can be anything from one
* byte to a set of lines and possible just a piece of the last
* line */
- int i;
+ ssize_t i;
data->reqdata.keep.headerbytecount += gotbytes;
@@ -661,7 +661,7 @@ CURLcode Curl_GetFTPResponse(ssize_t *nreadp, /* return number of bytes read */
/* we got a whole chunk of data, which can be anything from one
* byte to a set of lines and possible just a piece of the last
* line */
- int i;
+ ssize_t i;
data->reqdata.keep.headerbytecount += gotbytes;
@@ -3340,7 +3340,7 @@ static CURLcode ftp_nb_type(struct connectdata *conn,
{
struct ftp_conn *ftpc = &conn->proto.ftpc;
CURLcode result;
- int want = ascii?'A':'I';
+ char want = ascii?'A':'I';
if (ftpc->transfertype == want) {
state(conn, newstate);
@@ -3351,7 +3351,7 @@ static CURLcode ftp_nb_type(struct connectdata *conn,
state(conn, newstate);
/* keep track of our current transfer type */
- ftpc->transfertype = (char)want;
+ ftpc->transfertype = want;
return CURLE_OK;
}
diff --git a/lib/http.c b/lib/http.c
index 715031658..2938c37ca 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -384,14 +384,14 @@ CURLcode Curl_http_auth_act(struct connectdata *conn)
*/
static CURLcode
Curl_http_output_auth(struct connectdata *conn,
- char *request,
- char *path,
+ const char *request,
+ const char *path,
bool proxytunnel) /* TRUE if this is the request setting
up the proxy tunnel */
{
CURLcode result = CURLE_OK;
struct SessionHandle *data = conn->data;
- char *auth=NULL;
+ const char *auth=NULL;
struct auth *authhost;
struct auth *authproxy;
@@ -426,7 +426,7 @@ Curl_http_output_auth(struct connectdata *conn,
(conn->bits.tunnel_proxy == proxytunnel)) {
#ifdef USE_NTLM
if(authproxy->picked == CURLAUTH_NTLM) {
- auth=(char *)"NTLM";
+ auth="NTLM";
result = Curl_output_ntlm(conn, TRUE);
if(result)
return result;
@@ -437,7 +437,7 @@ Curl_http_output_auth(struct connectdata *conn,
/* Basic */
if(conn->bits.proxy_user_passwd &&
!checkheaders(data, "Proxy-authorization:")) {
- auth=(char *)"Basic";
+ auth="Basic";
result = Curl_output_basic(conn, TRUE);
if(result)
return result;
@@ -448,11 +448,11 @@ Curl_http_output_auth(struct connectdata *conn,
}
#ifndef CURL_DISABLE_CRYPTO_AUTH
else if(authproxy->picked == CURLAUTH_DIGEST) {
- auth=(char *)"Digest";
+ auth="Digest";
result = Curl_output_digest(conn,
TRUE, /* proxy */
- (unsigned char *)request,
- (unsigned char *)path);
+ (const unsigned char *)request,
+ (const unsigned char *)path);
if(result)
return result;
}
@@ -485,7 +485,7 @@ Curl_http_output_auth(struct connectdata *conn,
if((authhost->picked == CURLAUTH_GSSNEGOTIATE) &&
data->state.negotiate.context &&
!GSS_ERROR(data->state.negotiate.status)) {
- auth=(char *)"GSS-Negotiate";
+ auth="GSS-Negotiate";
result = Curl_output_negotiate(conn);
if (result)
return result;
@@ -495,7 +495,7 @@ Curl_http_output_auth(struct connectdata *conn,
#endif
#ifdef USE_NTLM
if(authhost->picked == CURLAUTH_NTLM) {
- auth=(char *)"NTLM";
+ auth="NTLM";
result = Curl_output_ntlm(conn, FALSE);
if(result)
return result;
@@ -505,11 +505,11 @@ Curl_http_output_auth(struct connectdata *conn,
{
#ifndef CURL_DISABLE_CRYPTO_AUTH
if(authhost->picked == CURLAUTH_DIGEST) {
- auth=(char *)"Digest";
+ auth="Digest";
result = Curl_output_digest(conn,
FALSE, /* not a proxy */
- (unsigned char *)request,
- (unsigned char *)path);
+ (const unsigned char *)request,
+ (const unsigned char *)path);
if(result)
return result;
} else
@@ -517,7 +517,7 @@ Curl_http_output_auth(struct connectdata *conn,
if(authhost->picked == CURLAUTH_BASIC) {
if(conn->bits.user_passwd &&
!checkheaders(data, "Authorization:")) {
- auth=(char *)"Basic";
+ auth="Basic";
result = Curl_output_basic(conn, FALSE);
if(result)
return result;
@@ -551,7 +551,7 @@ Curl_http_output_auth(struct connectdata *conn,
CURLcode Curl_http_input_auth(struct connectdata *conn,
int httpcode,
- char *header) /* the first non-space */
+ const char *header) /* the first non-space */
{
/*
* This resource requires authentication
@@ -559,7 +559,7 @@ CURLcode Curl_http_input_auth(struct connectdata *conn,
struct SessionHandle *data = conn->data;
long *availp;
- char *start;
+ const char *start;
struct auth *authp;
if (httpcode == 407) {
@@ -1118,7 +1118,7 @@ Curl_compareheader(const char *headerline, /* line to check */
CURLcode Curl_proxyCONNECT(struct connectdata *conn,
int sockindex,
- char *hostname,
+ const char *hostname,
unsigned short remote_port)
{
int subversion=0;
diff --git a/lib/http.h b/lib/http.h
index cd75f0802..0b8f8b63e 100644
--- a/lib/http.h
+++ b/lib/http.h
@@ -31,7 +31,7 @@ bool Curl_compareheader(const char *headerline, /* line to check */
/* ftp can use this as well */
CURLcode Curl_proxyCONNECT(struct connectdata *conn,
int tunnelsocket,
- char *hostname, unsigned short remote_port);
+ const char *hostname, unsigned short remote_port);
/* protocol-specific functions set up to be called by the main engine */
CURLcode Curl_http(struct connectdata *conn, bool *done);
@@ -50,7 +50,7 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn, char *datap,
/* These functions are in http.c */
void Curl_http_auth_stage(struct SessionHandle *data, int stage);
CURLcode Curl_http_input_auth(struct connectdata *conn,
- int httpcode, char *header);
+ int httpcode, const char *header);
CURLcode Curl_http_auth_act(struct connectdata *conn);
int Curl_http_should_fail(struct connectdata *conn);
diff --git a/lib/http_digest.c b/lib/http_digest.c
index 7338ce72a..5afabc7e6 100644
--- a/lib/http_digest.c
+++ b/lib/http_digest.c
@@ -56,8 +56,8 @@ Proxy-Authenticate: Digest realm="testrealm", nonce="1053604598"
CURLdigest Curl_input_digest(struct connectdata *conn,
bool proxy,
- char *header) /* rest of the *-authenticate:
- header */
+ const char *header) /* rest of the *-authenticate:
+ header */
{
bool more = TRUE;
char *token = NULL;
@@ -212,8 +212,8 @@ static void md5_to_ascii(unsigned char *source, /* 16 bytes */
CURLcode Curl_output_digest(struct connectdata *conn,
bool proxy,
- unsigned char *request,
- unsigned char *uripath)
+ const unsigned char *request,
+ const unsigned char *uripath)
{
/* We have a Digest setup for this, use it! Now, to get all the details for
this sorted out, I must urge you dear friend to read up on the RFC2617
diff --git a/lib/http_digest.h b/lib/http_digest.h
index 6cf025975..c83cb1e3c 100644
--- a/lib/http_digest.h
+++ b/lib/http_digest.h
@@ -40,13 +40,13 @@ enum {
/* this is for digest header input */
CURLdigest Curl_input_digest(struct connectdata *conn,
- bool proxy, char *header);
+ bool proxy, const char *header);
/* this is for creating digest header output */
CURLcode Curl_output_digest(struct connectdata *conn,
bool proxy,
- unsigned char *request,
- unsigned char *uripath);
+ const unsigned char *request,
+ const unsigned char *uripath);
void Curl_digest_cleanup_one(struct digestdata *dig);
#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_CRYPTO_AUTH)
diff --git a/lib/http_negotiate.c b/lib/http_negotiate.c
index ac93413cf..f504c12d8 100644
--- a/lib/http_negotiate.c
+++ b/lib/http_negotiate.c
@@ -113,7 +113,7 @@ log_gss_error(struct connectdata *conn, OM_uint32 error_status, char *prefix)
infof(conn->data, "%s", buf);
}
-int Curl_input_negotiate(struct connectdata *conn, char *header)
+int Curl_input_negotiate(struct connectdata *conn, const char *header)
{
struct negotiatedata *neg_ctx = &conn->data->state.negotiate;
OM_uint32 major_status, minor_status, minor_status2;
diff --git a/lib/http_negotiate.h b/lib/http_negotiate.h
index ce0d083f9..e0507013f 100644
--- a/lib/http_negotiate.h
+++ b/lib/http_negotiate.h
@@ -27,7 +27,7 @@
#ifdef HAVE_GSSAPI
/* this is for Negotiate header input */
-int Curl_input_negotiate(struct connectdata *conn, char *header);
+int Curl_input_negotiate(struct connectdata *conn, const char *header);
/* this is for creating Negotiate header output */
CURLcode Curl_output_negotiate(struct connectdata *conn);
diff --git a/lib/http_ntlm.c b/lib/http_ntlm.c
index e50ace100..2dda4d069 100644
--- a/lib/http_ntlm.c
+++ b/lib/http_ntlm.c
@@ -218,8 +218,8 @@ static void print_hex(FILE *handle, const char *buf, size_t len)
CURLntlm Curl_input_ntlm(struct connectdata *conn,
bool proxy, /* if proxy or not */
- char *header) /* rest of the www-authenticate:
- header */
+ const char *header) /* rest of the www-authenticate:
+ header */
{
/* point to the correct struct with this */
struct ntlmdata *ntlm;
diff --git a/lib/http_ntlm.h b/lib/http_ntlm.h
index 265a912b4..40a0c9b5d 100644
--- a/lib/http_ntlm.h
+++ b/lib/http_ntlm.h
@@ -33,7 +33,8 @@ typedef enum {
} CURLntlm;
/* this is for ntlm header input */
-CURLntlm Curl_input_ntlm(struct connectdata *conn, bool proxy, char *header);
+CURLntlm Curl_input_ntlm(struct connectdata *conn, bool proxy,
+ const char *header);
/* this is for creating ntlm header output */
CURLcode Curl_output_ntlm(struct connectdata *conn, bool proxy);
diff --git a/lib/socks.c b/lib/socks.c
index e1ad86cc0..9dec1bd22 100644
--- a/lib/socks.c
+++ b/lib/socks.c
@@ -122,7 +122,7 @@ static int blockread_all(struct connectdata *conn, /* connection data */
* Nonsupport "Identification Protocol (RFC1413)"
*/
CURLcode Curl_SOCKS4(const char *proxy_name,
- char *hostname,
+ const char *hostname,
int remote_port,
int sockindex,
struct connectdata *conn)
@@ -329,7 +329,7 @@ CURLcode Curl_SOCKS4(const char *proxy_name,
*/
CURLcode Curl_SOCKS5(const char *proxy_name,
const char *proxy_password,
- char *hostname,
+ const char *hostname,
int remote_port,
int sockindex,
struct connectdata *conn)
diff --git a/lib/socks.h b/lib/socks.h
index dfe5cb4f1..8da142fbd 100644
--- a/lib/socks.h
+++ b/lib/socks.h
@@ -28,7 +28,7 @@
* final destination server.
*/
CURLcode Curl_SOCKS4(const char *proxy_name,
- char *hostname,
+ const char *hostname,
int remote_port,
int sockindex,
struct connectdata *conn);
@@ -39,7 +39,7 @@ CURLcode Curl_SOCKS4(const char *proxy_name,
*/
CURLcode Curl_SOCKS5(const char *proxy_name,
const char *proxy_password,
- char *hostname,
+ const char *hostname,
int remote_port,
int sockindex,
struct connectdata *conn);
diff --git a/lib/sslgen.c b/lib/sslgen.c
index 90af86053..3549232ab 100644
--- a/lib/sslgen.c
+++ b/lib/sslgen.c
@@ -345,7 +345,7 @@ CURLcode Curl_ssl_addsessionid(struct connectdata *conn,
void *ssl_sessionid,
size_t idsize)
{
- int i;
+ long i;
struct SessionHandle *data=conn->data; /* the mother of all structs */
struct curl_ssl_session *store = &data->state.session[0];
long oldest_age=data->state.session[0].age; /* zero if unused */
@@ -395,7 +395,7 @@ CURLcode Curl_ssl_addsessionid(struct connectdata *conn,
void Curl_ssl_close_all(struct SessionHandle *data)
{
#ifdef USE_SSL
- int i;
+ long i;
/* kill the session ID cache */
if(data->state.session) {
for(i=0; i< data->set.ssl.numsessions; i++)
@@ -632,7 +632,7 @@ ssize_t Curl_ssl_recv(struct connectdata *conn, /* connection data */
return -1;
}
- return (int)nread;
+ return nread;
#else /* USE_SSL */
(void)conn;
@@ -726,7 +726,7 @@ int Curl_ssl_check_cxn(struct connectdata *conn)
#endif /* USE_SSLEAY */
}
-bool Curl_ssl_data_pending(struct connectdata *conn,
+bool Curl_ssl_data_pending(const struct connectdata *conn,
int connindex)
{
#ifdef USE_SSLEAY
diff --git a/lib/sslgen.h b/lib/sslgen.h
index 70bd7c562..391b8f33e 100644
--- a/lib/sslgen.h
+++ b/lib/sslgen.h
@@ -71,7 +71,7 @@ int Curl_ssl_check_cxn(struct connectdata *conn);
CURLcode Curl_ssl_shutdown(struct connectdata *conn, int sockindex);
-bool Curl_ssl_data_pending(struct connectdata *conn,
+bool Curl_ssl_data_pending(const struct connectdata *conn,
int connindex);
#if !defined(USE_SSL) && !defined(SSLGEN_C)
diff --git a/lib/ssluse.c b/lib/ssluse.c
index acaf9612d..3aea2dee9 100644
--- a/lib/ssluse.c
+++ b/lib/ssluse.c
@@ -858,9 +858,9 @@ int Curl_ossl_close_all(struct SessionHandle *data)
static int Curl_ASN1_UTCTIME_output(struct connectdata *conn,
const char *prefix,
- ASN1_UTCTIME *tm)
+ const ASN1_UTCTIME *tm)
{
- char *asn1_string;
+ const char *asn1_string;
int gmt=FALSE;
int i;
int year=0,month=0,day=0,hour=0,minute=0,second=0;
@@ -874,7 +874,7 @@ static int Curl_ASN1_UTCTIME_output(struct connectdata *conn,
return 0;
i=tm->length;
- asn1_string=(char *)tm->data;
+ asn1_string=(const char *)tm->data;
if(i < 10)
return 1;
@@ -929,7 +929,7 @@ static int Curl_ASN1_UTCTIME_output(struct connectdata *conn,
static int hostmatch(const char *hostname, const char *pattern)
{
while (1) {
- int c = *pattern++;
+ char c = *pattern++;
if (c == '\0')
return (*hostname ? HOST_NOMATCH : HOST_MATCH);
diff --git a/lib/transfer.c b/lib/transfer.c
index de1e18640..0fb21c528 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -268,7 +268,7 @@ CURLcode Curl_readrewind(struct connectdata *conn)
return CURLE_OK;
}
-static int data_pending(struct connectdata *conn)
+static int data_pending(const struct connectdata *conn)
{
/* in the case of libssh2, we can never be really sure that we have emptied
its internal buffers so we MUST always try until we get EAGAIN back */
@@ -1377,7 +1377,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
if((k->keepon & KEEP_WRITE) && (select_res & CURL_CSELECT_OUT)) {
/* write */
- int i, si;
+ ssize_t i, si;
ssize_t bytes_written;
bool writedone=TRUE;
@@ -1743,14 +1743,14 @@ void Curl_pre_readwrite(struct connectdata *conn)
* keeps track of. This function will only be called for connections that are
* in the proper state to have this information available.
*/
-int Curl_single_getsock(struct connectdata *conn,
+int Curl_single_getsock(const struct connectdata *conn,
curl_socket_t *sock, /* points to numsocks number
of sockets */
int numsocks)
{
- struct SessionHandle *data = conn->data;
+ const struct SessionHandle *data = conn->data;
int bitmap = GETSOCK_BLANK;
- int index = 0;
+ unsigned index = 0;
if(numsocks < 2)
/* simple check but we might need two slots */
@@ -1957,16 +1957,17 @@ CURLcode Curl_posttransfer(struct SessionHandle *data)
* strlen_url() returns the length of the given URL if the spaces within the
* URL were properly URL encoded.
*/
-static int strlen_url(char *url)
+static size_t strlen_url(const char *url)
{
- char *ptr;
- int newlen=0;
+ const char *ptr;
+ size_t newlen=0;
bool left=TRUE; /* left side of the ? */
for(ptr=url; *ptr; ptr++) {
switch(*ptr) {
case '?':
left=FALSE;
+ /* fall through */
default:
newlen++;
break;
@@ -1984,11 +1985,11 @@ static int strlen_url(char *url)
/* strcpy_url() copies a url to a output buffer and URL-encodes the spaces in
* the source URL accordingly.
*/
-static void strcpy_url(char *output, char *url)
+static void strcpy_url(char *output, const char *url)
{
/* we must add this with whitespace-replacing */
bool left=TRUE;
- char *iptr;
+ const char *iptr;
char *optr = output;
for(iptr = url; /* read from here */
*iptr; /* until zero byte */
@@ -1996,6 +1997,7 @@ static void strcpy_url(char *output, char *url)
switch(*iptr) {
case '?':
left=FALSE;
+ /* fall through */
default:
*optr++=*iptr;
break;
diff --git a/lib/transfer.h b/lib/transfer.h
index 7a08b334e..a2fcd11e2 100644
--- a/lib/transfer.h
+++ b/lib/transfer.h
@@ -28,7 +28,7 @@ CURLcode Curl_second_connect(struct connectdata *conn);
CURLcode Curl_posttransfer(struct SessionHandle *data);
CURLcode Curl_follow(struct SessionHandle *data, char *newurl, bool retry);
CURLcode Curl_readwrite(struct connectdata *conn, bool *done);
-int Curl_single_getsock(struct connectdata *conn,
+int Curl_single_getsock(const struct connectdata *conn,
curl_socket_t *socks,
int numsocks);
CURLcode Curl_readwrite_init(struct connectdata *conn);