Fixed some minor type mismatches and missing consts mainly found by splint.

This commit is contained in:
Dan Fandrich 2007-08-27 06:31:28 +00:00
parent 523767660c
commit 8cf0814a14
17 changed files with 71 additions and 68 deletions

View File

@ -481,7 +481,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
return_value = CURL_FORMADD_OPTION_TWICE; return_value = CURL_FORMADD_OPTION_TWICE;
else else
current_form->namelength = 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; break;
/* /*
@ -506,7 +506,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
return_value = CURL_FORMADD_OPTION_TWICE; return_value = CURL_FORMADD_OPTION_TWICE;
else else
current_form->contentslength = 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; break;
/* Get contents from a given file name */ /* Get contents from a given file name */
@ -514,7 +514,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
if (current_form->flags != 0) if (current_form->flags != 0)
return_value = CURL_FORMADD_OPTION_TWICE; return_value = CURL_FORMADD_OPTION_TWICE;
else { else {
char *filename = array_state? const char *filename = array_state?
array_value:va_arg(params, char *); array_value:va_arg(params, char *);
if (filename) { if (filename) {
current_form->value = strdup(filename); current_form->value = strdup(filename);
@ -533,7 +533,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
/* We upload a file */ /* We upload a file */
case CURLFORM_FILE: case CURLFORM_FILE:
{ {
char *filename = array_state?array_value: const char *filename = array_state?array_value:
va_arg(params, char *); va_arg(params, char *);
if (current_form->value) { if (current_form->value) {
@ -567,7 +567,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
case CURLFORM_BUFFER: case CURLFORM_BUFFER:
{ {
char *filename = array_state?array_value: const char *filename = array_state?array_value:
va_arg(params, char *); va_arg(params, char *);
if (current_form->value) { if (current_form->value) {
@ -615,12 +615,12 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
return_value = CURL_FORMADD_OPTION_TWICE; return_value = CURL_FORMADD_OPTION_TWICE;
else else
current_form->bufferlength = 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; break;
case CURLFORM_CONTENTTYPE: case CURLFORM_CONTENTTYPE:
{ {
char *contenttype = const char *contenttype =
array_state?array_value:va_arg(params, char *); array_state?array_value:va_arg(params, char *);
if (current_form->contenttype) { if (current_form->contenttype) {
if (current_form->flags & HTTPPOST_FILENAME) { if (current_form->flags & HTTPPOST_FILENAME) {
@ -666,7 +666,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
} }
case CURLFORM_FILENAME: case CURLFORM_FILENAME:
{ {
char *filename = array_state?array_value: const char *filename = array_state?array_value:
va_arg(params, char *); va_arg(params, char *);
if( current_form->showfilename ) if( current_form->showfilename )
return_value = CURL_FORMADD_OPTION_TWICE; return_value = CURL_FORMADD_OPTION_TWICE;
@ -1055,7 +1055,7 @@ static char *basename(char *path)
} }
#endif #endif
static char *strippath(char *fullfile) static char *strippath(const char *fullfile)
{ {
char *filename; char *filename;
char *base; char *base;

View File

@ -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 /* 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 * byte to a set of lines and possible just a piece of the last
* line */ * line */
int i; ssize_t i;
data->reqdata.keep.headerbytecount += gotbytes; 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 /* 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 * byte to a set of lines and possible just a piece of the last
* line */ * line */
int i; ssize_t i;
data->reqdata.keep.headerbytecount += gotbytes; data->reqdata.keep.headerbytecount += gotbytes;
@ -3340,7 +3340,7 @@ static CURLcode ftp_nb_type(struct connectdata *conn,
{ {
struct ftp_conn *ftpc = &conn->proto.ftpc; struct ftp_conn *ftpc = &conn->proto.ftpc;
CURLcode result; CURLcode result;
int want = ascii?'A':'I'; char want = ascii?'A':'I';
if (ftpc->transfertype == want) { if (ftpc->transfertype == want) {
state(conn, newstate); state(conn, newstate);
@ -3351,7 +3351,7 @@ static CURLcode ftp_nb_type(struct connectdata *conn,
state(conn, newstate); state(conn, newstate);
/* keep track of our current transfer type */ /* keep track of our current transfer type */
ftpc->transfertype = (char)want; ftpc->transfertype = want;
return CURLE_OK; return CURLE_OK;
} }

View File

@ -384,14 +384,14 @@ CURLcode Curl_http_auth_act(struct connectdata *conn)
*/ */
static CURLcode static CURLcode
Curl_http_output_auth(struct connectdata *conn, Curl_http_output_auth(struct connectdata *conn,
char *request, const char *request,
char *path, const char *path,
bool proxytunnel) /* TRUE if this is the request setting bool proxytunnel) /* TRUE if this is the request setting
up the proxy tunnel */ up the proxy tunnel */
{ {
CURLcode result = CURLE_OK; CURLcode result = CURLE_OK;
struct SessionHandle *data = conn->data; struct SessionHandle *data = conn->data;
char *auth=NULL; const char *auth=NULL;
struct auth *authhost; struct auth *authhost;
struct auth *authproxy; struct auth *authproxy;
@ -426,7 +426,7 @@ Curl_http_output_auth(struct connectdata *conn,
(conn->bits.tunnel_proxy == proxytunnel)) { (conn->bits.tunnel_proxy == proxytunnel)) {
#ifdef USE_NTLM #ifdef USE_NTLM
if(authproxy->picked == CURLAUTH_NTLM) { if(authproxy->picked == CURLAUTH_NTLM) {
auth=(char *)"NTLM"; auth="NTLM";
result = Curl_output_ntlm(conn, TRUE); result = Curl_output_ntlm(conn, TRUE);
if(result) if(result)
return result; return result;
@ -437,7 +437,7 @@ Curl_http_output_auth(struct connectdata *conn,
/* Basic */ /* Basic */
if(conn->bits.proxy_user_passwd && if(conn->bits.proxy_user_passwd &&
!checkheaders(data, "Proxy-authorization:")) { !checkheaders(data, "Proxy-authorization:")) {
auth=(char *)"Basic"; auth="Basic";
result = Curl_output_basic(conn, TRUE); result = Curl_output_basic(conn, TRUE);
if(result) if(result)
return result; return result;
@ -448,11 +448,11 @@ Curl_http_output_auth(struct connectdata *conn,
} }
#ifndef CURL_DISABLE_CRYPTO_AUTH #ifndef CURL_DISABLE_CRYPTO_AUTH
else if(authproxy->picked == CURLAUTH_DIGEST) { else if(authproxy->picked == CURLAUTH_DIGEST) {
auth=(char *)"Digest"; auth="Digest";
result = Curl_output_digest(conn, result = Curl_output_digest(conn,
TRUE, /* proxy */ TRUE, /* proxy */
(unsigned char *)request, (const unsigned char *)request,
(unsigned char *)path); (const unsigned char *)path);
if(result) if(result)
return result; return result;
} }
@ -485,7 +485,7 @@ Curl_http_output_auth(struct connectdata *conn,
if((authhost->picked == CURLAUTH_GSSNEGOTIATE) && if((authhost->picked == CURLAUTH_GSSNEGOTIATE) &&
data->state.negotiate.context && data->state.negotiate.context &&
!GSS_ERROR(data->state.negotiate.status)) { !GSS_ERROR(data->state.negotiate.status)) {
auth=(char *)"GSS-Negotiate"; auth="GSS-Negotiate";
result = Curl_output_negotiate(conn); result = Curl_output_negotiate(conn);
if (result) if (result)
return result; return result;
@ -495,7 +495,7 @@ Curl_http_output_auth(struct connectdata *conn,
#endif #endif
#ifdef USE_NTLM #ifdef USE_NTLM
if(authhost->picked == CURLAUTH_NTLM) { if(authhost->picked == CURLAUTH_NTLM) {
auth=(char *)"NTLM"; auth="NTLM";
result = Curl_output_ntlm(conn, FALSE); result = Curl_output_ntlm(conn, FALSE);
if(result) if(result)
return result; return result;
@ -505,11 +505,11 @@ Curl_http_output_auth(struct connectdata *conn,
{ {
#ifndef CURL_DISABLE_CRYPTO_AUTH #ifndef CURL_DISABLE_CRYPTO_AUTH
if(authhost->picked == CURLAUTH_DIGEST) { if(authhost->picked == CURLAUTH_DIGEST) {
auth=(char *)"Digest"; auth="Digest";
result = Curl_output_digest(conn, result = Curl_output_digest(conn,
FALSE, /* not a proxy */ FALSE, /* not a proxy */
(unsigned char *)request, (const unsigned char *)request,
(unsigned char *)path); (const unsigned char *)path);
if(result) if(result)
return result; return result;
} else } else
@ -517,7 +517,7 @@ Curl_http_output_auth(struct connectdata *conn,
if(authhost->picked == CURLAUTH_BASIC) { if(authhost->picked == CURLAUTH_BASIC) {
if(conn->bits.user_passwd && if(conn->bits.user_passwd &&
!checkheaders(data, "Authorization:")) { !checkheaders(data, "Authorization:")) {
auth=(char *)"Basic"; auth="Basic";
result = Curl_output_basic(conn, FALSE); result = Curl_output_basic(conn, FALSE);
if(result) if(result)
return result; return result;
@ -551,7 +551,7 @@ Curl_http_output_auth(struct connectdata *conn,
CURLcode Curl_http_input_auth(struct connectdata *conn, CURLcode Curl_http_input_auth(struct connectdata *conn,
int httpcode, int httpcode,
char *header) /* the first non-space */ const char *header) /* the first non-space */
{ {
/* /*
* This resource requires authentication * This resource requires authentication
@ -559,7 +559,7 @@ CURLcode Curl_http_input_auth(struct connectdata *conn,
struct SessionHandle *data = conn->data; struct SessionHandle *data = conn->data;
long *availp; long *availp;
char *start; const char *start;
struct auth *authp; struct auth *authp;
if (httpcode == 407) { if (httpcode == 407) {
@ -1118,7 +1118,7 @@ Curl_compareheader(const char *headerline, /* line to check */
CURLcode Curl_proxyCONNECT(struct connectdata *conn, CURLcode Curl_proxyCONNECT(struct connectdata *conn,
int sockindex, int sockindex,
char *hostname, const char *hostname,
unsigned short remote_port) unsigned short remote_port)
{ {
int subversion=0; int subversion=0;

View File

@ -31,7 +31,7 @@ bool Curl_compareheader(const char *headerline, /* line to check */
/* ftp can use this as well */ /* ftp can use this as well */
CURLcode Curl_proxyCONNECT(struct connectdata *conn, CURLcode Curl_proxyCONNECT(struct connectdata *conn,
int tunnelsocket, 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 */ /* protocol-specific functions set up to be called by the main engine */
CURLcode Curl_http(struct connectdata *conn, bool *done); 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 */ /* These functions are in http.c */
void Curl_http_auth_stage(struct SessionHandle *data, int stage); void Curl_http_auth_stage(struct SessionHandle *data, int stage);
CURLcode Curl_http_input_auth(struct connectdata *conn, 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); CURLcode Curl_http_auth_act(struct connectdata *conn);
int Curl_http_should_fail(struct connectdata *conn); int Curl_http_should_fail(struct connectdata *conn);

View File

@ -56,8 +56,8 @@ Proxy-Authenticate: Digest realm="testrealm", nonce="1053604598"
CURLdigest Curl_input_digest(struct connectdata *conn, CURLdigest Curl_input_digest(struct connectdata *conn,
bool proxy, bool proxy,
char *header) /* rest of the *-authenticate: const char *header) /* rest of the *-authenticate:
header */ header */
{ {
bool more = TRUE; bool more = TRUE;
char *token = NULL; char *token = NULL;
@ -212,8 +212,8 @@ static void md5_to_ascii(unsigned char *source, /* 16 bytes */
CURLcode Curl_output_digest(struct connectdata *conn, CURLcode Curl_output_digest(struct connectdata *conn,
bool proxy, bool proxy,
unsigned char *request, const unsigned char *request,
unsigned char *uripath) const unsigned char *uripath)
{ {
/* We have a Digest setup for this, use it! Now, to get all the details for /* 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 this sorted out, I must urge you dear friend to read up on the RFC2617

View File

@ -40,13 +40,13 @@ enum {
/* this is for digest header input */ /* this is for digest header input */
CURLdigest Curl_input_digest(struct connectdata *conn, CURLdigest Curl_input_digest(struct connectdata *conn,
bool proxy, char *header); bool proxy, const char *header);
/* this is for creating digest header output */ /* this is for creating digest header output */
CURLcode Curl_output_digest(struct connectdata *conn, CURLcode Curl_output_digest(struct connectdata *conn,
bool proxy, bool proxy,
unsigned char *request, const unsigned char *request,
unsigned char *uripath); const unsigned char *uripath);
void Curl_digest_cleanup_one(struct digestdata *dig); void Curl_digest_cleanup_one(struct digestdata *dig);
#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_CRYPTO_AUTH) #if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_CRYPTO_AUTH)

View File

@ -113,7 +113,7 @@ log_gss_error(struct connectdata *conn, OM_uint32 error_status, char *prefix)
infof(conn->data, "%s", buf); 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; struct negotiatedata *neg_ctx = &conn->data->state.negotiate;
OM_uint32 major_status, minor_status, minor_status2; OM_uint32 major_status, minor_status, minor_status2;

View File

@ -27,7 +27,7 @@
#ifdef HAVE_GSSAPI #ifdef HAVE_GSSAPI
/* this is for Negotiate header input */ /* 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 */ /* this is for creating Negotiate header output */
CURLcode Curl_output_negotiate(struct connectdata *conn); CURLcode Curl_output_negotiate(struct connectdata *conn);

View File

@ -218,8 +218,8 @@ static void print_hex(FILE *handle, const char *buf, size_t len)
CURLntlm Curl_input_ntlm(struct connectdata *conn, CURLntlm Curl_input_ntlm(struct connectdata *conn,
bool proxy, /* if proxy or not */ bool proxy, /* if proxy or not */
char *header) /* rest of the www-authenticate: const char *header) /* rest of the www-authenticate:
header */ header */
{ {
/* point to the correct struct with this */ /* point to the correct struct with this */
struct ntlmdata *ntlm; struct ntlmdata *ntlm;

View File

@ -33,7 +33,8 @@ typedef enum {
} CURLntlm; } CURLntlm;
/* this is for ntlm header input */ /* 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 */ /* this is for creating ntlm header output */
CURLcode Curl_output_ntlm(struct connectdata *conn, bool proxy); CURLcode Curl_output_ntlm(struct connectdata *conn, bool proxy);

View File

@ -122,7 +122,7 @@ static int blockread_all(struct connectdata *conn, /* connection data */
* Nonsupport "Identification Protocol (RFC1413)" * Nonsupport "Identification Protocol (RFC1413)"
*/ */
CURLcode Curl_SOCKS4(const char *proxy_name, CURLcode Curl_SOCKS4(const char *proxy_name,
char *hostname, const char *hostname,
int remote_port, int remote_port,
int sockindex, int sockindex,
struct connectdata *conn) struct connectdata *conn)
@ -329,7 +329,7 @@ CURLcode Curl_SOCKS4(const char *proxy_name,
*/ */
CURLcode Curl_SOCKS5(const char *proxy_name, CURLcode Curl_SOCKS5(const char *proxy_name,
const char *proxy_password, const char *proxy_password,
char *hostname, const char *hostname,
int remote_port, int remote_port,
int sockindex, int sockindex,
struct connectdata *conn) struct connectdata *conn)

View File

@ -28,7 +28,7 @@
* final destination server. * final destination server.
*/ */
CURLcode Curl_SOCKS4(const char *proxy_name, CURLcode Curl_SOCKS4(const char *proxy_name,
char *hostname, const char *hostname,
int remote_port, int remote_port,
int sockindex, int sockindex,
struct connectdata *conn); struct connectdata *conn);
@ -39,7 +39,7 @@ CURLcode Curl_SOCKS4(const char *proxy_name,
*/ */
CURLcode Curl_SOCKS5(const char *proxy_name, CURLcode Curl_SOCKS5(const char *proxy_name,
const char *proxy_password, const char *proxy_password,
char *hostname, const char *hostname,
int remote_port, int remote_port,
int sockindex, int sockindex,
struct connectdata *conn); struct connectdata *conn);

View File

@ -345,7 +345,7 @@ CURLcode Curl_ssl_addsessionid(struct connectdata *conn,
void *ssl_sessionid, void *ssl_sessionid,
size_t idsize) size_t idsize)
{ {
int i; long i;
struct SessionHandle *data=conn->data; /* the mother of all structs */ struct SessionHandle *data=conn->data; /* the mother of all structs */
struct curl_ssl_session *store = &data->state.session[0]; struct curl_ssl_session *store = &data->state.session[0];
long oldest_age=data->state.session[0].age; /* zero if unused */ 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) void Curl_ssl_close_all(struct SessionHandle *data)
{ {
#ifdef USE_SSL #ifdef USE_SSL
int i; long i;
/* kill the session ID cache */ /* kill the session ID cache */
if(data->state.session) { if(data->state.session) {
for(i=0; i< data->set.ssl.numsessions; i++) 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 -1;
} }
return (int)nread; return nread;
#else /* USE_SSL */ #else /* USE_SSL */
(void)conn; (void)conn;
@ -726,7 +726,7 @@ int Curl_ssl_check_cxn(struct connectdata *conn)
#endif /* USE_SSLEAY */ #endif /* USE_SSLEAY */
} }
bool Curl_ssl_data_pending(struct connectdata *conn, bool Curl_ssl_data_pending(const struct connectdata *conn,
int connindex) int connindex)
{ {
#ifdef USE_SSLEAY #ifdef USE_SSLEAY

View File

@ -71,7 +71,7 @@ int Curl_ssl_check_cxn(struct connectdata *conn);
CURLcode Curl_ssl_shutdown(struct connectdata *conn, int sockindex); 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); int connindex);
#if !defined(USE_SSL) && !defined(SSLGEN_C) #if !defined(USE_SSL) && !defined(SSLGEN_C)

View File

@ -858,9 +858,9 @@ int Curl_ossl_close_all(struct SessionHandle *data)
static int Curl_ASN1_UTCTIME_output(struct connectdata *conn, static int Curl_ASN1_UTCTIME_output(struct connectdata *conn,
const char *prefix, const char *prefix,
ASN1_UTCTIME *tm) const ASN1_UTCTIME *tm)
{ {
char *asn1_string; const char *asn1_string;
int gmt=FALSE; int gmt=FALSE;
int i; int i;
int year=0,month=0,day=0,hour=0,minute=0,second=0; 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; return 0;
i=tm->length; i=tm->length;
asn1_string=(char *)tm->data; asn1_string=(const char *)tm->data;
if(i < 10) if(i < 10)
return 1; return 1;
@ -929,7 +929,7 @@ static int Curl_ASN1_UTCTIME_output(struct connectdata *conn,
static int hostmatch(const char *hostname, const char *pattern) static int hostmatch(const char *hostname, const char *pattern)
{ {
while (1) { while (1) {
int c = *pattern++; char c = *pattern++;
if (c == '\0') if (c == '\0')
return (*hostname ? HOST_NOMATCH : HOST_MATCH); return (*hostname ? HOST_NOMATCH : HOST_MATCH);

View File

@ -268,7 +268,7 @@ CURLcode Curl_readrewind(struct connectdata *conn)
return CURLE_OK; 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 /* 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 */ 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)) { if((k->keepon & KEEP_WRITE) && (select_res & CURL_CSELECT_OUT)) {
/* write */ /* write */
int i, si; ssize_t i, si;
ssize_t bytes_written; ssize_t bytes_written;
bool writedone=TRUE; 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 * keeps track of. This function will only be called for connections that are
* in the proper state to have this information available. * 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 curl_socket_t *sock, /* points to numsocks number
of sockets */ of sockets */
int numsocks) int numsocks)
{ {
struct SessionHandle *data = conn->data; const struct SessionHandle *data = conn->data;
int bitmap = GETSOCK_BLANK; int bitmap = GETSOCK_BLANK;
int index = 0; unsigned index = 0;
if(numsocks < 2) if(numsocks < 2)
/* simple check but we might need two slots */ /* 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 * strlen_url() returns the length of the given URL if the spaces within the
* URL were properly URL encoded. * URL were properly URL encoded.
*/ */
static int strlen_url(char *url) static size_t strlen_url(const char *url)
{ {
char *ptr; const char *ptr;
int newlen=0; size_t newlen=0;
bool left=TRUE; /* left side of the ? */ bool left=TRUE; /* left side of the ? */
for(ptr=url; *ptr; ptr++) { for(ptr=url; *ptr; ptr++) {
switch(*ptr) { switch(*ptr) {
case '?': case '?':
left=FALSE; left=FALSE;
/* fall through */
default: default:
newlen++; newlen++;
break; 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 /* strcpy_url() copies a url to a output buffer and URL-encodes the spaces in
* the source URL accordingly. * 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 */ /* we must add this with whitespace-replacing */
bool left=TRUE; bool left=TRUE;
char *iptr; const char *iptr;
char *optr = output; char *optr = output;
for(iptr = url; /* read from here */ for(iptr = url; /* read from here */
*iptr; /* until zero byte */ *iptr; /* until zero byte */
@ -1996,6 +1997,7 @@ static void strcpy_url(char *output, char *url)
switch(*iptr) { switch(*iptr) {
case '?': case '?':
left=FALSE; left=FALSE;
/* fall through */
default: default:
*optr++=*iptr; *optr++=*iptr;
break; break;

View File

@ -28,7 +28,7 @@ CURLcode Curl_second_connect(struct connectdata *conn);
CURLcode Curl_posttransfer(struct SessionHandle *data); CURLcode Curl_posttransfer(struct SessionHandle *data);
CURLcode Curl_follow(struct SessionHandle *data, char *newurl, bool retry); CURLcode Curl_follow(struct SessionHandle *data, char *newurl, bool retry);
CURLcode Curl_readwrite(struct connectdata *conn, bool *done); 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, curl_socket_t *socks,
int numsocks); int numsocks);
CURLcode Curl_readwrite_init(struct connectdata *conn); CURLcode Curl_readwrite_init(struct connectdata *conn);