mirror of
https://github.com/curl/curl.git
synced 2026-08-25 02:53:32 +03:00
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:
parent
66bb641331
commit
9630593650
111 changed files with 278 additions and 268 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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[] = {
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue