build: use more const

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
This commit is contained in:
Viktor Szakats 2026-02-01 03:57:45 +01:00
parent 66bb641331
commit 9630593650
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
111 changed files with 278 additions and 268 deletions

View 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 */