mirror of
https://github.com/curl/curl.git
synced 2026-07-24 13:57:16 +03:00
tidy-up: miscellaneous
- apply more clang-format. - lib/version: use `CURL_ARRAYSIZE()`. - INSTALL-CMAKE.md: sync-up an option description with others. - examples: delete unused main args. - examples/ftpgetinfo: document `_CRT_SECURE_NO_WARNINGS` symbol. - delete remaining stray duplicate lines. - acinclude.m4: drop an unnecessary x-hack. - vtls/mbedtls: join a URL split into two lines. - src/tool_cb_see: add parentheses around macro expressions. - src/tool_operate: move literals to the right side of comparisons. - libtests: sync up fopen/fstat error messages between tests. - curl_setup.h: replace `if ! defined __LP64` with `ifndef __LP64`. I assume it makes no difference on Tandem systems, as the latter form is already used in `include/curl/system.h`. Closes #20018
This commit is contained in:
parent
cd9da30e76
commit
308c347c8b
53 changed files with 988 additions and 1005 deletions
|
|
@ -229,8 +229,7 @@ int tool_progress_cb(void *clientp,
|
|||
return 0;
|
||||
}
|
||||
|
||||
void progressbarinit(struct ProgressData *bar,
|
||||
struct OperationConfig *config)
|
||||
void progressbarinit(struct ProgressData *bar, struct OperationConfig *config)
|
||||
{
|
||||
memset(bar, 0, sizeof(struct ProgressData));
|
||||
|
||||
|
|
|
|||
|
|
@ -42,8 +42,7 @@ struct ProgressData {
|
|||
|
||||
struct OperationConfig;
|
||||
|
||||
void progressbarinit(struct ProgressData *bar,
|
||||
struct OperationConfig *config);
|
||||
void progressbarinit(struct ProgressData *bar, struct OperationConfig *config);
|
||||
|
||||
/*
|
||||
** callback for CURLOPT_PROGRESSFUNCTION
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ int tool_seek_cb(void *userdata, curl_off_t offset, int whence)
|
|||
both represent the same value. Maximum offset used here when we lseek
|
||||
using a 'long' data type offset */
|
||||
|
||||
#define OUR_MAX_SEEK_L 2147483647L - 1L
|
||||
#define OUR_MAX_SEEK_O 0x7FFFFFFF - 0x1
|
||||
#define OUR_MAX_SEEK_L (2147483647L - 1L)
|
||||
#define OUR_MAX_SEEK_O (0x7FFFFFFF - 0x1)
|
||||
|
||||
/* The offset check following here is only interesting if curl_off_t is
|
||||
larger than off_t and we are not using the Win32 large file support
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#define MAX_CONFIG_LINE_LENGTH (10*1024*1024)
|
||||
#define MAX_CONFIG_LINE_LENGTH (10 * 1024 * 1024)
|
||||
|
||||
#define checkprefix(a, b) curl_strnequal(b, STRCONST(a))
|
||||
|
||||
|
|
|
|||
|
|
@ -44,8 +44,7 @@ int getfiletime(const char *filename, curl_off_t *stamp)
|
|||
TCHAR *tchar_filename = curlx_convert_UTF8_to_tchar(filename);
|
||||
|
||||
hfile = CreateFile(tchar_filename, FILE_READ_ATTRIBUTES,
|
||||
(FILE_SHARE_READ | FILE_SHARE_WRITE |
|
||||
FILE_SHARE_DELETE),
|
||||
(FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE),
|
||||
NULL, OPEN_EXISTING, 0, NULL);
|
||||
curlx_free(tchar_filename);
|
||||
if(hfile != INVALID_HANDLE_VALUE) {
|
||||
|
|
@ -110,8 +109,7 @@ void setfiletime(curl_off_t filetime, const char *filename)
|
|||
}
|
||||
|
||||
hfile = CreateFile(tchar_filename, FILE_WRITE_ATTRIBUTES,
|
||||
(FILE_SHARE_READ | FILE_SHARE_WRITE |
|
||||
FILE_SHARE_DELETE),
|
||||
(FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE),
|
||||
NULL, OPEN_EXISTING, 0, NULL);
|
||||
curlx_free(tchar_filename);
|
||||
if(hfile != INVALID_HANDLE_VALUE) {
|
||||
|
|
|
|||
|
|
@ -840,9 +840,9 @@ int formparse(const char *input,
|
|||
part->headers = headers;
|
||||
headers = NULL;
|
||||
if(res == CURLE_READ_ERROR) {
|
||||
/* An error occurred while reading stdin: if read has started,
|
||||
issue the error now. Else, delay it until processed by
|
||||
libcurl. */
|
||||
/* An error occurred while reading stdin: if read has started,
|
||||
issue the error now. Else, delay it until processed by
|
||||
libcurl. */
|
||||
if(part->size > 0) {
|
||||
warnf("error while reading standard input");
|
||||
goto fail;
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ static struct proto_name_tokenp {
|
|||
{ "scp", &proto_scp },
|
||||
{ "sftp", &proto_sftp },
|
||||
{ "tftp", &proto_tftp },
|
||||
{ NULL, NULL }
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
bool feature_altsvc = FALSE;
|
||||
|
|
@ -87,38 +87,38 @@ static struct feature_name_presentp {
|
|||
int feature_bitmask;
|
||||
} const maybe_feature[] = {
|
||||
/* Keep alphabetically sorted. */
|
||||
{"alt-svc", &feature_altsvc, CURL_VERSION_ALTSVC},
|
||||
{"AsynchDNS", NULL, CURL_VERSION_ASYNCHDNS},
|
||||
{"brotli", &feature_brotli, CURL_VERSION_BROTLI},
|
||||
{"CharConv", NULL, CURL_VERSION_CONV},
|
||||
{"Debug", NULL, CURL_VERSION_DEBUG},
|
||||
{"ECH", &feature_ech, 0},
|
||||
{"gsasl", NULL, CURL_VERSION_GSASL},
|
||||
{"GSS-API", NULL, CURL_VERSION_GSSAPI},
|
||||
{"HSTS", &feature_hsts, CURL_VERSION_HSTS},
|
||||
{"HTTP2", &feature_http2, CURL_VERSION_HTTP2},
|
||||
{"HTTP3", &feature_http3, CURL_VERSION_HTTP3},
|
||||
{"HTTPS-proxy", &feature_httpsproxy, CURL_VERSION_HTTPS_PROXY},
|
||||
{"IDN", NULL, CURL_VERSION_IDN},
|
||||
{"IPv6", NULL, CURL_VERSION_IPV6},
|
||||
{"Kerberos", NULL, CURL_VERSION_KERBEROS5},
|
||||
{"Largefile", NULL, CURL_VERSION_LARGEFILE},
|
||||
{"libz", &feature_libz, CURL_VERSION_LIBZ},
|
||||
{"MultiSSL", NULL, CURL_VERSION_MULTI_SSL},
|
||||
{"NTLM", &feature_ntlm, CURL_VERSION_NTLM},
|
||||
{"NTLM_WB", &feature_ntlm_wb, CURL_VERSION_NTLM_WB},
|
||||
{"PSL", NULL, CURL_VERSION_PSL},
|
||||
{"SPNEGO", &feature_spnego, CURL_VERSION_SPNEGO},
|
||||
{"SSL", &feature_ssl, CURL_VERSION_SSL},
|
||||
{"SSPI", NULL, CURL_VERSION_SSPI},
|
||||
{"SSLS-EXPORT", &feature_ssls_export, 0},
|
||||
{"threadsafe", NULL, CURL_VERSION_THREADSAFE},
|
||||
{"TLS-SRP", &feature_tls_srp, CURL_VERSION_TLSAUTH_SRP},
|
||||
{"TrackMemory", NULL, CURL_VERSION_CURLDEBUG},
|
||||
{"Unicode", NULL, CURL_VERSION_UNICODE},
|
||||
{"UnixSockets", NULL, CURL_VERSION_UNIX_SOCKETS},
|
||||
{"zstd", &feature_zstd, CURL_VERSION_ZSTD},
|
||||
{NULL, NULL, 0}
|
||||
{ "alt-svc", &feature_altsvc, CURL_VERSION_ALTSVC },
|
||||
{ "AsynchDNS", NULL, CURL_VERSION_ASYNCHDNS },
|
||||
{ "brotli", &feature_brotli, CURL_VERSION_BROTLI },
|
||||
{ "CharConv", NULL, CURL_VERSION_CONV },
|
||||
{ "Debug", NULL, CURL_VERSION_DEBUG },
|
||||
{ "ECH", &feature_ech, 0 },
|
||||
{ "gsasl", NULL, CURL_VERSION_GSASL },
|
||||
{ "GSS-API", NULL, CURL_VERSION_GSSAPI },
|
||||
{ "HSTS", &feature_hsts, CURL_VERSION_HSTS },
|
||||
{ "HTTP2", &feature_http2, CURL_VERSION_HTTP2 },
|
||||
{ "HTTP3", &feature_http3, CURL_VERSION_HTTP3 },
|
||||
{ "HTTPS-proxy", &feature_httpsproxy, CURL_VERSION_HTTPS_PROXY },
|
||||
{ "IDN", NULL, CURL_VERSION_IDN },
|
||||
{ "IPv6", NULL, CURL_VERSION_IPV6 },
|
||||
{ "Kerberos", NULL, CURL_VERSION_KERBEROS5 },
|
||||
{ "Largefile", NULL, CURL_VERSION_LARGEFILE },
|
||||
{ "libz", &feature_libz, CURL_VERSION_LIBZ },
|
||||
{ "MultiSSL", NULL, CURL_VERSION_MULTI_SSL },
|
||||
{ "NTLM", &feature_ntlm, CURL_VERSION_NTLM },
|
||||
{ "NTLM_WB", &feature_ntlm_wb, CURL_VERSION_NTLM_WB },
|
||||
{ "PSL", NULL, CURL_VERSION_PSL },
|
||||
{ "SPNEGO", &feature_spnego, CURL_VERSION_SPNEGO },
|
||||
{ "SSL", &feature_ssl, CURL_VERSION_SSL },
|
||||
{ "SSPI", NULL, CURL_VERSION_SSPI },
|
||||
{ "SSLS-EXPORT", &feature_ssls_export, 0 },
|
||||
{ "threadsafe", NULL, CURL_VERSION_THREADSAFE },
|
||||
{ "TLS-SRP", &feature_tls_srp, CURL_VERSION_TLSAUTH_SRP },
|
||||
{ "TrackMemory", NULL, CURL_VERSION_CURLDEBUG },
|
||||
{ "Unicode", NULL, CURL_VERSION_UNICODE },
|
||||
{ "UnixSockets", NULL, CURL_VERSION_UNIX_SOCKETS },
|
||||
{ "zstd", &feature_zstd, CURL_VERSION_ZSTD },
|
||||
{ NULL, NULL, 0 }
|
||||
};
|
||||
|
||||
static const char *fnames[CURL_ARRAYSIZE(maybe_feature)];
|
||||
|
|
@ -186,7 +186,7 @@ CURLcode get_libcurl_info(void)
|
|||
}
|
||||
|
||||
feature_libssh2 = curlinfo->libssh_version &&
|
||||
!strncmp("libssh2", curlinfo->libssh_version, 7);
|
||||
!strncmp("libssh2", curlinfo->libssh_version, 7);
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
|
|
|
|||
1652
src/tool_listhelp.c
1652
src/tool_listhelp.c
File diff suppressed because it is too large
Load diff
|
|
@ -32,13 +32,10 @@
|
|||
#define NOTE_PREFIX "Note: "
|
||||
#define ERROR_PREFIX "curl: "
|
||||
|
||||
static void voutf(const char *prefix,
|
||||
const char *fmt,
|
||||
va_list ap) CURL_PRINTF(2, 0);
|
||||
static void voutf(const char *prefix, const char *fmt, va_list ap)
|
||||
CURL_PRINTF(2, 0);
|
||||
|
||||
static void voutf(const char *prefix,
|
||||
const char *fmt,
|
||||
va_list ap)
|
||||
static void voutf(const char *prefix, const char *fmt, va_list ap)
|
||||
{
|
||||
size_t len;
|
||||
char *ptr;
|
||||
|
|
|
|||
|
|
@ -377,21 +377,21 @@ static CURLcode retrycheck(struct OperationConfig *config,
|
|||
RETRY_FTP,
|
||||
RETRY_LAST /* not used */
|
||||
} retry = RETRY_NO;
|
||||
if((CURLE_OPERATION_TIMEDOUT == result) ||
|
||||
(CURLE_COULDNT_RESOLVE_HOST == result) ||
|
||||
(CURLE_COULDNT_RESOLVE_PROXY == result) ||
|
||||
(CURLE_FTP_ACCEPT_TIMEOUT == result))
|
||||
if((result == CURLE_OPERATION_TIMEDOUT) ||
|
||||
(result == CURLE_COULDNT_RESOLVE_HOST) ||
|
||||
(result == CURLE_COULDNT_RESOLVE_PROXY) ||
|
||||
(result == CURLE_FTP_ACCEPT_TIMEOUT))
|
||||
/* retry timeout always */
|
||||
retry = RETRY_TIMEOUT;
|
||||
else if(config->retry_connrefused &&
|
||||
(CURLE_COULDNT_CONNECT == result)) {
|
||||
(result == CURLE_COULDNT_CONNECT)) {
|
||||
long oserrno = 0;
|
||||
curl_easy_getinfo(curl, CURLINFO_OS_ERRNO, &oserrno);
|
||||
if(SOCKECONNREFUSED == oserrno)
|
||||
retry = RETRY_CONNREFUSED;
|
||||
}
|
||||
else if((CURLE_OK == result) ||
|
||||
(config->fail && (CURLE_HTTP_RETURNED_ERROR == result))) {
|
||||
else if((result == CURLE_OK) ||
|
||||
(config->fail && (result == CURLE_HTTP_RETURNED_ERROR))) {
|
||||
/* If it returned OK. _or_ failonerror was enabled and it
|
||||
returned due to such an error, check for HTTP transient
|
||||
errors to retry on. */
|
||||
|
|
|
|||
|
|
@ -306,10 +306,18 @@ ParameterError secs2ms(long *valp, const char *str)
|
|||
{
|
||||
curl_off_t secs;
|
||||
long ms = 0;
|
||||
const unsigned int digs[] = { 1, 10, 100, 1000, 10000, 100000,
|
||||
1000000, 10000000, 100000000 };
|
||||
if(!str ||
|
||||
curlx_str_number(&str, &secs, LONG_MAX / 1000 - 1))
|
||||
const unsigned int digs[] = {
|
||||
1,
|
||||
10,
|
||||
100,
|
||||
1000,
|
||||
10000,
|
||||
100000,
|
||||
1000000,
|
||||
10000000,
|
||||
100000000
|
||||
};
|
||||
if(!str || curlx_str_number(&str, &secs, LONG_MAX / 1000 - 1))
|
||||
return PARAM_BAD_NUMERIC;
|
||||
if(!curlx_str_single(&str, '.')) {
|
||||
curl_off_t fracs;
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ extern FILE *tool_stderr;
|
|||
#endif
|
||||
|
||||
#ifndef tool_nop_stmt
|
||||
#define tool_nop_stmt do { } while(0)
|
||||
#define tool_nop_stmt do {} while(0)
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
|
|
|
|||
|
|
@ -34,8 +34,7 @@
|
|||
|
||||
Return 0 on success, non-zero on error.
|
||||
*/
|
||||
int jsonquoted(const char *in, size_t len,
|
||||
struct dynbuf *out, bool lowercase)
|
||||
int jsonquoted(const char *in, size_t len, struct dynbuf *out, bool lowercase)
|
||||
{
|
||||
const unsigned char *i = (const unsigned char *)in;
|
||||
const unsigned char *in_end = &i[len];
|
||||
|
|
|
|||
|
|
@ -26,8 +26,7 @@
|
|||
#include "tool_setup.h"
|
||||
#include "tool_writeout.h"
|
||||
|
||||
int jsonquoted(const char *in, size_t len,
|
||||
struct dynbuf *out, bool lowercase);
|
||||
int jsonquoted(const char *in, size_t len, struct dynbuf *out, bool lowercase);
|
||||
|
||||
void ourWriteOutJSON(FILE *stream, const struct writeoutvar mappings[],
|
||||
size_t nentries,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue