]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
examples/usercertinmem: avoid stripping const
authorViktor Szakats <commit@vsz.me>
Tue, 7 Oct 2025 10:04:03 +0000 (12:04 +0200)
committerViktor Szakats <commit@vsz.me>
Tue, 7 Oct 2025 11:12:24 +0000 (13:12 +0200)
This API started accepting a const somewhere between OpenSSL 1.0.2b and
1.0.2t. It means this example, like the other similar one now works best
with those versions or newer:
```
docs/examples/usercertinmem.c:100:33: error: cast from 'const char *' to 'char *' drops const qualifier [-Werror,-Wcast-qual]
  100 |   bio = BIO_new_mem_buf((char *)mypem, -1);
      |                                 ^
docs/examples/usercertinmem.c:121:34: error: cast from 'const char *' to 'char *' drops const qualifier [-Werror,-Wcast-qual]
  121 |   kbio = BIO_new_mem_buf((char *)mykey, -1);
      |                                  ^
```

Closes #18908

docs/examples/usercertinmem.c

index 670ae4dc718e13faade6f4d3b5377905eb16169b..50537ae25fdc86d7d9eb07fdf91017df924ca913 100644 (file)
@@ -97,7 +97,7 @@ static CURLcode sslctx_function(CURL *curl, void *sslctx, void *pointer)
   (void)pointer;
 
   /* get a BIO */
-  bio = BIO_new_mem_buf((char *)mypem, -1);
+  bio = BIO_new_mem_buf(mypem, -1);
 
   if(!bio) {
     printf("BIO_new_mem_buf failed\n");
@@ -118,7 +118,7 @@ static CURLcode sslctx_function(CURL *curl, void *sslctx, void *pointer)
   }
 
   /* create a bio for the RSA key */
-  kbio = BIO_new_mem_buf((char *)mykey, -1);
+  kbio = BIO_new_mem_buf(mykey, -1);
   if(!kbio) {
     printf("BIO_new_mem_buf failed\n");
   }