mirror of
https://github.com/curl/curl.git
synced 2026-07-31 07:58:04 +03:00
tidy-up: minor code fixes and improvements
- schannel: drop redundant parentheses. - os400sys: drop redundant includes. Follow-up toebc5212dac#22374 - pytest: replace `()` with `[]` to match rest of tests. - libtests: constify some local pointers. - libtests: drop redundant `(long)` casts. - lib650: use `CURL_CSTRLEN()`. Follow-up to59dc2bbe07#22424 Closes #22444
This commit is contained in:
parent
c4013cdb85
commit
b84838073c
11 changed files with 11 additions and 13 deletions
|
|
@ -921,7 +921,7 @@ static CURLcode schannel_connect_step1(struct Curl_cfilter *cf,
|
|||
|
||||
/* The first four bytes is an unsigned int indicating number
|
||||
of bytes of data in the rest of the buffer. */
|
||||
extension_len = (unsigned int *)(void *)(&alpn_buffer[cur]);
|
||||
extension_len = (unsigned int *)(void *)&alpn_buffer[cur];
|
||||
cur += (int)sizeof(unsigned int);
|
||||
|
||||
/* The next four bytes are an indicator that this buffer contains
|
||||
|
|
@ -932,7 +932,7 @@ static CURLcode schannel_connect_step1(struct Curl_cfilter *cf,
|
|||
|
||||
/* The next two bytes is an unsigned short indicating the number
|
||||
of bytes used to list the preferred protocols. */
|
||||
list_len = (unsigned short *)(void *)(&alpn_buffer[cur]);
|
||||
list_len = (unsigned short *)(void *)&alpn_buffer[cur];
|
||||
cur += (int)sizeof(unsigned short);
|
||||
|
||||
list_start_index = cur;
|
||||
|
|
|
|||
|
|
@ -28,8 +28,6 @@
|
|||
#include <curl/curl.h>
|
||||
#include "config-os400.h" /* Not curl_setup.h: we only need some defines. */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
|
|
|||
|
|
@ -718,7 +718,7 @@ class TestDownload:
|
|||
# or destroys the connection with internal error
|
||||
# ERR_QPACK_HEADER_TOO_LARGE,
|
||||
# depending on nghttp3 version and payload size
|
||||
assert r.exit_code in (0, 56), f'expected exit code 0 or 56, '\
|
||||
assert r.exit_code in [0, 56], f'expected exit code 0 or 56, '\
|
||||
f'got {r.exit_code}\n{r.dump_logs()}'
|
||||
if r.exit_code == 0:
|
||||
r.check_response(http_status=431)
|
||||
|
|
|
|||
|
|
@ -298,7 +298,7 @@ class TestResolve:
|
|||
'--connect-timeout', '1'
|
||||
])
|
||||
# should fail with CURLE_OPERATION_TIMEOUT or COULDNT_CONNECT
|
||||
assert r.exit_code in (7, 28), f'{r.dump_logs()}'
|
||||
assert r.exit_code in [7, 28], f'{r.dump_logs()}'
|
||||
af_unspec_resolves = [
|
||||
line for line in r.trace_lines
|
||||
if re.match(r'.* \[DNS] re-queueing query .+ for AF_UNSPEC resolve', line)
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ static CURLcode test_lib1549(const char *URL)
|
|||
result = curl_easy_getinfo(curl, CURLINFO_COOKIELIST, &cookies);
|
||||
if(!result && cookies) {
|
||||
/* a linked list of cookies in cookie file format */
|
||||
struct curl_slist *each = cookies;
|
||||
const struct curl_slist *each = cookies;
|
||||
while(each) {
|
||||
curl_mprintf("%s\n", each->data);
|
||||
each = each->next;
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ static CURLcode test_lib1582(const char *URL)
|
|||
easy_setopt(curl, CURLOPT_HEADER, 1L);
|
||||
easy_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
easy_setopt(curl, CURLOPT_URL, URL);
|
||||
easy_setopt(curl, CURLOPT_HTTPAUTH, (long)CURLAUTH_NEGOTIATE);
|
||||
easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_NEGOTIATE);
|
||||
easy_setopt(curl, CURLOPT_USERPWD, ":");
|
||||
easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
|
||||
easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ 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];
|
||||
const struct curl_slist *slist = cert_info->certinfo[cert];
|
||||
const char *issuer = NULL;
|
||||
const char *subject = NULL;
|
||||
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@ static CURLcode test_lib3207(const char *URL)
|
|||
result = ctx[i].result;
|
||||
}
|
||||
else {
|
||||
struct curl_slist *item = ctx[i].contents;
|
||||
const struct curl_slist *item = ctx[i].contents;
|
||||
while(item) {
|
||||
curl_mprintf("%s", item->data);
|
||||
item = item->next;
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ static CURLcode test_lib5000(const char *URL)
|
|||
}
|
||||
|
||||
easy_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
easy_setopt(curl, CURLOPT_HTTPSIG_ALGORITHM, (long)CURLHTTPSIG_ED25519);
|
||||
easy_setopt(curl, CURLOPT_HTTPSIG_ALGORITHM, CURLHTTPSIG_ED25519);
|
||||
easy_setopt(curl, CURLOPT_HTTPSIG_KEY,
|
||||
"9f8362f87a484a954e6e740c5b4c0e84"
|
||||
"229139a20aa8ab56ff66586f6a7d29c5");
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ static CURLcode test_lib5004(const char *URL)
|
|||
}
|
||||
|
||||
easy_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
easy_setopt(curl, CURLOPT_HTTPSIG_ALGORITHM, (long)CURLHTTPSIG_ED25519);
|
||||
easy_setopt(curl, CURLOPT_HTTPSIG_ALGORITHM, CURLHTTPSIG_ED25519);
|
||||
easy_setopt(curl, CURLOPT_HTTPSIG_KEY,
|
||||
"9f8362f87a484a954e6e740c5b4c0e84"
|
||||
"229139a20aa8ab56ff66586f6a7d29c5");
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ static CURLcode test_lib650(const char *URL)
|
|||
formrc = curl_formadd(&formpost,
|
||||
&lastptr,
|
||||
CURLFORM_PTRNAME, testname,
|
||||
CURLFORM_NAMELENGTH, (long)(sizeof(testname) - 2),
|
||||
CURLFORM_NAMELENGTH, (long)CURL_CSTRLEN(testname) - 1,
|
||||
CURLFORM_ARRAY, formarray,
|
||||
CURLFORM_FILENAME, "remotefile.txt",
|
||||
CURLFORM_END);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue