]> granicus.if.org Git - curl/commitdiff
Made some variables const which eliminated some casts
authorDan Fandrich <dan@coneharvesters.com>
Tue, 2 Sep 2008 17:41:20 +0000 (17:41 +0000)
committerDan Fandrich <dan@coneharvesters.com>
Tue, 2 Sep 2008 17:41:20 +0000 (17:41 +0000)
lib/formdata.c
lib/http.c
lib/http_digest.c
lib/http_negotiate.c
lib/http_ntlm.c
lib/url.c

index c5b305a5998fa5e70c311e499f14205d7a46533c..54eabb2f8d93455523cff936f853545b109257dd 100644 (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)
index fde46dd0e66bad6e5b58a4d82540ac9705b0d54b..ab25573bfd78002fd4fe1202d6779b23a710bc98 100644 (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;
       }
     }
index 82096c3f7a7e019b692e4df9cb29ff84b809faab..92d44ada7d5640891b859c0549aec88c20467bb0 100644 (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;
index 80c00a1716a08fbe0d23ee2445aed8bc4cdce020..b3099a24aeb3b0d780dabefc5820892ba1cf565d 100644 (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;
   }
 
index 8db10301df14ae90c13b258aa24c864fc7f21871..5c1f575bc9181f7e2a27457d6a6548d210c1a02d 100644 (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) {
index da757a377459829568c0f01eb0e0831aa8fc28cc..57ffffe53500a0c544d149f66d0257e5a270873d 100644 (file)
--- 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",