aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Fandrich <dan@coneharvesters.com>2008-09-02 17:41:20 +0000
committerDan Fandrich <dan@coneharvesters.com>2008-09-02 17:41:20 +0000
commit934708d950617688c7d294ea1ab583667f383ab1 (patch)
tree5a8c9af0c4ae865717caacf14c20c69ad98ab5d0
parentbbc002a50575f7690fe67e23850e63bc8eb792f1 (diff)
Made some variables const which eliminated some casts
-rw-r--r--lib/formdata.c2
-rw-r--r--lib/http.c14
-rw-r--r--lib/http_digest.c8
-rw-r--r--lib/http_negotiate.c4
-rw-r--r--lib/http_ntlm.c16
-rw-r--r--lib/url.c4
6 files changed, 24 insertions, 24 deletions
diff --git a/lib/formdata.c b/lib/formdata.c
index c5b305a59..54eabb2f8 100644
--- a/lib/formdata.c
+++ b/lib/formdata.c
@@ -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)
diff --git a/lib/http.c b/lib/http.c
index fde46dd0e..ab25573bf 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -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;
}
}
diff --git a/lib/http_digest.c b/lib/http_digest.c
index 82096c3f7..92d44ada7 100644
--- a/lib/http_digest.c
+++ b/lib/http_digest.c
@@ -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;
diff --git a/lib/http_negotiate.c b/lib/http_negotiate.c
index 80c00a171..b3099a24a 100644
--- a/lib/http_negotiate.c
+++ b/lib/http_negotiate.c
@@ -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;
}
diff --git a/lib/http_ntlm.c b/lib/http_ntlm.c
index 8db10301d..5c1f575bc 100644
--- a/lib/http_ntlm.c
+++ b/lib/http_ntlm.c
@@ -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) {
diff --git a/lib/url.c b/lib/url.c
index da757a377..57ffffe53 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -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",