1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 23:58:49 -05:00

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 else
/* no length and a NULL src pointer! */ /* no length and a NULL src pointer! */
return strdup((char *)""); return strdup("");
buffer = (char*)malloc(length+add); buffer = (char*)malloc(length+add);
if(!buffer) if(!buffer)

View File

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

View File

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

View File

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

View File

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

View File

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