mirror of
https://github.com/curl/curl.git
synced 2026-08-01 13:38:49 +03:00
tidy-up: miscellaneous
- whitespace, indent, comments, clang-format. - openssl: move feature guards within function blocks. - tunit: drop redundant blocks. Closes #20361
This commit is contained in:
parent
2c6f13093e
commit
814b54d83e
45 changed files with 1521 additions and 1527 deletions
|
|
@ -23,43 +23,43 @@
|
|||
###########################################################################
|
||||
# Shared between CMakeLists.txt and Makefile.am
|
||||
|
||||
LIB_CURLX_CFILES = \
|
||||
curlx/base64.c \
|
||||
curlx/dynbuf.c \
|
||||
curlx/fopen.c \
|
||||
curlx/inet_ntop.c \
|
||||
curlx/inet_pton.c \
|
||||
curlx/multibyte.c \
|
||||
curlx/nonblock.c \
|
||||
curlx/strcopy.c \
|
||||
curlx/strerr.c \
|
||||
curlx/strparse.c \
|
||||
curlx/timediff.c \
|
||||
curlx/timeval.c \
|
||||
LIB_CURLX_CFILES = \
|
||||
curlx/base64.c \
|
||||
curlx/dynbuf.c \
|
||||
curlx/fopen.c \
|
||||
curlx/inet_ntop.c \
|
||||
curlx/inet_pton.c \
|
||||
curlx/multibyte.c \
|
||||
curlx/nonblock.c \
|
||||
curlx/strcopy.c \
|
||||
curlx/strerr.c \
|
||||
curlx/strparse.c \
|
||||
curlx/timediff.c \
|
||||
curlx/timeval.c \
|
||||
curlx/version_win32.c \
|
||||
curlx/wait.c \
|
||||
curlx/warnless.c \
|
||||
curlx/wait.c \
|
||||
curlx/warnless.c \
|
||||
curlx/winapi.c
|
||||
|
||||
LIB_CURLX_HFILES = \
|
||||
curlx/binmode.h \
|
||||
curlx/base64.h \
|
||||
curlx/curlx.h \
|
||||
curlx/dynbuf.h \
|
||||
curlx/fopen.h \
|
||||
curlx/inet_ntop.h \
|
||||
curlx/inet_pton.h \
|
||||
curlx/multibyte.h \
|
||||
curlx/nonblock.h \
|
||||
curlx/snprintf.h \
|
||||
curlx/strcopy.h \
|
||||
curlx/strerr.h \
|
||||
curlx/strparse.h \
|
||||
curlx/timediff.h \
|
||||
curlx/timeval.h \
|
||||
LIB_CURLX_HFILES = \
|
||||
curlx/binmode.h \
|
||||
curlx/base64.h \
|
||||
curlx/curlx.h \
|
||||
curlx/dynbuf.h \
|
||||
curlx/fopen.h \
|
||||
curlx/inet_ntop.h \
|
||||
curlx/inet_pton.h \
|
||||
curlx/multibyte.h \
|
||||
curlx/nonblock.h \
|
||||
curlx/snprintf.h \
|
||||
curlx/strcopy.h \
|
||||
curlx/strerr.h \
|
||||
curlx/strparse.h \
|
||||
curlx/timediff.h \
|
||||
curlx/timeval.h \
|
||||
curlx/version_win32.h \
|
||||
curlx/wait.h \
|
||||
curlx/warnless.h \
|
||||
curlx/wait.h \
|
||||
curlx/warnless.h \
|
||||
curlx/winapi.h
|
||||
|
||||
LIB_VAUTH_CFILES = \
|
||||
|
|
@ -116,22 +116,22 @@ LIB_VTLS_HFILES = \
|
|||
vtls/wolfssl.h \
|
||||
vtls/x509asn1.h
|
||||
|
||||
LIB_VQUIC_CFILES = \
|
||||
LIB_VQUIC_CFILES = \
|
||||
vquic/curl_ngtcp2.c \
|
||||
vquic/curl_quiche.c \
|
||||
vquic/vquic.c \
|
||||
vquic/vquic.c \
|
||||
vquic/vquic-tls.c
|
||||
|
||||
LIB_VQUIC_HFILES = \
|
||||
LIB_VQUIC_HFILES = \
|
||||
vquic/curl_ngtcp2.h \
|
||||
vquic/curl_quiche.h \
|
||||
vquic/vquic.h \
|
||||
vquic/vquic_int.h \
|
||||
vquic/vquic.h \
|
||||
vquic/vquic_int.h \
|
||||
vquic/vquic-tls.h
|
||||
|
||||
LIB_VSSH_CFILES = \
|
||||
vssh/libssh.c \
|
||||
vssh/libssh2.c \
|
||||
LIB_VSSH_CFILES = \
|
||||
vssh/libssh.c \
|
||||
vssh/libssh2.c \
|
||||
vssh/vssh.c
|
||||
|
||||
LIB_VSSH_HFILES = \
|
||||
|
|
|
|||
|
|
@ -626,12 +626,12 @@
|
|||
#cmakedefine CURL_OS ${CURL_OS}
|
||||
|
||||
/*
|
||||
Note: SIZEOF_* variables are fetched with CMake through check_type_size().
|
||||
As per CMake documentation on CheckTypeSize, C preprocessor code is
|
||||
generated by CMake into SIZEOF_*_CODE. This is what we use in the
|
||||
following statements.
|
||||
Note: SIZEOF_* variables are fetched with CMake through check_type_size().
|
||||
As per CMake documentation on CheckTypeSize, C preprocessor code is
|
||||
generated by CMake into SIZEOF_*_CODE. This is what we use in the
|
||||
following statements.
|
||||
|
||||
Reference: https://cmake.org/cmake/help/latest/module/CheckTypeSize.html
|
||||
Reference: https://cmake.org/cmake/help/latest/module/CheckTypeSize.html
|
||||
*/
|
||||
|
||||
/* The size of `int', as computed by sizeof. */
|
||||
|
|
|
|||
|
|
@ -53,8 +53,7 @@
|
|||
* sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX.
|
||||
*/
|
||||
|
||||
/* int
|
||||
* inet_pton4(src, dst)
|
||||
/* int inet_pton4(src, dst)
|
||||
* like inet_aton() but without all the hexadecimal and shorthand.
|
||||
* return:
|
||||
* 1 if `src' is a valid dotted quad, else 0.
|
||||
|
|
@ -102,8 +101,7 @@ static int inet_pton4(const char *src, unsigned char *dst)
|
|||
return 1;
|
||||
}
|
||||
|
||||
/* int
|
||||
* inet_pton6(src, dst)
|
||||
/* int inet_pton6(src, dst)
|
||||
* convert presentation level address to network order binary form.
|
||||
* return:
|
||||
* 1 if `src' is a valid [RFC1884 2.2] address, else 0.
|
||||
|
|
@ -192,8 +190,7 @@ static int inet_pton6(const char *src, unsigned char *dst)
|
|||
return 1;
|
||||
}
|
||||
|
||||
/* int
|
||||
* inet_pton(af, src, dst)
|
||||
/* int inet_pton(af, src, dst)
|
||||
* convert from presentation format (which usually means ASCII printable)
|
||||
* to network format (which is usually some kind of binary format).
|
||||
* return:
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ static void MD4_Final(unsigned char *result, MD4_CTX *ctx)
|
|||
* MD4 Message-Digest Algorithm (RFC 1320).
|
||||
*
|
||||
* Homepage:
|
||||
https://openwall.info/wiki/people/solar/software/public-domain-source-code/md4
|
||||
* https://openwall.info/wiki/people/solar/software/public-domain-source-code/md4
|
||||
*
|
||||
* Author:
|
||||
* Alexander Peslyak, better known as Solar Designer <solar at openwall.com>
|
||||
|
|
@ -179,8 +179,8 @@ static void MD4_Final(unsigned char *result, MD4_CTX *ctx)
|
|||
* claimed, and the software is hereby placed in the public domain. In case
|
||||
* this attempt to disclaim copyright and place the software in the public
|
||||
* domain is deemed null and void, then the software is Copyright (c) 2001
|
||||
* Alexander Peslyak and it is hereby released to the general public under the
|
||||
* following terms:
|
||||
* Alexander Peslyak and it is hereby released to the general public under
|
||||
* the following terms:
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted.
|
||||
|
|
|
|||
12
lib/md5.c
12
lib/md5.c
|
|
@ -256,17 +256,17 @@ static void my_md5_final(unsigned char *digest, void *in)
|
|||
* MD5 Message-Digest Algorithm (RFC 1321).
|
||||
*
|
||||
* Homepage:
|
||||
https://openwall.info/wiki/people/solar/software/public-domain-source-code/md5
|
||||
* https://openwall.info/wiki/people/solar/software/public-domain-source-code/md5
|
||||
*
|
||||
* Author:
|
||||
* Alexander Peslyak, better known as Solar Designer <solar at openwall.com>
|
||||
*
|
||||
* This software was written by Alexander Peslyak in 2001. No copyright is
|
||||
* claimed, and the software is hereby placed in the public domain.
|
||||
* In case this attempt to disclaim copyright and place the software in the
|
||||
* public domain is deemed null and void, then the software is
|
||||
* Copyright (c) 2001 Alexander Peslyak and it is hereby released to the
|
||||
* general public under the following terms:
|
||||
* claimed, and the software is hereby placed in the public domain. In case
|
||||
* this attempt to disclaim copyright and place the software in the public
|
||||
* domain is deemed null and void, then the software is Copyright (c) 2001
|
||||
* Alexander Peslyak and it is hereby released to the general public under
|
||||
* the following terms:
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted.
|
||||
|
|
|
|||
|
|
@ -1022,8 +1022,8 @@ static int enginecheck(struct Curl_easy *data,
|
|||
SSL_CTX* ctx,
|
||||
const char *key_file,
|
||||
const char *key_passwd)
|
||||
#ifdef USE_OPENSSL_ENGINE
|
||||
{
|
||||
#ifdef USE_OPENSSL_ENGINE
|
||||
EVP_PKEY *priv_key = NULL;
|
||||
|
||||
/* Implicitly use pkcs11 engine if none was provided and the
|
||||
|
|
@ -1066,22 +1066,20 @@ static int enginecheck(struct Curl_easy *data,
|
|||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
#else
|
||||
{
|
||||
(void)ctx;
|
||||
(void)key_file;
|
||||
(void)key_passwd;
|
||||
failf(data, "SSL_FILETYPE_ENGINE not supported for private key");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static int providercheck(struct Curl_easy *data,
|
||||
SSL_CTX* ctx,
|
||||
const char *key_file)
|
||||
#ifdef OPENSSL_HAS_PROVIDERS
|
||||
{
|
||||
#ifdef OPENSSL_HAS_PROVIDERS
|
||||
char error_buffer[256];
|
||||
/* Implicitly use pkcs11 provider if none was provided and the
|
||||
* key_file is a PKCS#11 URI */
|
||||
|
|
@ -1155,22 +1153,20 @@ static int providercheck(struct Curl_easy *data,
|
|||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
#else
|
||||
{
|
||||
(void)ctx;
|
||||
(void)key_file;
|
||||
failf(data, "SSL_FILETYPE_PROVIDER not supported for private key");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static int engineload(struct Curl_easy *data,
|
||||
SSL_CTX* ctx,
|
||||
const char *cert_file)
|
||||
{
|
||||
/* ENGINE_CTRL_GET_CMD_FROM_NAME supported by OpenSSL, LibreSSL <=3.8.3 */
|
||||
#if defined(USE_OPENSSL_ENGINE) && defined(ENGINE_CTRL_GET_CMD_FROM_NAME)
|
||||
{
|
||||
char error_buffer[256];
|
||||
/* Implicitly use pkcs11 engine if none was provided and the
|
||||
* cert_file is a PKCS#11 URI */
|
||||
|
|
@ -1228,21 +1224,19 @@ static int engineload(struct Curl_easy *data,
|
|||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
#else
|
||||
{
|
||||
(void)ctx;
|
||||
(void)cert_file;
|
||||
failf(data, "SSL_FILETYPE_ENGINE not supported for certificate");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static int providerload(struct Curl_easy *data,
|
||||
SSL_CTX* ctx,
|
||||
const char *cert_file)
|
||||
#ifdef OPENSSL_HAS_PROVIDERS
|
||||
{
|
||||
#ifdef OPENSSL_HAS_PROVIDERS
|
||||
char error_buffer[256];
|
||||
/* Implicitly use pkcs11 provider if none was provided and the
|
||||
* cert_file is a PKCS#11 URI */
|
||||
|
|
@ -1306,15 +1300,13 @@ static int providerload(struct Curl_easy *data,
|
|||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
#else
|
||||
{
|
||||
(void)ctx;
|
||||
(void)cert_file;
|
||||
failf(data, "SSL_FILETYPE_PROVIDER not supported for certificate");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static int pkcs12load(struct Curl_easy *data,
|
||||
SSL_CTX* ctx,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue