]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
build: use more `const`
authorViktor Szakats <commit@vsz.me>
Sun, 1 Feb 2026 02:57:45 +0000 (03:57 +0100)
committerViktor Szakats <commit@vsz.me>
Mon, 2 Feb 2026 11:32:49 +0000 (12:32 +0100)
Mostly with `char *` types.

Also:
- mime, x509asn1, tool_operate, lib3207: drop redundant casts.
- examples/smooth-gtk-thread: add missing variable declaration.
- reduce variable scopes.
- tests/server: move `data_to_hex()` to its only user: `sws`.

Closes #20489

111 files changed:
docs/examples/10-at-a-time.c
docs/examples/anyauthput.c
docs/examples/block_ip.c
docs/examples/chkspeed.c
docs/examples/ftp-wildcard.c
docs/examples/getinfo.c
docs/examples/getredirect.c
docs/examples/getreferrer.c
docs/examples/htmltidy.c
docs/examples/htmltitle.cpp
docs/examples/http2-download.c
docs/examples/http2-pushinmemory.c
docs/examples/http2-serverpush.c
docs/examples/http2-upload.c
docs/examples/httpput-postfields.c
docs/examples/httpput.c
docs/examples/multi-event.c
docs/examples/multi-uv.c
docs/examples/postit2-formadd.c
docs/examples/postit2.c
docs/examples/smooth-gtk-thread.c
docs/examples/sslbackend.c
docs/examples/synctime.c
docs/examples/url2file.c
lib/cf-h1-proxy.c
lib/curl_get_line.c
lib/curl_ntlm_core.c
lib/curl_ntlm_core.h
lib/curl_sasl.c
lib/curlx/strerr.c
lib/formdata.c
lib/ftp.c
lib/getinfo.c
lib/gopher.c
lib/hostip.c
lib/http.c
lib/http_aws_sigv4.c
lib/http_chunks.c
lib/imap.c
lib/ldap.c
lib/mime.c
lib/mqtt.c
lib/openldap.c
lib/smtp.c
lib/socks.c
lib/socks_gssapi.c
lib/strcase.c
lib/strcase.h
lib/strdup.c
lib/telnet.c
lib/tftp.c
lib/url.c
lib/urlapi.c
lib/vauth/digest.c
lib/vauth/ntlm.c
lib/vssh/libssh.c
lib/vssh/libssh2.c
lib/vssh/vssh.c
lib/vssh/vssh.h
lib/vtls/vtls.c
lib/vtls/wolfssl.c
lib/vtls/x509asn1.c
src/curlinfo.c
src/tool_cb_hdr.c
src/tool_helpers.c
src/tool_helpers.h
src/tool_operate.c
src/tool_operate.h
src/tool_parsecfg.c
src/tool_writeout.c
tests/cmake/test.c
tests/libtest/cli_h2_serverpush.c
tests/libtest/cli_hx_download.c
tests/libtest/lib1518.c
tests/libtest/lib1536.c
tests/libtest/lib1560.c
tests/libtest/lib1977.c
tests/libtest/lib3010.c
tests/libtest/lib3102.c
tests/libtest/lib3207.c
tests/libtest/lib500.c
tests/libtest/lib569.c
tests/libtest/mk-lib1521.pl
tests/libtest/testtrace.c
tests/server/dnsd.c
tests/server/first.c
tests/server/first.h
tests/server/getpart.c
tests/server/mqttd.c
tests/server/resolve.c
tests/server/rtspd.c
tests/server/sockfilt.c
tests/server/socksd.c
tests/server/sws.c
tests/server/tftpd.c
tests/server/util.c
tests/unit/unit1302.c
tests/unit/unit1600.c
tests/unit/unit1601.c
tests/unit/unit1603.c
tests/unit/unit1610.c
tests/unit/unit1611.c
tests/unit/unit1612.c
tests/unit/unit1615.c
tests/unit/unit1650.c
tests/unit/unit1653.c
tests/unit/unit1658.c
tests/unit/unit1979.c
tests/unit/unit1980.c
tests/unit/unit3200.c
tests/unit/unit3205.c

index e5cd1f1ad91e44484125cbb903d5f7b2886f4d35..6bc2bd71df6f17cd0d992025692c83fcbfbe946d 100644 (file)
@@ -131,7 +131,7 @@ int main(void)
       /* !checksrc! disable EQUALSNULL 1 */
       while((msg = curl_multi_info_read(multi, &msgs_left)) != NULL) {
         if(msg->msg == CURLMSG_DONE) {
-          char *url;
+          const char *url;
           CURL *curl = msg->easy_handle;
           curl_easy_getinfo(curl, CURLINFO_PRIVATE, &url);
           fprintf(stderr, "R: %d - %s <%s>\n",
index cdc0ad9e5f870e73d8fa8574f34eb739eaf66821..a44194aaa5b8482d3af4536ce54baea4193ee58e 100644 (file)
@@ -88,15 +88,15 @@ static size_t read_cb(char *ptr, size_t size, size_t nmemb, void *stream)
   return nread;
 }
 
-int main(int argc, char **argv)
+int main(int argc, const char **argv)
 {
   CURL *curl;
   CURLcode result;
   FILE *fp;
   struct stat file_info;
 
-  char *file;
-  char *url;
+  const char *file;
+  const char *url;
 
   if(argc < 3)
     return 1;
index f4a282756753890896303f42b143e45a80b866bd..6bf0625fddfd8eb086d0b6bd725ad8414a3dcf6b 100644 (file)
@@ -191,8 +191,8 @@ static int ip_match(struct ip *ip, void *netaddr)
   int bytes, tailbits;
   const unsigned char *x, *y;
 
-  x = (unsigned char *)&ip->netaddr;
-  y = (unsigned char *)netaddr;
+  x = (const unsigned char *)&ip->netaddr;
+  y = (const unsigned char *)netaddr;
 
   for(bytes = ip->maskbits / 8; bytes; --bytes) {
     if(*x++ != *y++)
@@ -214,7 +214,7 @@ static int is_ipv4_mapped_ipv6_address(int family, void *netaddr)
 {
   if(family == AF_INET6) {
     int i;
-    unsigned char *x = (unsigned char *)netaddr;
+    const unsigned char *x = (const unsigned char *)netaddr;
     for(i = 0; i < 12; ++i) {
       if(x[i])
         break;
index 3e8181e16fdd04f9fc9bc678ced7b1b0c2e43259..f6f708086401bf2a3aac13a1148dd1499b6815da 100644 (file)
@@ -66,13 +66,13 @@ static size_t write_cb(void *ptr, size_t size, size_t nmemb, void *data)
   return (size_t)(size * nmemb);
 }
 
-int main(int argc, char *argv[])
+int main(int argc, const char *argv[])
 {
   CURL *curl;
   CURLcode result;
   int prtall = 0, prtsep = 0, prttime = 0;
   const char *url = URL_1M;
-  char *appname = argv[0];
+  const char *appname = argv[0];
 
   if(argc > 1) {
     /* parse input parameters */
index 4cade8d174bed71c5e3d5b7b5ca7e03ab777ba9e..e8f0be62630c0f1a67cf9914239e1ab530312689 100644 (file)
@@ -97,7 +97,7 @@ static size_t write_cb(char *buff, size_t size, size_t nmemb, void *cb_data)
   return written;
 }
 
-int main(int argc, char **argv)
+int main(int argc, const char **argv)
 {
   /* curl easy handle */
   CURL *curl;
index 66bb69b8ae5b33149c80051a8da10b49cec5e433..1635fcc224ce1603018f6ef51aab9e1099f9c8e2 100644 (file)
@@ -43,7 +43,7 @@ int main(void)
     result = curl_easy_perform(curl);
 
     if(CURLE_OK == result) {
-      char *ct;
+      const char *ct;
       /* ask for the content-type */
       result = curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &ct);
 
index fabfc594bc5ed85a39da2f29ef58410efa4df10d..27c20ddb73765206c7402bb20e131c6c0df128f4 100644 (file)
@@ -33,8 +33,6 @@ int main(void)
 {
   CURL *curl;
   CURLcode result;
-  char *location;
-  long response_code;
 
   result = curl_global_init(CURL_GLOBAL_ALL);
   if(result)
@@ -53,12 +51,14 @@ int main(void)
       fprintf(stderr, "curl_easy_perform() failed: %s\n",
               curl_easy_strerror(result));
     else {
+      long response_code;
       result = curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response_code);
       if((result == CURLE_OK) && ((response_code / 100) != 3)) {
         /* a redirect implies a 3xx response code */
         fprintf(stderr, "Not a redirect.\n");
       }
       else {
+        const char *location;
         result = curl_easy_getinfo(curl, CURLINFO_REDIRECT_URL, &location);
 
         if((result == CURLE_OK) && location) {
index ac190f3fa1d555ada1c9ff1419ffd5ca7f30630d..cbe031763f7ade0fa329e9c31e5f074743831685 100644 (file)
@@ -49,7 +49,7 @@ int main(void)
       fprintf(stderr, "curl_easy_perform() failed: %s\n",
               curl_easy_strerror(result));
     else {
-      char *hdr;
+      const char *hdr;
       result = curl_easy_getinfo(curl, CURLINFO_REFERER, &hdr);
       if((result == CURLE_OK) && hdr)
         printf("Referrer header: %s\n", hdr);
index 3cd4f2a5ba7a4382375499683e70289c4997a8e4..7c11afbb2a9c2247cc723172b91e26287a80579e 100644 (file)
@@ -74,7 +74,7 @@ static void dumpNode(TidyDoc doc, TidyNode tnod, int indent)
   }
 }
 
-int main(int argc, char **argv)
+int main(int argc, const char **argv)
 {
   CURL *curl;
   char curl_errbuf[CURL_ERROR_SIZE];
index 285908da1693e5043f9046c6652c7f2cb9eb9dfc..ea62f9329081ac514b9368bcf8ff6aa09f596add 100644 (file)
@@ -250,7 +250,7 @@ static void parseHtml(const std::string &html,
   title = context.title;
 }
 
-int main(int argc, char *argv[])
+int main(int argc, const char *argv[])
 {
   CURL *curl = NULL;
   CURLcode result;
index 8f97b84f969e695561a4d11931adf036fd364f3b..3e5dde1d2c4c5c21a0b1c529af1953ea14e3d37f 100644 (file)
@@ -187,7 +187,7 @@ static int setup(struct transfer *t, int num)
 /*
  * Download many transfers over HTTP/2, using the same connection!
  */
-int main(int argc, char **argv)
+int main(int argc, const char **argv)
 {
   CURLcode result;
   struct transfer *trans;
index 37816742c0b393edf9d80977dd6ef6bfc7129e1c..a51232e35966e953fb1d6930ec1095fb43080090 100644 (file)
@@ -93,7 +93,7 @@ static int server_push_callback(CURL *parent,
                                 struct curl_pushheaders *headers,
                                 void *userp)
 {
-  char *headp;
+  const char *headp;
   int *transfers = (int *)userp;
   (void)parent;
   (void)num_headers;
index e570f2ed3109df79edf7d5342fc404657b894e47..afeec7694967bb721f77a141b9683c27733d45ee 100644 (file)
@@ -172,7 +172,7 @@ static int server_push_callback(CURL *parent,
                                 struct curl_pushheaders *headers,
                                 void *userp)
 {
-  char *headp;
+  const char *headp;
   size_t i;
   int *transfers = (int *)userp;
   char filename[128];
@@ -214,7 +214,7 @@ static int server_push_callback(CURL *parent,
 /*
  * Download a file over HTTP/2, take care of server push.
  */
-int main(int argc, char *argv[])
+int main(int argc, const char *argv[])
 {
   CURLcode result;
   CURL *curl;
index d0081cc49b938573d6856d9c0db01cfa83486825..b2657940e5af42b2b69af909692dcd8a714bc0b6 100644 (file)
@@ -285,7 +285,7 @@ static int setup(struct input *t, int num, const char *upload)
 /*
  * Upload all files over HTTP/2, using the same physical connection!
  */
-int main(int argc, char **argv)
+int main(int argc, const char **argv)
 {
   CURLcode result;
   struct input *trans;
index 7163756a365826aa0aeb362891fac4c13a0088d1..88eb55f06e548987f9cbc9763f1c2c18ba8373d9 100644 (file)
@@ -47,11 +47,11 @@ static const char olivertwist[] =
  * CURLOPT_POSTFIELDS to the URL given as an argument.
  */
 
-int main(int argc, char **argv)
+int main(int argc, const char **argv)
 {
   CURL *curl;
   CURLcode result;
-  char *url;
+  const char *url;
 
   if(argc < 2)
     return 1;
index 9a8163ce88a46c11121212bfe24826187303e67e..9fd808814f8cf136a0203356a9bf763a2fbaa692 100644 (file)
@@ -73,15 +73,15 @@ static size_t read_cb(char *ptr, size_t size, size_t nmemb, void *stream)
   return retcode;
 }
 
-int main(int argc, char **argv)
+int main(int argc, const char **argv)
 {
   CURL *curl;
   CURLcode result;
   FILE *hd_src;
   struct stat file_info;
 
-  char *file;
-  char *url;
+  const char *file;
+  const char *url;
 
   if(argc < 3)
     return 1;
index 4d30ac8c62c1248322778726f16709f76a69b4ef..b748238904456a9a2ad5ebcf1e635a143f5a2d9f 100644 (file)
@@ -213,7 +213,7 @@ static int handle_socket(CURL *curl, curl_socket_t s, int action, void *userp,
   return 0;
 }
 
-int main(int argc, char **argv)
+int main(int argc, const char **argv)
 {
   CURLcode result;
 
index a59c5988d9faf679bee9cd88283a84d30f9bf4aa..6928408461e01a07361bcf82a99ac7005deba102 100644 (file)
@@ -227,7 +227,7 @@ static int cb_socket(CURL *curl, curl_socket_t s, int action,
   return 0;
 }
 
-int main(int argc, char **argv)
+int main(int argc, const char **argv)
 {
   CURLcode result;
   struct datauv uv = { 0 };
index aee12ab0ac548f9d2d49e97efb4e0cd7635a91d6..3c297478ffeef7ddcd5fc5c7a4e7a4642f21c70d 100644 (file)
@@ -45,7 +45,7 @@
 
 #include <curl/curl.h>
 
-int main(int argc, char *argv[])
+int main(int argc, const char *argv[])
 {
   CURL *curl;
   CURLcode result;
index 4535bed6e1ab28fffa280219bcded911bc202e31..5632717cd4ade1a8090eb1c6d1d5a0458eb881a6 100644 (file)
@@ -42,7 +42,7 @@
 
 #include <curl/curl.h>
 
-int main(int argc, char *argv[])
+int main(int argc, const char *argv[])
 {
   CURL *curl;
 
index c82e0c57bf6d09d29d03845c602e73b15e17c4bd..64595f395506b611a4c2ba839ee7bfdbf2190e3a 100644 (file)
@@ -65,7 +65,7 @@ static size_t write_cb(void *ptr, size_t size, size_t nmemb, FILE *stream)
   return fwrite(ptr, size, nmemb, stream);
 }
 
-static void run_one(gchar *http, int j)
+static void run_one(const gchar *http, int j)
 {
   CURL *curl;
 
@@ -94,6 +94,7 @@ static void *pull_one_url(void *NaN)
   /* protect the reading and increasing of 'j' with a mutex */
   pthread_mutex_lock(&lock);
   while(j < num_urls) {
+    gchar *http;
     int i = j;
     j++;
     pthread_mutex_unlock(&lock);
@@ -165,7 +166,7 @@ static gboolean cb_delete(GtkWidget *window, gpointer data)
   return FALSE;
 }
 
-int main(int argc, char **argv)
+int main(int argc, const char **argv)
 {
   GtkWidget *top_window, *outside_frame, *inside_frame, *progress_bar;
 
index 5615bec72dc60ed7a60d3bcb71eb7abfd7617207..e10eaaa217545e4e817b8784edbbea7039076c3f 100644 (file)
@@ -40,7 +40,7 @@
  *  **** This example only works with libcurl 7.56.0 and later! ****
  */
 
-int main(int argc, char **argv)
+int main(int argc, const char **argv)
 {
   const char *name = argc > 1 ? argv[1] : "openssl";
   CURLsslset result;
index 6209ebc314de51420c9137c72f1d4800f35e6861..e9b730d50a71c88a47fc64b3324e8d1f6562682e 100644 (file)
@@ -126,7 +126,7 @@ static size_t SyncTime_CURL_WriteHeader(void *ptr, size_t size, size_t nmemb,
   if(ShowAllHeader == 1)
     fprintf(stderr, "%.*s", (int)nmemb, (char *)ptr);
 
-  if((nmemb >= 5) && !strncmp((char *)ptr, "Date:", 5)) {
+  if((nmemb >= 5) && !strncmp((const char *)ptr, "Date:", 5)) {
     if(ShowAllHeader == 0)
       fprintf(stderr, "HTTP Server. %.*s", (int)nmemb, (char *)ptr);
 
@@ -163,7 +163,7 @@ static size_t SyncTime_CURL_WriteHeader(void *ptr, size_t size, size_t nmemb,
     }
   }
 
-  if((nmemb >= 12) && !strncmp((char *)ptr, "X-Cache: HIT", 12)) {
+  if((nmemb >= 12) && !strncmp((const char *)ptr, "X-Cache: HIT", 12)) {
     fprintf(stderr, "ERROR: HTTP Server data is cached."
             " Server Date is no longer valid.\n");
     AutoSyncTime = 0;
@@ -226,7 +226,7 @@ static void showUsage(void)
   return;
 }
 
-int main(int argc, char *argv[])
+int main(int argc, const char *argv[])
 {
   CURLcode result;
   CURL *curl;
index 0c9c5880f78c1cbda4e3472290eba5cf2d4ea639..3370ac2f796c61e03427781ee43411f1e8ad1ecc 100644 (file)
@@ -42,7 +42,7 @@ static size_t write_cb(void *ptr, size_t size, size_t nmemb, void *stream)
   return written;
 }
 
-int main(int argc, char *argv[])
+int main(int argc, const char *argv[])
 {
   static const char *pagefilename = "page.out";
 
index ccc8349b1b80ec3cbeaa0f012bd0baa599ffd267..a85cd1d5a6fc0809a1b9f8ad149a72712fff1605 100644 (file)
@@ -241,7 +241,7 @@ static CURLcode send_CONNECT(struct Curl_cfilter *cf,
                              struct h1_tunnel_state *ts,
                              bool *done)
 {
-  uint8_t *buf = curlx_dyn_uptr(&ts->request_data);
+  const uint8_t *buf = curlx_dyn_uptr(&ts->request_data);
   size_t request_len = curlx_dyn_len(&ts->request_data);
   size_t blen = request_len;
   CURLcode result = CURLE_OK;
@@ -262,7 +262,7 @@ static CURLcode send_CONNECT(struct Curl_cfilter *cf,
 
   DEBUGASSERT(blen >= nwritten);
   ts->nsent += nwritten;
-  Curl_debug(data, CURLINFO_HEADER_OUT, (char *)buf, nwritten);
+  Curl_debug(data, CURLINFO_HEADER_OUT, (const char *)buf, nwritten);
 
 out:
   if(result)
@@ -353,9 +353,9 @@ static CURLcode single_header(struct Curl_cfilter *cf,
                               struct h1_tunnel_state *ts)
 {
   CURLcode result = CURLE_OK;
-  char *linep = curlx_dyn_ptr(&ts->rcvbuf);
+  const char *linep = curlx_dyn_ptr(&ts->rcvbuf);
   size_t line_len = curlx_dyn_len(&ts->rcvbuf); /* bytes in this line */
-  struct SingleRequest *k = &data->req;
+  const struct SingleRequest *k = &data->req;
   int writetype;
   ts->headerlines++;
 
@@ -531,7 +531,7 @@ static CURLcode recv_CONNECT_resp(struct Curl_cfilter *cf,
     if(byte != 0x0a)
       continue;
     else {
-      char *linep = curlx_dyn_ptr(&ts->rcvbuf);
+      const char *linep = curlx_dyn_ptr(&ts->rcvbuf);
       size_t hlen = curlx_dyn_len(&ts->rcvbuf);
       if(hlen && ISNEWLINE(linep[0])) {
         /* end of headers */
index f4328405c7ff8e96be1a152737ee9f3bd7472d2b..0eae0029f946cd2ed998f6755554cdecc91c9940 100644 (file)
@@ -41,7 +41,7 @@ CURLcode Curl_get_line(struct dynbuf *buf, FILE *input, bool *eof)
   curlx_dyn_reset(buf);
   while(1) {
     size_t rlen;
-    char *b = fgets(buffer, sizeof(buffer), input);
+    const char *b = fgets(buffer, sizeof(buffer), input);
 
     *eof = feof(input);
 
index 2e978d7ef3d983ff4ca198ae60fd19840929a72e..2edc7b07ce5a1e3f48b304a6cea451867abe8d2f 100644 (file)
@@ -551,9 +551,9 @@ CURLcode Curl_ntlm_core_mk_ntlmv2_hash(const char *user, size_t userlen,
  *
  * Returns CURLE_OK on success.
  */
-CURLcode Curl_ntlm_core_mk_ntlmv2_resp(unsigned char *ntlmv2hash,
-                                       unsigned char *challenge_client,
-                                       struct ntlmdata *ntlm,
+CURLcode Curl_ntlm_core_mk_ntlmv2_resp(const unsigned char *ntlmv2hash,
+                                       const unsigned char *challenge_client,
+                                       const struct ntlmdata *ntlm,
                                        unsigned char **ntresp,
                                        unsigned int *ntresp_len)
 {
@@ -644,9 +644,9 @@ CURLcode Curl_ntlm_core_mk_ntlmv2_resp(unsigned char *ntlmv2hash,
  *
  * Returns CURLE_OK on success.
  */
-CURLcode Curl_ntlm_core_mk_lmv2_resp(unsigned char *ntlmv2hash,
-                                     unsigned char *challenge_client,
-                                     unsigned char *challenge_server,
+CURLcode Curl_ntlm_core_mk_lmv2_resp(const unsigned char *ntlmv2hash,
+                                     const unsigned char *challenge_client,
+                                     const unsigned char *challenge_server,
                                      unsigned char *lmresp)
 {
   unsigned char data[16];
index 947b836966baecb8c952bdab09ac9357a5a6f102..f96bf0ada5ba736d3ecb83f5068ecbd08e8cbc2a 100644 (file)
@@ -55,15 +55,15 @@ CURLcode Curl_ntlm_core_mk_ntlmv2_hash(const char *user, size_t userlen,
                                        unsigned char *ntlmhash,
                                        unsigned char *ntlmv2hash);
 
-CURLcode Curl_ntlm_core_mk_ntlmv2_resp(unsigned char *ntlmv2hash,
-                                       unsigned char *challenge_client,
-                                       struct ntlmdata *ntlm,
+CURLcode Curl_ntlm_core_mk_ntlmv2_resp(const unsigned char *ntlmv2hash,
+                                       const unsigned char *challenge_client,
+                                       const struct ntlmdata *ntlm,
                                        unsigned char **ntresp,
                                        unsigned int *ntresp_len);
 
-CURLcode Curl_ntlm_core_mk_lmv2_resp(unsigned char *ntlmv2hash,
-                                     unsigned char *challenge_client,
-                                     unsigned char *challenge_server,
+CURLcode Curl_ntlm_core_mk_lmv2_resp(const unsigned char *ntlmv2hash,
+                                     const unsigned char *challenge_client,
+                                     const unsigned char *challenge_server,
                                      unsigned char *lmresp);
 
 #endif /* !USE_WINDOWS_SSPI */
index 21e1b8d1f488c9f606bf2be9722d66349741ed72..b2eb1fe884940ff37a3689fd50ed99275cc82786 100644 (file)
@@ -227,13 +227,14 @@ static CURLcode get_server_message(struct SASL *sasl, struct Curl_easy *data,
 
   result = sasl->params->getmessage(data, out);
   if(!result && (sasl->params->flags & SASL_FLAG_BASE64)) {
-    unsigned char *msg;
-    size_t msglen;
     const char *serverdata = Curl_bufref_ptr(out);
 
     if(!*serverdata || *serverdata == '=')
       Curl_bufref_set(out, NULL, 0, NULL);
     else {
+      unsigned char *msg;
+      size_t msglen;
+
       result = curlx_base64_decode(serverdata, &msg, &msglen);
       if(!result)
         Curl_bufref_set(out, msg, msglen, curl_free);
index 1aa23aa57052d0640982b90c53e086e98c25bf92..d9c1686e443928c9eef4908414a6f1b554baac5f 100644 (file)
@@ -292,7 +292,7 @@ const char *curlx_strerror(int err, char *buf, size_t buflen)
    */
   {
     char buffer[256];
-    char *msg = strerror_r(err, buffer, sizeof(buffer));
+    const char *msg = strerror_r(err, buffer, sizeof(buffer));
     if(msg && buflen > 1)
       SNPRINTF(buf, buflen, "%s", msg);
     else if(buflen > sizeof("Unknown error ") + 20)
index bb2c702fe0b090bb2bf51752c81c71bc77061b58..b22c2559892dcbcbc4cfc8bf1e18304b052d0f1b 100644 (file)
@@ -304,7 +304,7 @@ static CURLFORMcode FormAdd(struct curl_httppost **httppost,
   struct FormInfo *first_form, *curr, *form = NULL;
   CURLFORMcode retval = CURL_FORMADD_OK;
   CURLformoption option;
-  struct curl_forms *forms = NULL;
+  const struct curl_forms *forms = NULL;
   char *avalue = NULL;
   struct curl_httppost *newchain = NULL;
   struct curl_httppost *lastnode = NULL;
index c9a472ca15e2faa7adfad67ea87b1b67c0fea911..24e4796c88b23227b401a293a4c796ecaad081e9 100644 (file)
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -886,7 +886,7 @@ static CURLcode ftp_state_use_port(struct Curl_easy *data,
   char myhost[MAX_IPADR_LEN + 1] = "";
 
   struct Curl_sockaddr_storage ss;
-  struct Curl_addrinfo *res, *ai;
+  const struct Curl_addrinfo *res, *ai;
   curl_socklen_t sslen;
   char hbuf[NI_MAXHOST];
   struct sockaddr *sa = (struct sockaddr *)&ss;
@@ -896,15 +896,15 @@ static CURLcode ftp_state_use_port(struct Curl_easy *data,
 #endif
   static const char mode[][5] = { "EPRT", "PORT" };
   int error;
-  char *host = NULL;
-  char *string_ftpport = data->set.str[STRING_FTPPORT];
+  const char *host = NULL;
+  const char *string_ftpport = data->set.str[STRING_FTPPORT];
   struct Curl_dns_entry *dns_entry = NULL;
   unsigned short port_min = 0;
   unsigned short port_max = 0;
   unsigned short port;
   bool possibly_non_local = TRUE;
   char buffer[STRERROR_LEN];
-  char *addr = NULL;
+  const char *addr = NULL;
   size_t addrlen = 0;
   char ipstr[50];
 
@@ -920,7 +920,7 @@ static CURLcode ftp_state_use_port(struct Curl_easy *data,
 #ifdef USE_IPV6
     if(*string_ftpport == '[') {
       /* [ipv6]:port(-range) */
-      char *ip_start = string_ftpport + 1;
+      const char *ip_start = string_ftpport + 1;
       ip_end = strchr(ip_start, ']');
       if(ip_end) {
         addrlen = ip_end - ip_start;
@@ -1214,7 +1214,7 @@ static CURLcode ftp_state_use_port(struct Curl_easy *data,
     if(PORT == fcmd) {
       /* large enough for [IP address],[num],[num] */
       char target[sizeof(myhost) + 20];
-      char *source = myhost;
+      const char *source = myhost;
       char *dest = target;
 
       /* translate x.x.x.x to x,x,x,x */
@@ -1766,7 +1766,7 @@ static CURLcode ftp_state_quote(struct Curl_easy *data,
       i++;
     }
     if(item) {
-      char *cmd = item->data;
+      const char *cmd = item->data;
       if(cmd[0] == '*') {
         cmd++;
         ftpc->count2 = 1; /* the sent command is allowed to fail */
@@ -1924,11 +1924,11 @@ static CURLcode ftp_state_pasv_resp(struct Curl_easy *data,
   CURLcode result;
   struct Curl_dns_entry *dns = NULL;
   unsigned short connectport; /* the local port connect() should use! */
-  struct pingpong *pp = &ftpc->pp;
+  const struct pingpong *pp = &ftpc->pp;
   char *newhost = NULL;
   unsigned short newport = 0;
-  char *str = curlx_dyn_ptr(&pp->recvbuf) + 4; /* start on the first letter */
-
+  const char *str = curlx_dyn_ptr(&pp->recvbuf) + 4; /* start on the first
+                                                        letter */
   if((ftpc->count1 == 0) &&
      (ftpcode == 229)) {
     /* positive EPSV response */
@@ -2419,7 +2419,7 @@ static CURLcode ftp_state_mdtm_resp(struct Curl_easy *data,
        last .sss part is optional and means fractions of a second */
     int year, month, day, hour, minute, second;
     struct pingpong *pp = &ftpc->pp;
-    char *resp = curlx_dyn_ptr(&pp->recvbuf) + 4;
+    const char *resp = curlx_dyn_ptr(&pp->recvbuf) + 4;
     bool showtime = FALSE;
     if(ftp_213_date(resp, &year, &month, &day, &hour, &minute, &second)) {
       /* we have a time, reformat it */
@@ -2561,7 +2561,7 @@ static CURLcode ftp_state_size_resp(struct Curl_easy *data,
 {
   CURLcode result = CURLE_OK;
   curl_off_t filesize = -1;
-  char *buf = curlx_dyn_ptr(&ftpc->pp.recvbuf);
+  const char *buf = curlx_dyn_ptr(&ftpc->pp.recvbuf);
   size_t len = ftpc->pp.nfinal;
 
   /* get the size from the ascii string: */
@@ -2569,7 +2569,7 @@ static CURLcode ftp_state_size_resp(struct Curl_easy *data,
     /* To allow servers to prepend "rubbish" in the response string, we scan
        for all the digits at the end of the response and parse only those as a
        number. */
-    char *start = &buf[4];
+    const char *start = &buf[4];
     const char *fdigit = memchr(start, '\r', len - 4);
     if(fdigit) {
       fdigit--;
@@ -2740,7 +2740,7 @@ static CURLcode ftp_state_get_resp(struct Curl_easy *data,
         size_t i;
         for(i = 0; i < len - 7; i++) {
           curl_off_t what;
-          char *buf = curlx_dyn_ptr(&ftpc->pp.recvbuf);
+          const char *buf = curlx_dyn_ptr(&ftpc->pp.recvbuf);
           const char *c = &buf[i];
           if(!curlx_str_number(&c, &what, CURL_OFF_T_MAX) &&
              !curlx_str_single(&c, ' ') &&
@@ -2910,8 +2910,8 @@ static CURLcode ftp_pwd_resp(struct Curl_easy *data,
   CURLcode result;
 
   if(ftpcode == 257) {
-    char *ptr = curlx_dyn_ptr(&pp->recvbuf) + 4; /* start on the first
-                                                    letter */
+    const char *ptr = curlx_dyn_ptr(&pp->recvbuf) + 4; /* start on the first
+                                                          letter */
     bool entry_extracted = FALSE;
     struct dynbuf out;
     curlx_dyn_init(&out, 1000);
@@ -3183,10 +3183,10 @@ static CURLcode ftp_pp_statemachine(struct Curl_easy *data,
 
   case FTP_SYST:
     if(ftpcode == 215) {
-      char *ptr = curlx_dyn_ptr(&pp->recvbuf) + 4; /* start on the first
-                                                      letter */
+      const char *ptr = curlx_dyn_ptr(&pp->recvbuf) + 4; /* start on the first
+                                                            letter */
+      const char *start;
       char *os;
-      char *start;
 
       /* Reply format is like
          215<space><OS-name><space><commentary>
@@ -3453,7 +3453,7 @@ static CURLcode ftp_sendquote(struct Curl_easy *data,
   while(item) {
     if(item->data) {
       size_t nread;
-      char *cmd = item->data;
+      const char *cmd = item->data;
       bool acceptfail = FALSE;
       CURLcode result;
       int ftpcode = 0;
index a59c2d3eb24cde70358d72668fb057f70dbaf64d..fd0d483f0a1137a94b0eb6cd5e3bd5043f2a4333 100644 (file)
@@ -127,7 +127,7 @@ static CURLcode getinfo_char(struct Curl_easy *data, CURLINFO info,
     *param_charp = data->info.contenttype;
     break;
   case CURLINFO_PRIVATE:
-    *param_charp = (char *)data->set.private_data;
+    *param_charp = (const char *)data->set.private_data;
     break;
   case CURLINFO_FTP_ENTRY_PATH:
     /* Return the entrypath string from the most recent connection.
index 49aeb10725ae344609d6832fb125f31849dd4e03..71ff39275cd9fd68aa68f2d193d6a2cd5c5da44e 100644 (file)
@@ -63,8 +63,8 @@ static CURLcode gopher_do(struct Curl_easy *data, bool *done)
   struct connectdata *conn = data->conn;
   curl_socket_t sockfd = conn->sock[FIRSTSOCKET];
   char *gopherpath;
-  char *path = data->state.up.path;
-  char *query = data->state.up.query;
+  const char *path = data->state.up.path;
+  const char *query = data->state.up.query;
   const char *buf = NULL;
   char *buf_alloc = NULL;
   size_t nwritten, buf_len;
@@ -91,7 +91,7 @@ static CURLcode gopher_do(struct Curl_easy *data, bool *done)
     curlx_free(gopherpath);
   }
   else {
-    char *newp;
+    const char *newp;
 
     /* Otherwise, drop / and the first character (i.e., item type) ... */
     newp = gopherpath;
index 9c33108d34c9fe1bf1c368d055908d68d5ae8cb2..f82b1ee950148df8e96861979ece916803c4582f 100644 (file)
 static void show_resolve_info(struct Curl_easy *data,
                               struct Curl_dns_entry *dns)
 {
-  struct Curl_addrinfo *a;
+  const struct Curl_addrinfo *a;
   CURLcode result = CURLE_OK;
 #ifdef CURLRES_IPV6
   struct dynbuf out[2];
index b5627e61a88b6b40e717b04c4dafd44459dcbe92..26a15ad75e2c0374928356ab1968c39948fac56c 100644 (file)
@@ -4343,7 +4343,7 @@ static CURLcode http_rw_hd(struct Curl_easy *data,
 void Curl_http_to_fold(struct dynbuf *bf)
 {
   size_t len = curlx_dyn_len(bf);
-  char *hd = curlx_dyn_ptr(bf);
+  const char *hd = curlx_dyn_ptr(bf);
   if(len && (hd[len - 1] == '\n'))
     len--;
   if(len && (hd[len - 1] == '\r'))
@@ -4397,7 +4397,7 @@ static CURLcode http_parse_headers(struct Curl_easy *data,
   while(blen && k->header) {
     size_t consumed;
     size_t hlen;
-    char *hd;
+    const char *hd;
     size_t unfold_len = 0;
 
     if(data->state.leading_unfold) {
index 36976530f9533a65d00c0025eece9fed56270b95..2205b03d090faadc0c412a2eebe913bd09d388c7 100644 (file)
@@ -732,7 +732,7 @@ UNITTEST CURLcode canon_query(const char *query, struct dynbuf *dq)
     size_t in_key_len;
     const char *offset;
     size_t query_part_len = curlx_dyn_len(&query_array[index]);
-    char *query_part = curlx_dyn_ptr(&query_array[index]);
+    const char *query_part = curlx_dyn_ptr(&query_array[index]);
 
     in_key = query_part;
 
@@ -788,8 +788,8 @@ UNITTEST CURLcode canon_query(const char *query, struct dynbuf *dq)
     if(index)
       result = curlx_dyn_addn(dq, "&", 1);
     if(!result) {
-      char *key_ptr = curlx_dyn_ptr(&encoded_query_array[index].key);
-      char *value_ptr = curlx_dyn_ptr(&encoded_query_array[index].value);
+      const char *key_ptr = curlx_dyn_ptr(&encoded_query_array[index].key);
+      const char *value_ptr = curlx_dyn_ptr(&encoded_query_array[index].value);
       size_t vlen = curlx_dyn_len(&encoded_query_array[index].value);
       if(value_ptr && vlen) {
         result = curlx_dyn_addf(dq, "%s=%s", key_ptr, value_ptr);
index c950346b2d3ac5ad20e18a16608f18592f1514a2..9b38a3780cae1ea9c372fb94de428570150d2b87 100644 (file)
@@ -242,7 +242,7 @@ static CURLcode httpchunk_readwrite(struct Curl_easy *data,
 
     case CHUNK_TRAILER:
       if((*buf == 0x0d) || (*buf == 0x0a)) {
-        char *tr = curlx_dyn_ptr(&ch->trailer);
+        const char *tr = curlx_dyn_ptr(&ch->trailer);
         /* this is the end of a trailer, but if the trailer was zero bytes
            there was no trailer and we move on */
 
@@ -517,7 +517,7 @@ static CURLcode add_last_chunk(struct Curl_easy *data,
 
   for(tr = trailers; tr; tr = tr->next) {
     /* only add correctly formatted trailers */
-    char *ptr = strchr(tr->data, ':');
+    const char *ptr = strchr(tr->data, ':');
     if(!ptr || *(ptr + 1) != ' ') {
       infof(data, "Malformatted trailing header, skipping trailer");
       continue;
index c4032a69e55df81ff69ac7dde146dff89f7c2ee8..df7a54f2b4977fa8d47fa87b12e280c930da56af 100644 (file)
@@ -1220,7 +1220,7 @@ static CURLcode imap_state_listsearch_resp(struct Curl_easy *data,
                                            imapstate instate)
 {
   CURLcode result = CURLE_OK;
-  char *line = curlx_dyn_ptr(&imapc->pp.recvbuf);
+  const char *line = curlx_dyn_ptr(&imapc->pp.recvbuf);
   size_t len = imapc->pp.nfinal;
   struct IMAP *imap = Curl_meta_get(data, CURL_META_IMAP_EASY);
 
index bff1f0f1675622fe6674a5be57fca37e44caa7fd..3e7bbaa04036132021efccb1844bf31140efabf8 100644 (file)
@@ -338,7 +338,7 @@ static CURLcode ldap_do(struct Curl_easy *data, bool *done)
     ldap_set_option(server, LDAP_OPT_SSL, LDAP_OPT_ON);
 #else /* !USE_WIN32_LDAP */
     int ldap_option;
-    char *ldap_ca = conn->ssl_config.CAfile;
+    const char *ldap_ca = conn->ssl_config.CAfile;
 #ifdef LDAP_OPT_X_TLS
     if(conn->ssl_config.verifypeer) {
       /* OpenLDAP SDK supports BASE64 files. */
index 45a93eb3fc0cae82b167434f6db7147f40983bfc..a80b206d9c5c15cea72a286f3e6814d5fb275dc9 100644 (file)
@@ -1204,7 +1204,7 @@ curl_mime *curl_mime_init(void *easy)
 /* Initialize a mime part. */
 void Curl_mime_initpart(curl_mimepart *part)
 {
-  memset((char *)part, 0, sizeof(*part));
+  memset(part, 0, sizeof(*part));
   part->lastreadstatus = 1; /* Successful read status. */
   mimesetstate(&part->state, MIMESTATE_BEGIN, NULL);
 }
index cabafa3383b838495f86eda7d011c68debfb8f5b..46bfad9596a53cdc889a7a9a3c0ba2971bb5b3fb 100644 (file)
@@ -403,7 +403,7 @@ static CURLcode mqtt_verify_connack(struct Curl_easy *data)
 {
   struct MQTT *mq = Curl_meta_get(data, CURL_META_MQTT_EASY);
   CURLcode result;
-  char *ptr;
+  const char *ptr;
 
   DEBUGASSERT(mq);
   if(!mq)
@@ -433,7 +433,7 @@ fail:
 static CURLcode mqtt_get_topic(struct Curl_easy *data,
                                char **topic, size_t *topiclen)
 {
-  char *path = data->state.up.path;
+  const char *path = data->state.up.path;
   CURLcode result = CURLE_URL_MALFORMAT;
   if(strlen(path) > 1) {
     result = Curl_urldecode(path + 1, 0, topic, topiclen, REJECT_NADA);
@@ -506,7 +506,7 @@ static CURLcode mqtt_verify_suback(struct Curl_easy *data)
   struct connectdata *conn = data->conn;
   struct mqtt_conn *mqtt = Curl_conn_meta_get(conn, CURL_META_MQTT_CONN);
   CURLcode result;
-  char *ptr;
+  const char *ptr;
 
   if(!mqtt || !mq)
     return CURLE_FAILED_INIT;
@@ -595,7 +595,8 @@ fail:
 }
 
 /* return 0 on success, non-zero on error */
-static int mqtt_decode_len(size_t *lenp, unsigned char *buf, size_t buflen)
+static int mqtt_decode_len(size_t *lenp, const unsigned char *buf,
+                           size_t buflen)
 {
   size_t len = 0;
   size_t mult = 1;
index fad8e54a9050b7aaa87de2c3d85c0278f45ab1e1..83ae013593d8ab56826d5ad7e1d933dcddcacc3b 100644 (file)
@@ -337,7 +337,7 @@ static CURLcode oldap_perform_bind(struct Curl_easy *data, ldapstate newstate)
 {
   struct connectdata *conn = data->conn;
   struct ldapconninfo *li = Curl_conn_meta_get(conn, CURL_META_LDAP_CONN);
-  char *binddn = NULL;
+  const char *binddn = NULL;
   struct berval passwd;
   int rc;
 
@@ -724,8 +724,9 @@ static CURLcode oldap_state_mechs_resp(struct Curl_easy *data,
       if(bvals) {
         for(i = 0; bvals[i].bv_val; i++) {
           size_t llen;
-          unsigned short mech = Curl_sasl_decode_mech((char *)bvals[i].bv_val,
-                                                      bvals[i].bv_len, &llen);
+          unsigned short mech =
+            Curl_sasl_decode_mech((const char *)bvals[i].bv_val,
+                                  bvals[i].bv_len, &llen);
           if(bvals[i].bv_len == llen)
             li->sasl.authmechs |= mech;
         }
index cb502dee825995ab70fc1b457e4894b482a4d191..23590398f949e6fafb513264d7f0c2823bb2bcd6 100644 (file)
@@ -1341,7 +1341,7 @@ static CURLcode smtp_state_command_resp(struct Curl_easy *data,
                                         smtpstate instate)
 {
   CURLcode result = CURLE_OK;
-  char *line = curlx_dyn_ptr(&smtpc->pp.recvbuf);
+  const char *line = curlx_dyn_ptr(&smtpc->pp.recvbuf);
   size_t len = smtpc->pp.nfinal;
 
   (void)instate;
index 44a27bf1f7390dc5101faf4061c3258beb59dce0..43be771ad0e357735c761527489c53c52b8774d9 100644 (file)
@@ -837,7 +837,7 @@ static CURLproxycode socks5_resolving(struct socks_state *sx,
   struct Curl_dns_entry *dns = NULL;
   struct Curl_addrinfo *hp = NULL;
   char dest[MAX_IPADR_LEN];  /* printable address */
-  unsigned char *destination = NULL;
+  const unsigned char *destination = NULL;
   unsigned char desttype = 1, destlen = 4;
   unsigned char req[2];
   CURLcode result;
@@ -896,7 +896,7 @@ static CURLproxycode socks5_resolving(struct socks_state *sx,
     desttype = 1; /* ATYP: IPv4 = 1 */
     destlen = 4;
     saddr_in = (struct sockaddr_in *)(void *)hp->ai_addr;
-    destination = (unsigned char *)&saddr_in->sin_addr.s_addr;
+    destination = (const unsigned char *)&saddr_in->sin_addr.s_addr;
     CURL_TRC_CF(data, cf, "SOCKS5 connect to %s:%d (locally resolved)",
                 dest, sx->remote_port);
   }
@@ -906,7 +906,7 @@ static CURLproxycode socks5_resolving(struct socks_state *sx,
     desttype = 4; /* ATYP: IPv6 = 4 */
     destlen = 16;
     saddr_in6 = (struct sockaddr_in6 *)(void *)hp->ai_addr;
-    destination = (unsigned char *)&saddr_in6->sin6_addr.s6_addr;
+    destination = (const unsigned char *)&saddr_in6->sin6_addr.s6_addr;
     CURL_TRC_CF(data, cf, "SOCKS5 connect to [%s]:%d (locally resolved)",
                 dest, sx->remote_port);
   }
index 579ae71b9a3eedf00ad56a82409d6cbe1aea29bc..f24a3383826595fa1b9b7c840aabdc280da73e95 100644 (file)
@@ -317,7 +317,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf,
   }
 
   infof(data, "SOCKS5 server authenticated user %.*s with GSS-API.",
-        (int)gss_send_token.length, (char *)gss_send_token.value);
+        (int)gss_send_token.length, (const char *)gss_send_token.value);
 
   gss_release_name(&gss_status, &gss_client_name);
   gss_release_buffer(&gss_status, &gss_send_token);
index 34ccae35de16e72d6b281eba5d11e885f04b7648..9f70f41bd63cc00656dc233c438290cb3dedea8d 100644 (file)
@@ -116,7 +116,7 @@ void Curl_strntolower(char *dest, const char *src, size_t n)
 /* Compare case-sensitive null-terminated strings, taking care of possible
  * null pointers. Return true if arguments match.
  */
-bool Curl_safecmp(char *a, char *b)
+bool Curl_safecmp(const char *a, const char *b)
 {
   if(a && b)
     return !strcmp(a, b);
index 3a7f126790633c367f84a502e37690ce8c57a48a..35f726c3eecef87a51ef1a576514266feed7253f 100644 (file)
@@ -35,7 +35,7 @@ char Curl_raw_tolower(char in);
 void Curl_strntoupper(char *dest, const char *src, size_t n);
 void Curl_strntolower(char *dest, const char *src, size_t n);
 
-bool Curl_safecmp(char *a, char *b);
+bool Curl_safecmp(const char *a, const char *b);
 int Curl_timestrcmp(const char *first, const char *second);
 
 #endif /* HEADER_CURL_STRCASE_H */
index f666571e3eac90cbfad4059847b9db433e7a2b57..e97ae3588349cde2d39564b6b6e55fddc3b19b42 100644 (file)
@@ -36,13 +36,13 @@ char *Curl_strdup(const char *str)
   char *newstr;
 
   if(!str)
-    return (char *)NULL;
+    return NULL;
 
   len = strlen(str) + 1;
 
   newstr = curlx_malloc(len);
   if(!newstr)
-    return (char *)NULL;
+    return NULL;
 
   memcpy(newstr, str, len);
   return newstr;
index c06b7a1b1fdb137a23d917c6b411bef95586227e..d1b1d8fc5ea795e8ded96c492535f6ae70cd8b8d 100644 (file)
@@ -496,9 +496,9 @@ static void rec_wont(struct Curl_easy *data, struct TELNET *tn, int option)
 }
 
 static void printsub(struct Curl_easy *data,
-                     int direction,             /* '<' or '>' */
-                     unsigned char *pointer,    /* where suboption data is */
-                     size_t length)             /* length of suboption data */
+                     int direction,                /* '<' or '>' */
+                     const unsigned char *pointer, /* ptr to suboption data */
+                     size_t length)                /* suboption data length */
 {
   if(data->set.verbose) {
     unsigned int i = 0;
@@ -611,10 +611,10 @@ static void printsub(struct Curl_easy *data,
 /* Escape and send a telnet data block */
 static CURLcode send_telnet_data(struct Curl_easy *data,
                                  struct TELNET *tn,
-                                 char *buffer, ssize_t nread)
+                                 const char *buffer, ssize_t nread)
 {
   size_t i, outlen;
-  unsigned char *outbuf;
+  const unsigned char *outbuf;
   CURLcode result = CURLE_OK;
   size_t bytes_written;
   size_t total_written = 0;
@@ -641,7 +641,7 @@ static CURLcode send_telnet_data(struct Curl_easy *data,
   }
   else {
     outlen = (size_t)nread;
-    outbuf = (unsigned char *)buffer;
+    outbuf = (const unsigned char *)buffer;
   }
   while(!result && total_written < outlen) {
     /* Make sure socket is writable to avoid EWOULDBLOCK condition */
@@ -676,7 +676,7 @@ static void sendsuboption(struct Curl_easy *data,
   ssize_t bytes_written;
   int err;
   unsigned short x, y;
-  unsigned char *uc1, *uc2;
+  const unsigned char *uc1, *uc2;
   struct connectdata *conn = data->conn;
 
   switch(option) {
@@ -690,8 +690,8 @@ static void sendsuboption(struct Curl_easy *data,
     /* Window size must be sent according to the 'network order' */
     x = htons(tn->subopt_wsx);
     y = htons(tn->subopt_wsy);
-    uc1 = (unsigned char *)&x;
-    uc2 = (unsigned char *)&y;
+    uc1 = (const unsigned char *)&x;
+    uc2 = (const unsigned char *)&y;
     CURL_SB_ACCUM(tn, uc1[0]);
     CURL_SB_ACCUM(tn, uc1[1]);
     CURL_SB_ACCUM(tn, uc2[0]);
@@ -702,7 +702,7 @@ static void sendsuboption(struct Curl_easy *data,
     CURL_SB_TERM(tn);
     /* data suboption is now ready */
 
-    printsub(data, '>', (unsigned char *)tn->subbuffer + 2,
+    printsub(data, '>', (const unsigned char *)tn->subbuffer + 2,
              CURL_SB_LEN(tn) - 2);
 
     /* we send the header of the suboption... */
@@ -713,7 +713,7 @@ static void sendsuboption(struct Curl_easy *data,
     }
     /* ... then the window size with the send_telnet_data() function
        to deal with 0xFF cases ... */
-    send_telnet_data(data, tn, (char *)tn->subbuffer + 3, 4);
+    send_telnet_data(data, tn, (const char *)tn->subbuffer + 3, 4);
     /* ... and the footer */
     bytes_written = swrite(conn->sock[FIRSTSOCKET], tn->subbuffer + 7, 2);
     if(bytes_written < 0) {
@@ -986,7 +986,8 @@ static CURLcode suboption(struct Curl_easy *data, struct TELNET *tn)
   if(!CURL_SB_LEN(tn)) /* ignore empty suboption */
     return CURLE_OK;
 
-  printsub(data, '<', (unsigned char *)tn->subbuffer, CURL_SB_LEN(tn) + 2);
+  printsub(data, '<', (const unsigned char *)tn->subbuffer,
+           CURL_SB_LEN(tn) + 2);
   switch(CURL_SB_GET(tn)) {
   case CURL_TELOPT_TTYPE:
     if(bad_option(tn->subopt_ttype))
index d10b6fc611ce6fb58bd054f674d11d4d6f77366b..782cb1959a8e186e219b076b9a1455ad9176d066 100644 (file)
@@ -1078,7 +1078,7 @@ static CURLcode tftp_receive_packet(struct Curl_easy *data,
       if(state->rbytes > 4 &&
          (NEXT_BLOCKNUM(state->block) == getrpacketblock(&state->rpacket))) {
         result = Curl_client_write(data, CLIENTWRITE_BODY,
-                                   (char *)state->rpacket.data + 4,
+                                   (const char *)state->rpacket.data + 4,
                                    state->rbytes - 4);
         if(result) {
           tftp_state_machine(state, TFTP_EVENT_ERROR);
@@ -1088,7 +1088,7 @@ static CURLcode tftp_receive_packet(struct Curl_easy *data,
       break;
     case TFTP_EVENT_ERROR: {
       unsigned short error = getrpacketblock(&state->rpacket);
-      char *str = (char *)state->rpacket.data + 4;
+      const char *str = (const char *)state->rpacket.data + 4;
       size_t strn = state->rbytes - 4;
       state->error = (tftp_error_t)error;
       if(tftp_strnlen(str, strn) < strn)
index 21fe1d1acb2c7675c6cb20feb6cb3e32c0065aba..ddd0dc5b1453cbc86328b783c74e5a89c7ffd7c5 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -1965,7 +1965,7 @@ static char *detect_proxy(struct Curl_easy *data,
  * that may exist registered to the same proxy host.
  */
 static CURLcode parse_proxy(struct Curl_easy *data,
-                            struct connectdata *conn, char *proxy,
+                            struct connectdata *conn, const char *proxy,
                             long proxytype)
 {
   char *portptr = NULL;
@@ -2997,7 +2997,7 @@ static CURLcode parse_connect_to_slist(struct Curl_easy *data,
 #ifdef USE_UNIX_SOCKETS
 static CURLcode resolve_unix(struct Curl_easy *data,
                              struct connectdata *conn,
-                             char *unix_path,
+                             const char *unix_path,
                              struct Curl_dns_entry **pdns)
 {
   struct Curl_dns_entry *hostaddr;
@@ -3047,7 +3047,7 @@ static CURLcode resolve_server(struct Curl_easy *data,
 
 #ifdef USE_UNIX_SOCKETS
   {
-    char *unix_path = conn->unix_domain_socket;
+    const char *unix_path = conn->unix_domain_socket;
 
 #ifndef CURL_DISABLE_PROXY
     if(!unix_path && CONN_IS_PROXIED(conn) && conn->socks_proxy.host.name &&
index 1cce6aaee24cd6ba0b96f957102954ef14801767..1b67d80a9da1fc63da9a399294e1df3ebf2705e5 100644 (file)
@@ -336,7 +336,7 @@ UNITTEST CURLUcode Curl_parse_port(struct Curl_URL *u, struct dynbuf *host,
                                    bool has_scheme)
 {
   const char *portptr;
-  char *hostname = curlx_dyn_ptr(host);
+  const char *hostname = curlx_dyn_ptr(host);
   /*
    * Find the end of an IPv6 address on the ']' ending bracket.
    */
index 790240837b1da4820cc25d21f1d25f3ecef8b835..f34db9b90f25a382839d564523a130a4f6995dd8 100644 (file)
@@ -130,8 +130,9 @@ bool Curl_auth_digest_get_pair(const char *str, char *value, char *content,
 
 #ifndef USE_WINDOWS_SSPI
 /* Convert MD5 chunk to RFC2617 (section 3.1.3) -suitable ASCII string */
-static void auth_digest_md5_to_ascii(unsigned char *source, /* 16 bytes */
-                                     unsigned char *dest)   /* 33 bytes */
+static void auth_digest_md5_to_ascii(
+  const unsigned char *source, /* 16 bytes */
+  unsigned char *dest)         /* 33 bytes */
 {
   int i;
   for(i = 0; i < 16; i++)
@@ -139,8 +140,9 @@ static void auth_digest_md5_to_ascii(unsigned char *source, /* 16 bytes */
 }
 
 /* Convert sha256 or SHA-512/256 chunk to RFC7616 -suitable ASCII string */
-static void auth_digest_sha256_to_ascii(unsigned char *source, /* 32 bytes */
-                                        unsigned char *dest)   /* 65 bytes */
+static void auth_digest_sha256_to_ascii(
+  const unsigned char *source, /* 32 bytes */
+  unsigned char *dest)         /* 65 bytes */
 {
   int i;
   for(i = 0; i < 32; i++)
@@ -670,7 +672,7 @@ static CURLcode auth_create_digest_http_message(
   const unsigned char *uripath,
   struct digestdata *digest,
   char **outptr, size_t *outlen,
-  void (*convert_to_ascii)(unsigned char *, unsigned char *),
+  void (*convert_to_ascii)(const unsigned char *, unsigned char *),
   CURLcode (*hash)(unsigned char *, const unsigned char *, const size_t))
 {
   CURLcode result;
index fe45867b2f94a129371e89d2a26b22c8302a2bfa..21f815779a16ebaf1ce156d9ad9ada562d829ee4 100644 (file)
@@ -565,7 +565,7 @@ CURLcode Curl_auth_create_ntlm_type3_message(struct Curl_easy *data,
   unsigned int ntrespoff;
   unsigned int ntresplen = 24;
   unsigned char ntresp[24]; /* fixed-size */
-  unsigned char *ptr_ntresp = &ntresp[0];
+  const unsigned char *ptr_ntresp = &ntresp[0];
   unsigned char *ntlmv2resp = NULL;
   bool unicode = (ntlm->flags & NTLMFLAG_NEGOTIATE_UNICODE);
   /* The fixed hostname we provide, in order to not leak our real local host
index 0a86d121519695159a2f9f1f133c557026111839..a5d58ec731ba1d7cbaaea991499d9bd54461b8b1 100644 (file)
@@ -1367,7 +1367,7 @@ static int myssh_in_SFTP_QUOTE(struct Curl_easy *data,
   /*
    * Support some of the "FTP" commands
    */
-  char *cmd = sshc->quote_item->data;
+  const char *cmd = sshc->quote_item->data;
   sshc->acceptfail = FALSE;
 
   /* if a command starts with an asterisk, which a legal SFTP command never
@@ -1578,7 +1578,7 @@ static int myssh_in_SFTP_NEXT_QUOTE(struct Curl_easy *data,
 static int myssh_in_SFTP_QUOTE_STAT(struct Curl_easy *data,
                                     struct ssh_conn *sshc)
 {
-  char *cmd = sshc->quote_item->data;
+  const char *cmd = sshc->quote_item->data;
   sshc->acceptfail = FALSE;
 
   /* if a command starts with an asterisk, which a legal SFTP command never
index cf04adcca22d903ada77187b7e39e716b76e8787..7b0fbd636e8e497558e61e01af210078417446b7 100644 (file)
@@ -737,7 +737,7 @@ static CURLcode sftp_quote(struct Curl_easy *data,
    * 'sshc->quote_item' is already verified to be non-NULL before it
    * switched to this state.
    */
-  char *cmd = sshc->quote_item->data;
+  const char *cmd = sshc->quote_item->data;
   sshc->acceptfail = FALSE;
 
   /* if a command starts with an asterisk, which a legal SFTP command never
@@ -1165,7 +1165,7 @@ static CURLcode sftp_quote_stat(struct Curl_easy *data,
                                 struct SSHPROTO *sshp,
                                 bool *blockp)
 {
-  char *cmd = sshc->quote_item->data;
+  const char *cmd = sshc->quote_item->data;
   sshc->acceptfail = FALSE;
 
   /* if a command starts with an asterisk, which a legal SFTP command never
index e36c703780c3d5e6c9522d2e1b20de5c7dd88640..b52b09b696e9beff92e6a27234a4ea59446fd3d5 100644 (file)
@@ -125,7 +125,7 @@ void Curl_ssh_set_state(struct Curl_easy *data,
 
 /* figure out the path to work with in this particular request */
 CURLcode Curl_getworkingpath(struct Curl_easy *data,
-                             char *homedir,  /* when SFTP is used */
+                             const char *homedir, /* when SFTP is used */
                              char **path) /* returns the  allocated
                                              real path to work with */
 {
index f3a4873e7f3ed50eab154e716b31f102692f8f96..4d5b7ad24e98046a6ef2ca2e88073cf5b678b188 100644 (file)
@@ -28,7 +28,7 @@
 #include "../urldata.h"
 
 CURLcode Curl_getworkingpath(struct Curl_easy *data,
-                             char *homedir,
+                             const char *homedir,
                              char **path);
 
 CURLcode Curl_get_pathname(const char **cpp, char **path, const char *homedir);
index e4f910b85c6b5f725d1607127aaa3142097ff68b..e7e412b488ddede3418aee0b9b1b53ab1c87f7d5 100644 (file)
@@ -1058,7 +1058,7 @@ static size_t multissl_version(char *buffer, size_t size)
 
   if(current != selected) {
     char *p = backends;
-    char *end = backends + sizeof(backends);
+    const char *end = backends + sizeof(backends);
     int i;
 
     selected = current;
index 1225063c99c3f776b95e4133015549011ceddd58..750f1123a5b9c3dd45a36a8b88381da000d063c0 100644 (file)
@@ -1135,7 +1135,7 @@ CURLcode Curl_wssl_ctx_init(struct wssl_ctx *wctx,
 
 #ifndef WOLFSSL_TLS13
   {
-    char *ciphers = conn_config->cipher_list;
+    const char *ciphers = conn_config->cipher_list;
     if(ciphers) {
       if(!SSL_CTX_set_cipher_list(wctx->ssl_ctx, ciphers)) {
         failf(data, "failed setting cipher list: %s", ciphers);
index e6fdb10d65f94699d030ffad28d4d231410d073f..5c3a727e63c47edcf846dc58b6649937887935e3 100644 (file)
@@ -146,7 +146,7 @@ static const struct Curl_OID OIDtable[] = {
   { "2.16.840.1.101.3.4.2.2",   "sha384" },
   { "2.16.840.1.101.3.4.2.3",   "sha512" },
   { "1.2.840.113549.1.9.2",     "unstructuredName" },
-  { (const char *)NULL,         (const char *)NULL }
+  { NULL,                       NULL }
 };
 
 #endif /* WANT_EXTRACT_CERTINFO */
@@ -932,7 +932,7 @@ static CURLcode ssl_push_certinfo_dyn(struct Curl_easy *data,
                                       struct dynbuf *ptr)
 {
   size_t valuelen = curlx_dyn_len(ptr);
-  char *value = curlx_dyn_ptr(ptr);
+  const char *value = curlx_dyn_ptr(ptr);
 
   CURLcode result = Curl_ssl_push_certinfo_len(data, certnum, label,
                                                value, valuelen);
index b5626232e3ddcdbab835ea8a74e11d2fb96cc0ce..0a6c7fc135bbf18a12a3b58e8ccd35c492fba2ee 100644 (file)
@@ -257,7 +257,7 @@ static const char *disabled[] = {
 #endif
 };
 
-int main(int argc, char **argv)
+int main(int argc, const char **argv)
 {
   size_t i;
 
index eb35c5c383937b39d9b447cb7ce2444b62b7e602..c50fac6b32e794b98a80c09f7a8165c6dc1fb8da 100644 (file)
@@ -66,8 +66,8 @@ static void write_linked_location(CURL *curl, const char *location,
 {
   /* This would so simple if CURLINFO_REDIRECT_URL were available here */
   CURLU *u = NULL;
-  char *copyloc = NULL, *locurl = NULL, *scheme = NULL, *finalurl = NULL;
-  const char *loc = location;
+  char *copyloc = NULL, *scheme = NULL, *finalurl = NULL;
+  const char *loc = location, *locurl = NULL;
   size_t llen = loclen;
   int space_skipped = 0;
   const char *vver = getenv("VTE_VERSION");
index c32e1bbaabe11e1abf1417df2ad644e9b01a2b89..2a84accf2c508f000bf3eab280a7e87cb562cf5d 100644 (file)
@@ -96,7 +96,7 @@ int SetHTTPrequest(HttpReq req, HttpReq *store)
   return 1;
 }
 
-void customrequest_helper(HttpReq req, char *method)
+void customrequest_helper(HttpReq req, const char *method)
 {
   /* this mirrors the HttpReq enum in tool_sdecls.h */
   const char *dflt[] = {
index fab026b05d4e574dc6a08ded9e967ede03ff05fa..cbfa168523db062a25c738b76c3112f8634ae343 100644 (file)
@@ -27,6 +27,6 @@
 
 const char *param2text(ParameterError error);
 int SetHTTPrequest(HttpReq req, HttpReq *store);
-void customrequest_helper(HttpReq req, char *method);
+void customrequest_helper(HttpReq req, const char *method);
 
 #endif /* HEADER_CURL_TOOL_HELPERS_H */
index 300826ef26bb4b65b1c3fb22b21757d3f0e6af6f..8eea688b02557fe59e325563e0f110ee9fbed0bf 100644 (file)
@@ -1753,7 +1753,7 @@ static CURLcode check_finished(struct parastate *s)
       struct per_transfer *ended;
       CURL *easy = msg->easy_handle;
       CURLcode tres = msg->data.result;
-      curl_easy_getinfo(easy, CURLINFO_PRIVATE, (void *)&ended);
+      curl_easy_getinfo(easy, CURLINFO_PRIVATE, &ended);
       curl_multi_remove_handle(s->multi, easy);
 
       if(ended->abort && (tres == CURLE_ABORTED_BY_CALLBACK)) {
@@ -2022,7 +2022,7 @@ static CURLcode is_using_schannel(int *pusing)
   if(using_schannel == -1) {
     CURL *curltls = curl_easy_init();
     /* The TLS backend remains, so keep the info */
-    struct curl_tlssessioninfo *tls_backend_info = NULL;
+    const struct curl_tlssessioninfo *tls_backend_info = NULL;
 
     if(!curltls)
       result = CURLE_OUT_OF_MEMORY;
index 8c30d3b651e3dab47254a5146eb7a35eaaaee76d..93c87e10e65936f2c08b8d4cf8043e50a65d6760 100644 (file)
@@ -34,7 +34,7 @@ struct per_transfer {
   struct per_transfer *next;
   struct per_transfer *prev;
   struct OperationConfig *config; /* for this transfer */
-  struct curl_certinfo *certinfo;
+  const struct curl_certinfo *certinfo;
   CURL *curl;
   long retry_remaining;
   long retry_sleep_default;
index ae206f8d5179eca8eaa123ab4f6b7741aee654d1..b36d113232315488f02352660ad0412151f6320f 100644 (file)
@@ -277,7 +277,7 @@ static bool get_line(FILE *input, struct dynbuf *buf, bool *error)
   char buffer[128];
   curlx_dyn_reset(buf);
   while(1) {
-    char *b = fgets(buffer, sizeof(buffer), input);
+    const char *b = fgets(buffer, sizeof(buffer), input);
 
     if(b) {
       size_t rlen = strlen(b);
index fbb8a4fb5eabdffafe7c008762631d047206a601..2700abfa44385e8cc290ed158b5ce01fc69935ef 100644 (file)
@@ -86,7 +86,7 @@ static int urlpart(struct per_transfer *per, writeoutid vid,
   if(uh) {
     CURLUPart cpart = CURLUPART_HOST;
     char *part = NULL;
-    const char *url = NULL;
+    char *url = NULL;
 
     if(vid >= VAR_INPUT_URLESCHEME) {
       if(curl_easy_getinfo(per->curl, CURLINFO_EFFECTIVE_URL, &url))
@@ -162,7 +162,7 @@ static int urlpart(struct per_transfer *per, writeoutid vid,
 static void certinfo(struct per_transfer *per)
 {
   if(!per->certinfo) {
-    struct curl_certinfo *certinfo;
+    const struct curl_certinfo *certinfo;
     CURLcode result = curl_easy_getinfo(per->curl, CURLINFO_CERTINFO,
                                         &certinfo);
     per->certinfo = (!result && certinfo) ? certinfo : NULL;
index 66cf4b8fb7671437ff4d931f8dbf132089a1dfbc..e8d1209ac5c979e5bfa9047d72f121854bc4c900 100644 (file)
@@ -24,7 +24,7 @@
 #include "curl/curl.h"
 #include <stdio.h>
 
-int main(int argc, char **argv)
+int main(int argc, const char **argv)
 {
   (void)argc;
   puts("libcurl test:");
index 31e07aa4273fd73283ae2199db96c5a6330c9809..8a16b01eba5327344e4c808792a64abb6e1790d5 100644 (file)
@@ -60,7 +60,7 @@ static int server_push_callback(CURL *parent,
                                 struct curl_pushheaders *headers,
                                 void *userp)
 {
-  char *headp;
+  const char *headp;
   size_t i;
   int *transfers = (int *)userp;
   char filename[128];
index 500242a7ebd77d718d883d91b3107d05bddf5b78..5a37fcbab313cdee02f8016f4a327f77bfe3ba20 100644 (file)
@@ -211,7 +211,7 @@ static int my_progress_d_cb(void *userdata,
 static int setup_hx_download(CURL *curl, const char *url, struct transfer_d *t,
                              long http_version, struct curl_slist *host,
                              CURLSH *share, int use_earlydata,
-                             int fresh_connect, char *cafile)
+                             int fresh_connect, const char *cafile)
 {
   curl_easy_setopt(curl, CURLOPT_SHARE, share);
   curl_easy_setopt(curl, CURLOPT_URL, url);
index 3320a983ca3be60c793fba300d11805a5655c1fb..f6fe44c5e94cd6fe2b449eb3d6034fac1532df9d 100644 (file)
@@ -41,8 +41,8 @@ static CURLcode test_lib1518(const char *URL)
   CURLcode result = CURLE_OK;
   long curlResponseCode;
   long curlRedirectCount;
-  char *effectiveUrl = NULL;
-  char *redirectUrl = NULL;
+  const char *effectiveUrl = NULL;
+  const char *redirectUrl = NULL;
   CURLU *urlu = NULL;
   curl = curl_easy_init();
   if(!curl) {
index 7f2e415414991bd26b6d7fddae50ed2f7bc889ac..9debd78807f70c91a677a1875b83752e980bb28b 100644 (file)
@@ -28,7 +28,7 @@
 static CURLcode test_lib1536(const char *URL)
 {
   CURL *curl, *dupe = NULL;
-  char *scheme;
+  const char *scheme;
   CURLcode result = CURLE_OK;
 
   global_init(CURL_GLOBAL_ALL);
index c880902940eed00ed6836fefdca349c583b641e1..1b329f7cfd27342537c63e39de7b3518ebb2ab82 100644 (file)
@@ -1150,7 +1150,7 @@ static const struct setcase set_parts_list[] = {
   {NULL, NULL, NULL, 0, 0, CURLUE_OK, CURLUE_OK}
 };
 
-static CURLUPart part2id(char *part)
+static CURLUPart part2id(const char *part)
 {
   if(!strcmp("url", part))
     return CURLUPART_URL;
index 5813cca4ea4892f2d7e8cfd51238b7a31dcc3fc6..608ba4e8b6d15f5a76a0f011698410e3c40a0a8d 100644 (file)
@@ -29,7 +29,7 @@ static CURLcode test_lib1977(const char *URL)
   CURLU *curlu = curl_url();
   CURLU *curlu_2 = curl_url();
   CURL *curl;
-  char *effective = NULL;
+  const char *effective = NULL;
 
   global_init(CURL_GLOBAL_ALL);
   easy_init(curl);
index 5c7104a41433afb27997ce07e6f88ad1f17784ac..7a668b0751333284ebcbd324078ea755d0ffccc9 100644 (file)
@@ -28,7 +28,7 @@ static CURLcode test_lib3010(const char *URL)
   CURLcode result = TEST_ERR_MAJOR_BAD;
   CURL *curl = NULL;
   curl_off_t retry_after;
-  char *follow_url = NULL;
+  const char *follow_url = NULL;
 
   curl_global_init(CURL_GLOBAL_ALL);
   curl = curl_easy_init();
index 8313d54be0578c9729d118af96d7fd77519465ae..90095adc2b448b5dd4ed53accf6f7ffb99f35b98 100644 (file)
@@ -29,7 +29,7 @@
  */
 static bool is_chain_in_order(struct curl_certinfo *cert_info)
 {
-  char *last_issuer = NULL;
+  const char *last_issuer = NULL;
   int cert;
 
   /* Chains with only a single certificate are always in order */
@@ -39,8 +39,8 @@ static bool is_chain_in_order(struct curl_certinfo *cert_info)
   /* Enumerate each certificate in the chain */
   for(cert = 0; cert < cert_info->num_of_certs; cert++) {
     struct curl_slist *slist = cert_info->certinfo[cert];
-    char *issuer = NULL;
-    char *subject = NULL;
+    const char *issuer = NULL;
+    const char *subject = NULL;
 
     /* Find the certificate issuer and subject by enumerating each field */
     for(; slist && (!issuer || !subject); slist = slist->next) {
index 7b8f947df6167df6d1dc237abe7bed7c048e26ea..c764add27f5038e6fd21b4972c7e204f601e8d6c 100644 (file)
@@ -46,7 +46,7 @@ static size_t write_memory_callback(char *contents, size_t size,
   /* append the data to contents */
   size_t realsize = size * nmemb;
   struct Ctx *mem = (struct Ctx *)userp;
-  char *data = (char *)curlx_malloc(realsize + 1);
+  char *data = curlx_malloc(realsize + 1);
   struct curl_slist *item_append = NULL;
   if(!data) {
     curl_mprintf("not enough memory (malloc returned NULL)\n");
index 79302203146ca1e2946b3d51c33a1640b9953133..71b1eaed8fe33cdff166d249804ea722d1c59eb0 100644 (file)
@@ -55,7 +55,7 @@ static CURLcode test_lib500(const char *URL)
 {
   CURLcode result;
   CURL *curl;
-  char *ipstr = NULL;
+  const char *ipstr = NULL;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
     curl_mfprintf(stderr, "curl_global_init() failed\n");
index 211dd6bcc194aed89f51273f0dfe7590dc719f4b..e29b7d71ee15c019f86913685de6a81159b6a660 100644 (file)
@@ -33,7 +33,6 @@ static CURLcode test_lib569(const char *URL)
   CURLcode result;
   CURL *curl;
   char *stream_uri = NULL;
-  char *rtsp_session_id;
   int request = 1;
   int i;
 
@@ -74,6 +73,7 @@ static CURLcode test_lib569(const char *URL)
 
   /* Go through the various Session IDs */
   for(i = 0; i < 3; i++) {
+    const char *rtsp_session_id;
     stream_uri = tutil_suburl(URL, request++);
     if(!stream_uri) {
       result = TEST_ERR_MAJOR_BAD;
index 0a0c48b2f280819eb780a2c59692d2fcfd12a3c9..3430ca1f1929723f217217fb516ab9e39830fe57 100755 (executable)
@@ -209,7 +209,7 @@ print $fh <<HEADER
 /* This source code is generated by mk-lib1521.pl ! */
 
 struct t1521_testdata {
-  char *blaha;
+  const char *blaha;
 };
 
 #define LO $minlong
@@ -364,12 +364,12 @@ static CURLcode test_lib1521(const char *URL)
   FILE *stream = stderr;
   struct t1521_testdata object;
   CURLU *curlu = (CURLU *)&object;
-  char *charp;
+  const char *charp;
   long val;
   curl_off_t oval;
   double dval;
   curl_socket_t sockfd;
-  struct curl_certinfo *certinfo;
+  const struct curl_certinfo *certinfo;
   struct curl_tlssessioninfo *tlssession;
   struct curl_blob blob = { CURL_UNCONST("silly"), 5, 0};
   CURLcode result = CURLE_OK;
index 7734b7d52d1241456503383f84fbde8df99e06a0..2433c8488978f9142207248fd8e6f14c5881ff50 100644 (file)
@@ -87,7 +87,7 @@ int libtest_debug_cb(CURL *curl, curl_infotype type,
   struct libtest_trace_cfg *trace_cfg = userp;
   const char *text;
   char timebuf[20];
-  char *timestr;
+  const char *timestr;
 
   (void)curl;
 
index cd402191e11f56f58c1aa1827d45fb5a6b538a86..a48b176b384f939dcab2537e62dacb87fc9b1c44 100644 (file)
@@ -233,7 +233,7 @@ static unsigned char ancount_aaaa;
 /* this is an answer to a question */
 static int send_response(curl_socket_t sock,
                          const struct sockaddr *addr, curl_socklen_t addrlen,
-                         unsigned char *qbuf, size_t qlen,
+                         const unsigned char *qbuf, size_t qlen,
                          unsigned short qtype, unsigned short id)
 {
   ssize_t rc;
@@ -378,7 +378,7 @@ static void read_instructions(void)
     logmsg("Error opening file '%s'", file);
 }
 
-static int test_dnsd(int argc, char **argv)
+static int test_dnsd(int argc, const char **argv)
 {
   srvr_sockaddr_union_t me;
   ssize_t n = 0;
index a25de1759ac672de3bbd835121c4ed6095e69910..c5761724988543783a781fefe180ee9703aefd59 100644 (file)
 
 #include <stdio.h>
 
-int main(int argc, char **argv)
+int main(int argc, const char **argv)
 {
   entry_func_t entry_func;
-  char *entry_name;
+  const char *entry_name;
   size_t tmp;
 
   if(argc < 2) {
index 0d0dc30a0e98d6103e9b19ecd1c9272e2f0c2221..1de25f6863a70866c72e0ee96b071148ddd2db4e 100644 (file)
@@ -39,7 +39,7 @@
 
 #include "curl_setup.h"
 
-typedef int (*entry_func_t)(int, char **);
+typedef int (*entry_func_t)(int, const char **);
 
 struct entry_s {
   const char *name;
@@ -125,9 +125,8 @@ extern int getpart(char **outbuf, size_t *outlen,
                    const char *main, const char *sub, FILE *stream);
 
 /* utility functions */
-extern char *data_to_hex(char *data, size_t len);
 extern void logmsg(const char *msg, ...) CURL_PRINTF(1, 2);
-extern void loghex(unsigned char *buffer, ssize_t len);
+extern void loghex(const unsigned char *buffer, ssize_t len);
 extern int win32_init(void);
 extern FILE *test2fopen(long testno, const char *logdir2);
 extern curl_off_t our_getpid(void);
index 9a9c12a38dfc781e387db1fe59f235fd02ac4be2..2f276e0ad5eb7f9b16037b3fe9f5f1e83bda222b 100644 (file)
@@ -141,12 +141,13 @@ static int readline(char **buffer, size_t *bufsize, size_t *length,
  *   GPE_OUT_OF_MEMORY
  *   GPE_OK
  */
-static int appenddata(char  **dst_buf,   /* dest buffer */
-                      size_t *dst_len,   /* dest buffer data length */
-                      size_t *dst_alloc, /* dest buffer allocated size */
-                      char   *src_buf,   /* source buffer */
-                      size_t  src_len,   /* source buffer length */
-                      int     src_b64)   /* != 0 if source is base64 encoded */
+static int appenddata(char **dst_buf,      /* dest buffer */
+                      size_t *dst_len,     /* dest buffer data length */
+                      size_t *dst_alloc,   /* dest buffer allocated size */
+                      const char *src_buf, /* source buffer */
+                      size_t src_len,      /* source buffer length */
+                      int src_b64)         /* != 0 if source is base64
+                                              encoded */
 {
   size_t need_alloc = 0;
 
@@ -182,7 +183,7 @@ static int appenddata(char  **dst_buf,   /* dest buffer */
   return GPE_OK;
 }
 
-static int decodedata(char  **buf, /* dest buffer */
+static int decodedata(char **buf,  /* dest buffer */
                       size_t *len) /* dest buffer data length */
 {
   CURLcode result = CURLE_OK;
index eca4cb3f7a2975d3662ec8b79456b8bff5970fc4..3e50b351df467b76bc4fa516695e15af3e8ea9b6 100644 (file)
@@ -131,11 +131,11 @@ typedef enum {
 static void logprotocol(mqttdir dir,
                         const char *prefix, size_t remlen,
                         FILE *output,
-                        unsigned char *buffer, ssize_t len)
+                        const unsigned char *buffer, ssize_t len)
 {
   char data[12000] = "";
   ssize_t i;
-  unsigned char *ptr = buffer;
+  const unsigned char *ptr = buffer;
   char *optr = data;
   int left = sizeof(data);
 
@@ -279,7 +279,7 @@ static size_t encode_length(size_t packetlen,
   return bytes;
 }
 
-static size_t decode_length(unsigned char *buffer,
+static size_t decode_length(const unsigned char *buffer,
                             size_t buflen, size_t *lenbytes)
 {
   size_t len = 0;
@@ -712,7 +712,7 @@ static bool mqttd_incoming(curl_socket_t listenfd)
   return TRUE;
 }
 
-static int test_mqttd(int argc, char *argv[])
+static int test_mqttd(int argc, const char *argv[])
 {
   curl_socket_t sock = CURL_SOCKET_BAD;
   curl_socket_t msgsock = CURL_SOCKET_BAD;
index 3abcbcb33d63cc6567a2a6fa56bb9c3e5780be0e..ac72cddd3a8b2dc71d2b4efe5ec4ebef48371bae 100644 (file)
@@ -33,7 +33,7 @@
  *
  */
 
-static int test_resolve(int argc, char *argv[])
+static int test_resolve(int argc, const char *argv[])
 {
   int arg = 1;
   const char *host = NULL;
index c3878ea67a982a9b44df45c690ce51ee6d5138b1..69074fb7699b7ddbf0240e96a70c79497c18972a 100644 (file)
@@ -143,7 +143,7 @@ static const char *RTP_DATA = "$_1234\n\0Rsdf";
 
 static int rtspd_ProcessRequest(struct rtspd_httprequest *req)
 {
-  char *line = &req->reqbuf[req->checkindex];
+  const char *line = &req->reqbuf[req->checkindex];
   bool chunked = FALSE;
   static char request[REQUEST_KEYWORD_SIZE];
   static char doc[MAXDOCNAMELEN];
@@ -539,7 +539,7 @@ static int rtspd_ProcessRequest(struct rtspd_httprequest *req)
 }
 
 /* store the entire request in a file */
-static void rtspd_storerequest(char *reqbuf, size_t totalsize)
+static void rtspd_storerequest(const char *reqbuf, size_t totalsize)
 {
   int res;
   int error = 0;
@@ -997,7 +997,7 @@ static int rtspd_send_doc(curl_socket_t sock, struct rtspd_httprequest *req)
   return 0;
 }
 
-static int test_rtspd(int argc, char *argv[])
+static int test_rtspd(int argc, const char *argv[])
 {
   srvr_sockaddr_union_t me;
   curl_socket_t sock = CURL_SOCKET_BAD;
index 9d132b939273f1d9749d9280458f4db8cb30e18b..008c37234d4e273e4fd7d74443e4df2c8aaa7377 100644 (file)
@@ -313,11 +313,11 @@ static bool write_stdout(const void *buffer, size_t nbytes)
   return TRUE;
 }
 
-static void lograw(unsigned char *buffer, ssize_t len)
+static void lograw(const unsigned char *buffer, ssize_t len)
 {
   char data[120];
   ssize_t i;
-  unsigned char *ptr = buffer;
+  const unsigned char *ptr = buffer;
   char *optr = data;
   ssize_t width = 0;
   int left = sizeof(data);
@@ -372,7 +372,7 @@ static bool read_data_block(unsigned char *buffer, ssize_t maxlen,
 
   buffer[5] = '\0';
 
-  endp = (char *)buffer;
+  endp = (const char *)buffer;
   if(curlx_str_hex(&endp, &value, 0xfffff)) {
     logmsg("Failed to decode buffer size");
     return FALSE;
@@ -1066,7 +1066,7 @@ static bool juggle(curl_socket_t *sockfdp,
          Replies to PORT with "IPv[num]/[port]" */
       snprintf((char *)buffer, sizeof(buffer), "%s/%hu\n",
                ipv_inuse, server_port);
-      buffer_len = (ssize_t)strlen((char *)buffer);
+      buffer_len = (ssize_t)strlen((const char *)buffer);
       snprintf(data, sizeof(data), "PORT\n%04x\n", (int)buffer_len);
       if(!write_stdout(data, 10))
         return FALSE;
@@ -1171,7 +1171,7 @@ static bool juggle(curl_socket_t *sockfdp,
   return TRUE;
 }
 
-static int test_sockfilt(int argc, char *argv[])
+static int test_sockfilt(int argc, const char *argv[])
 {
   srvr_sockaddr_union_t me;
   curl_socket_t sock = CURL_SOCKET_BAD;
index 9875a2b7a96e75cad1b96e226a287b5706afa2c9..783cbd16ba3f7ea05c69d1435eb99a0761b9c1c2 100644 (file)
@@ -238,7 +238,7 @@ static curl_socket_t socksconnect(unsigned short connectport,
 }
 
 static curl_socket_t socks4(curl_socket_t fd,
-                            unsigned char *buffer,
+                            const unsigned char *buffer,
                             ssize_t rc)
 {
   unsigned char response[256 + 16];
@@ -299,7 +299,7 @@ static curl_socket_t sockit(curl_socket_t fd)
   unsigned char len;
   unsigned char type;
   unsigned char rep = 0;
-  unsigned char *address;
+  const unsigned char *address;
   unsigned short socksport;
   curl_socket_t connfd = CURL_SOCKET_BAD;
   unsigned short s5port;
@@ -502,7 +502,7 @@ static curl_socket_t sockit(curl_socket_t fd)
   }
 
   if(!s_config.port) {
-    unsigned char *portp = &buffer[SOCKS5_DSTADDR + len];
+    const unsigned char *portp = &buffer[SOCKS5_DSTADDR + len];
     s5port = (unsigned short)((portp[0] << 8) | (portp[1]));
   }
   else
@@ -726,7 +726,7 @@ static bool socksd_incoming(curl_socket_t listenfd)
   return TRUE;
 }
 
-static int test_socksd(int argc, char *argv[])
+static int test_socksd(int argc, const char *argv[])
 {
   curl_socket_t sock = CURL_SOCKET_BAD;
   curl_socket_t msgsock = CURL_SOCKET_BAD;
index 297cd58174b90dc5373c6cd35ba5a9ba2f14f194..919d16f8160579826feff279fe8566a6ddf88fb7 100644 (file)
@@ -156,6 +156,33 @@ static const char *doc404 =
   "<P><HR><ADDRESS>" SWSVERSION "</ADDRESS>\n"
   "</BODY></HTML>\n";
 
+/* This function returns a pointer to STATIC memory. It converts the given
+ * binary lump to a hex formatted string usable for output in logs or
+ * whatever.
+ */
+static char *data_to_hex(const char *data, size_t len)
+{
+  static char buf[256 * 3];
+  size_t i;
+  char *optr = buf;
+  const char *iptr = data;
+
+  if(len > 255)
+    len = 255;
+
+  for(i = 0; i < len; i++) {
+    if((data[i] >= 0x20) && (data[i] < 0x7f))
+      *optr++ = *iptr++;
+    else {
+      snprintf(optr, 4, "%%%02x", (unsigned char)*iptr++);
+      optr += 3;
+    }
+  }
+  *optr = 0; /* in case no sprintf was used */
+
+  return buf;
+}
+
 /* work around for handling trailing headers */
 static int already_recv_zeroed_chunk = FALSE;
 
@@ -303,7 +330,7 @@ static int sws_parse_servercmd(struct sws_httprequest *req)
 
 static int sws_ProcessRequest(struct sws_httprequest *req)
 {
-  char *line = &req->reqbuf[req->checkindex];
+  const char *line = &req->reqbuf[req->checkindex];
   bool chunked = FALSE;
   static char request[REQUEST_KEYWORD_SIZE];
   int prot_major = 0;
@@ -331,7 +358,7 @@ static int sws_ProcessRequest(struct sws_httprequest *req)
   else if(req->testno == DOCNUMBER_NOTHING) {
     const char *http;
     bool fine = FALSE;
-    char *httppath = NULL;
+    const char *httppath = NULL;
     size_t npath = 0; /* httppath length */
 
     if(sscanf(line, "%" REQUEST_KEYWORD_SIZE_TXT "s ", request) == 1) {
@@ -357,7 +384,7 @@ static int sws_ProcessRequest(struct sws_httprequest *req)
     }
 
     if(fine) {
-      char *ptr;
+      const char *ptr;
 
       req->prot_version = prot_major * 10 + prot_minor;
 
@@ -476,7 +503,7 @@ static int sws_ProcessRequest(struct sws_httprequest *req)
         sws_parse_servercmd(req);
     }
     else if((req->offset >= 3)) {
-      unsigned char *l = (unsigned char *)line;
+      const unsigned char *l = (const unsigned char *)line;
       logmsg("** Unusual request. Starts with %02x %02x %02x (%c%c%c)",
              l[0], l[1], l[2], l[0], l[1], l[2]);
     }
@@ -1934,7 +1961,7 @@ static int service_connection(curl_socket_t *msgsock,
   return -1;
 }
 
-static int test_sws(int argc, char *argv[])
+static int test_sws(int argc, const char *argv[])
 {
   srvr_sockaddr_union_t me;
   curl_socket_t sock = CURL_SOCKET_BAD;
index ff894bd4308d95906c1fa72e056bbda573acb43c..91e1b7f7bb779a2e4e3555d4fb4821723e011512 100644 (file)
@@ -111,14 +111,14 @@ struct tftphdr {
  *****************************************************************************/
 
 struct testcase {
-  char *buffer;   /* holds the file data to send to the client */
-  size_t bufsize; /* size of the data in buffer */
-  char *rptr;     /* read pointer into the buffer */
-  size_t rcount;  /* amount of data left to read of the file */
-  long testno;    /* test case number */
-  int ofile;      /* file descriptor for output file when uploading to us */
-
-  int writedelay; /* number of seconds between each packet */
+  char *buffer;     /* holds the file data to send to the client */
+  size_t bufsize;   /* size of the data in buffer */
+  const char *rptr; /* read pointer into the buffer */
+  size_t rcount;    /* amount of data left to read of the file */
+  long testno;      /* test case number */
+  int ofile;        /* file descriptor for output file when uploading to us */
+
+  int writedelay;   /* number of seconds between each packet */
 };
 
 struct formats {
@@ -889,7 +889,8 @@ static int do_tftp(struct testcase *test, struct tftphdr *tp, ssize_t size)
   char *cp;
   int first = 1, ecode;
   const struct formats *pf;
-  char *filename, *mode = NULL;
+  const char *filename;
+  char *mode = NULL;
 #ifdef USE_WINSOCK
   DWORD recvtimeout, recvtimeoutbak;
 #endif
@@ -1004,7 +1005,7 @@ static int do_tftp(struct testcase *test, struct tftphdr *tp, ssize_t size)
   return 0;
 }
 
-static int test_tftpd(int argc, char **argv)
+static int test_tftpd(int argc, const char **argv)
 {
   srvr_sockaddr_union_t me;
   struct tftphdr *tp;
index 880fd90146e42bce58dd13d1bf3433f8bfdaa4bb..41fa39c61951c4346285b6515f60233e588e7044 100644 (file)
 #include <share.h>
 #endif
 
-/* This function returns a pointer to STATIC memory. It converts the given
- * binary lump to a hex formatted string usable for output in logs or
- * whatever.
- */
-char *data_to_hex(char *data, size_t len)
-{
-  static char buf[256 * 3];
-  size_t i;
-  char *optr = buf;
-  char *iptr = data;
-
-  if(len > 255)
-    len = 255;
-
-  for(i = 0; i < len; i++) {
-    if((data[i] >= 0x20) && (data[i] < 0x7f))
-      *optr++ = *iptr++;
-    else {
-      snprintf(optr, 4, "%%%02x", (unsigned char)*iptr++);
-      optr += 3;
-    }
-  }
-  *optr = 0; /* in case no sprintf was used */
-
-  return buf;
-}
-
-void loghex(unsigned char *buffer, ssize_t len)
+void loghex(const unsigned char *buffer, ssize_t len)
 {
   char data[12000];
   ssize_t i;
-  unsigned char *ptr = buffer;
+  const unsigned char *ptr = buffer;
   char *optr = data;
   ssize_t width = 0;
   int left = sizeof(data);
index 3b0d2bf2b551e399cf64f626833ff4a0374a827e..32f77f1926d3b0e2ac53af8ca5d16cdd289c8909 100644 (file)
@@ -125,7 +125,7 @@ static CURLcode test_unit1302(const char *arg)
   };
 
   for(i = 0; i < CURL_ARRAYSIZE(encode); i++) {
-    struct etest *e = &encode[i];
+    const struct etest *e = &encode[i];
     char *out;
     unsigned char *decoded;
     size_t olen;
@@ -164,7 +164,7 @@ static CURLcode test_unit1302(const char *arg)
   }
 
   for(i = 0; i < CURL_ARRAYSIZE(url); i++) {
-    struct etest *e = &url[i];
+    const struct etest *e = &url[i];
     char *out;
     size_t olen;
     result = curlx_base64url_encode((const uint8_t *)e->input, e->ilen,
index ce99379d6bb6569f293b66d3dc5cdcf8eb774a4f..4b53b4e36bf474b1b8d4a520f454b536f42c5329 100644 (file)
@@ -54,7 +54,8 @@ static CURLcode test_unit1600(const char *arg)
 #if defined(USE_NTLM) &&                                    \
   (!defined(USE_WINDOWS_SSPI) || defined(USE_WIN32_CRYPTO))
   unsigned char output[21];
-  unsigned char *testp = output;
+  const unsigned char *testp = output;
+
   Curl_ntlm_core_mk_nt_hash("1", output);
 
   verify_memory(testp,
index 9b0b38486ff94d64c25defdaf0530fe728f72524..1e3cf096be59636b0de83097b86ab35de1096b91 100644 (file)
@@ -35,7 +35,7 @@ static CURLcode test_unit1601(const char *arg)
   static const char string1[] = "1";
   static const char string2[] = "hello-you-fool";
   unsigned char output[MD5_DIGEST_LEN];
-  unsigned char *testp = output;
+  const unsigned char *testp = output;
 
   Curl_md5it(output, (const unsigned char *)string1, strlen(string1));
 
index 81db398cb19e4836bb421700674dea7368d92f58..ed6be10516908dcdbceeccc79764a6b8ed085916 100644 (file)
@@ -66,7 +66,7 @@ static CURLcode test_unit1603(const char *arg)
   char key3[] = "key3";
   char key4[] = "key4";
   char notakey[] = "notakey";
-  char *nodep;
+  const char *nodep;
   int rc;
 
   /* Ensure the key hashes are as expected in order to test both hash
index 346b0a5494694ab9327c847c08577a223a616f09..a46b7d965bb82cad1b9ea0bfa83d22f0502d3934 100644 (file)
@@ -42,7 +42,7 @@ static CURLcode test_unit1610(const char *arg)
   static const char string1[] = "1";
   static const char string2[] = "hello-you-fool";
   unsigned char output[CURL_SHA256_DIGEST_LENGTH];
-  unsigned char *testp = output;
+  const unsigned char *testp = output;
 
   Curl_sha256it(output, (const unsigned char *)string1, strlen(string1));
 
index fbff7f9211dd1b0e0019cf8720912d45ac58ab5e..2b483dbd6c4f41ef923c7121bc2dabd1646f034c 100644 (file)
@@ -33,7 +33,7 @@ static CURLcode test_unit1611(const char *arg)
   static const char string1[] = "1";
   static const char string2[] = "hello-you-fool";
   unsigned char output[MD4_DIGEST_LENGTH];
-  unsigned char *testp = output;
+  const unsigned char *testp = output;
 
   Curl_md4it(output, (const unsigned char *)string1, strlen(string1));
 
index 313ca0f32934668e87d1e11075f40c3b76ea0c46..dd6f9e0fc08070a829fbb29af1782e59fd4f86d0 100644 (file)
@@ -37,7 +37,7 @@ static CURLcode test_unit1612(const char *arg)
   static const char string1[] = "1";
   static const char string2[] = "hello-you-fool";
   unsigned char output[HMAC_MD5_LENGTH];
-  unsigned char *testp = output;
+  const unsigned char *testp = output;
 
   Curl_hmacit(&Curl_HMAC_MD5,
               (const unsigned char *)password, strlen(password),
index 93237db274497c69113cdc631c07cf7e216a24b9..cfb1997f1cc1ed7c91709f6b93477d52e93feeff 100644 (file)
@@ -109,7 +109,7 @@ static CURLcode test_unit1615(const char *arg)
   };
 
   unsigned char output_buf[CURL_SHA512_256_DIGEST_LENGTH];
-  unsigned char *computed_hash; /* Just to mute compiler warning */
+  const unsigned char *computed_hash; /* Just to mute compiler warning */
 
   /* Mute compiler warnings in 'verify_memory' macros below */
   computed_hash = output_buf;
index c9bb5745c7b727077043f51b17aabc5773cd3c3a..8c979cac588c18611c2d3ed35580f6adff7b15a0 100644 (file)
@@ -224,10 +224,11 @@ static CURLcode test_unit1650(const char *arg)
       ptr += o;
     }
     de_cleanup(&d);
-    if(resp[i].out && strcmp((char *)buffer, resp[i].out)) {
+    if(resp[i].out && strcmp((const char *)buffer, resp[i].out)) {
       curl_mfprintf(stderr, "resp %zu: Expected %s got %s\n", i,
                     resp[i].out, buffer);
-      abort_if(resp[i].out && strcmp((char *)buffer, resp[i].out), "content");
+      abort_if(resp[i].out && strcmp((const char *)buffer, resp[i].out),
+               "content");
     }
   }
 
@@ -271,9 +272,9 @@ static CURLcode test_unit1650(const char *arg)
     p = &a->ip.v4[0];
     curl_msnprintf((char *)buffer, sizeof(buffer),
                    "%u.%u.%u.%u", p[0], p[1], p[2], p[3]);
-    if(rc || strcmp((char *)buffer, "127.0.0.1")) {
+    if(rc || strcmp((const char *)buffer, "127.0.0.1")) {
       curl_mfprintf(stderr, "bad address decoded: %s, rc == %d\n", buffer, rc);
-      abort_if(rc || strcmp((char *)buffer, "127.0.0.1"), "bad address");
+      abort_if(rc || strcmp((const char *)buffer, "127.0.0.1"), "bad address");
     }
     fail_if(d.numcname, "bad cname counter");
   }
index 7ea7e380a80b23b1b0683ac893485e334863c731..4c9c03d9cb37b14623572ecad13daf8c3f5876e8 100644 (file)
@@ -27,7 +27,7 @@
 #include "curl/urlapi.h"
 #include "urlapi-int.h"
 
-static CURLUcode parse_port(CURLU *url, char *h, bool has_scheme)
+static CURLUcode parse_port(CURLU *url, const char *h, bool has_scheme)
 {
   struct dynbuf host;
   CURLUcode ret;
index 067bd53900e1dd0ad4371979bdc9ac90e4b651b1..e7f753a4d032ac65137230e77a38eb560f1cfc69 100644 (file)
@@ -52,7 +52,7 @@ static char rrbuffer[256];
 static void rrresults(struct Curl_https_rrinfo *rr, CURLcode res)
 {
   char *p = rrbuffer;
-  char *pend = rrbuffer + sizeof(rrbuffer);
+  const char *pend = rrbuffer + sizeof(rrbuffer);
   curl_msnprintf(rrbuffer, sizeof(rrbuffer), "r:%d|", (int)res);
   p += strlen(rrbuffer);
 
index 796099d5928052f2dd7c0b172e48b01ab130b967..943abfed65a8fe03c5e6956538267d55631c7251 100644 (file)
@@ -109,7 +109,7 @@ static CURLcode test_unit1979(const char *arg)
     struct dynbuf canonical_path;
 
     char buffer[1024];
-    char *canonical_path_string;
+    const char *canonical_path_string;
     int result;
     int msnprintf_result;
 
index 82bea8415a9f90d40d1babdabd93d65c0985601f..9fa10c538c7edac098e05c538140cf6e42fa012e 100644 (file)
@@ -82,7 +82,7 @@ static CURLcode test_unit1980(const char *arg)
     struct dynbuf canonical_query;
 
     char buffer[1024];
-    char *canonical_query_ptr;
+    const char *canonical_query_ptr;
     int result;
     int msnprintf_result;
 
index 46c9b13a3f4cf9bc7987e00d9996a2a96513c5af..8c808bd64b383f521155ad68727a2b95a3e0d3fa 100644 (file)
@@ -80,7 +80,7 @@ static CURLcode test_unit3200(const char *arg)
     FILE *fp;
     struct dynbuf buf;
     size_t len = 4096;
-    char *line;
+    const char *line;
     bool eof;
     curlx_dyn_init(&buf, len);
 
index f4d9ab82dae1da84e4164190182da00b21c24742..aa2d6b94a35eebd0de072b9f2b65a855f0b90885 100644 (file)
@@ -562,11 +562,11 @@ static CURLcode test_unit3205(const char *arg)
     if(test->id >= 0x0011 && test->id < 0x0017) {
       if(expect && memcmp(expect, "EDH-", 4) == 0) {
         curlx_strcopy(alt, sizeof(alt), expect, strlen(expect));
-        expect = (char *)memcpy(alt, "DHE-", 4);
+        expect = (const char *)memcpy(alt, "DHE-", 4);
       }
       if(expect && memcmp(expect + 4, "EDH-", 4) == 0) {
         curlx_strcopy(alt, sizeof(alt), expect, strlen(expect));
-        expect = (char *)memcpy(alt + 4, "DHE-", 4) - 4;
+        expect = (const char *)memcpy(alt + 4, "DHE-", 4) - 4;
       }
     }