Made some variables const which eliminated some casts

This commit is contained in:
Dan Fandrich 2008-09-02 17:41:20 +00:00
parent bbc002a505
commit 934708d950
6 changed files with 24 additions and 24 deletions

View File

@ -325,7 +325,7 @@ static char *memdup(const char *src, size_t buffer_length)
}
else
/* no length and a NULL src pointer! */
return strdup((char *)"");
return strdup("");
buffer = (char*)malloc(length+add);
if(!buffer)

View File

@ -1337,7 +1337,7 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
}
/* Setup the proxy-authorization header, if any */
result = http_output_auth(conn, (char *)"CONNECT", host_port, TRUE);
result = http_output_auth(conn, "CONNECT", host_port, TRUE);
if(CURLE_OK == result) {
char *host=(char *)"";
@ -2027,7 +2027,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
char *host = conn->host.name;
const char *te = ""; /* transfer-encoding */
char *ptr;
char *request;
const char *request;
Curl_HttpReq httpreq = data->set.httpreq;
char *addcookies = NULL;
curl_off_t included_body = 0;
@ -2066,23 +2066,23 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
request = data->set.str[STRING_CUSTOMREQUEST];
else {
if(data->set.opt_no_body)
request = (char *)"HEAD";
request = "HEAD";
else {
DEBUGASSERT((httpreq > HTTPREQ_NONE) && (httpreq < HTTPREQ_LAST));
switch(httpreq) {
case HTTPREQ_POST:
case HTTPREQ_POST_FORM:
request = (char *)"POST";
request = "POST";
break;
case HTTPREQ_PUT:
request = (char *)"PUT";
request = "PUT";
break;
default: /* this should never happen */
case HTTPREQ_GET:
request = (char *)"GET";
request = "GET";
break;
case HTTPREQ_HEAD:
request = (char *)"HEAD";
request = "HEAD";
break;
}
}

View File

@ -232,8 +232,8 @@ CURLcode Curl_output_digest(struct connectdata *conn,
struct timeval now;
char **allocuserpwd;
char *userp;
char *passwdp;
const char *userp;
const char *passwdp;
struct auth *authp;
struct SessionHandle *data = conn->data;
@ -276,10 +276,10 @@ CURLcode Curl_output_digest(struct connectdata *conn,
/* not set means empty */
if(!userp)
userp=(char *)"";
userp="";
if(!passwdp)
passwdp=(char *)"";
passwdp="";
if(!d->nonce) {
authp->done = FALSE;

View File

@ -101,7 +101,7 @@ get_gss_name(struct connectdata *conn, bool proxy, gss_name_t *server)
}
static void
log_gss_error(struct connectdata *conn, OM_uint32 error_status, char *prefix)
log_gss_error(struct connectdata *conn, OM_uint32 error_status, const char *prefix)
{
OM_uint32 maj_stat, min_stat;
OM_uint32 msg_ctx = 0;
@ -257,7 +257,7 @@ int Curl_input_negotiate(struct connectdata *conn, bool proxy,
if(GSS_ERROR(major_status)) {
/* Curl_cleanup_negotiate(conn->data) ??? */
log_gss_error(conn, minor_status,
(char *)"gss_init_sec_context() failed: ");
"gss_init_sec_context() failed: ");
return -1;
}

View File

@ -370,7 +370,7 @@ static void lm_resp(unsigned char *keys,
* Set up lanmanager hashed password
*/
static void mk_lm_hash(struct SessionHandle *data,
char *password,
const char *password,
unsigned char *lmbuffer /* 21 bytes */)
{
unsigned char pw[14];
@ -418,7 +418,7 @@ static void mk_lm_hash(struct SessionHandle *data,
}
#if USE_NTRESPONSES
static void utf8_to_unicode_le(unsigned char *dest, const char *src,
static void ascii_to_unicode_le(unsigned char *dest, const char *src,
size_t srclen)
{
size_t i;
@ -432,7 +432,7 @@ static void utf8_to_unicode_le(unsigned char *dest, const char *src,
* Set up nt hashed passwords
*/
static CURLcode mk_nt_hash(struct SessionHandle *data,
char *password,
const char *password,
unsigned char *ntbuffer /* 21 bytes */)
{
size_t len = strlen(password);
@ -440,7 +440,7 @@ static CURLcode mk_nt_hash(struct SessionHandle *data,
if(!pw)
return CURLE_OUT_OF_MEMORY;
utf8_to_unicode_le(pw, password, len);
ascii_to_unicode_le(pw, password, len);
#ifdef CURL_DOES_CONVERSIONS
/*
@ -524,8 +524,8 @@ CURLcode Curl_output_ntlm(struct connectdata *conn,
char **allocuserpwd;
/* point to the name and password for this */
char *userp;
char *passwdp;
const char *userp;
const char *passwdp;
/* point to the correct struct with this */
struct ntlmdata *ntlm;
struct auth *authp;
@ -551,10 +551,10 @@ CURLcode Curl_output_ntlm(struct connectdata *conn,
/* not set means empty */
if(!userp)
userp=(char *)"";
userp="";
if(!passwdp)
passwdp=(char *)"";
passwdp="";
#ifdef USE_WINDOWS_SSPI
if (s_hSecDll == NULL) {

View File

@ -2878,7 +2878,7 @@ static bool tld_check_name(struct SessionHandle *data,
char *uc_name = NULL;
int rc;
#ifndef CURL_DISABLE_VERBOSE_STRINGS
char *tld_errmsg = (char *)"<no msg>";
const char *tld_errmsg = "<no msg>";
#else
(void)data;
#endif
@ -2892,7 +2892,7 @@ static bool tld_check_name(struct SessionHandle *data,
#ifndef CURL_DISABLE_VERBOSE_STRINGS
#ifdef HAVE_TLD_STRERROR
if(rc != TLD_SUCCESS)
tld_errmsg = (char *)tld_strerror((Tld_rc)rc);
tld_errmsg = tld_strerror((Tld_rc)rc);
#endif
if(rc == TLD_INVALID)
infof(data, "WARNING: %s; pos %u = `%c'/0x%02X\n",