1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-24 17:18:48 -05:00

version: turn version number functions into returning void

... as we never use the return codes from them.

Reviewed-by: Daniel Gustafsson
Closes #7319
This commit is contained in:
Daniel Stenberg 2021-06-30 11:09:55 +02:00
parent 5372ee37d3
commit 63c7668182
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
13 changed files with 31 additions and 37 deletions

View File

@ -352,13 +352,12 @@ static const struct Curl_handler Curl_handler_http2_ssl = {
}; };
/* /*
* Store nghttp2 version info in this buffer, Prefix with a space. Return * Store nghttp2 version info in this buffer.
* total length written.
*/ */
int Curl_http2_ver(char *p, size_t len) void Curl_http2_ver(char *p, size_t len)
{ {
nghttp2_info *h2 = nghttp2_version(0); nghttp2_info *h2 = nghttp2_version(0);
return msnprintf(p, len, "nghttp2/%s", h2->version_str); (void)msnprintf(p, len, "nghttp2/%s", h2->version_str);
} }
/* /*

View File

@ -32,10 +32,9 @@
#define DEFAULT_MAX_CONCURRENT_STREAMS 100 #define DEFAULT_MAX_CONCURRENT_STREAMS 100
/* /*
* Store nghttp2 version info in this buffer, Prefix with a space. Return * Store nghttp2 version info in this buffer.
* total length written.
*/ */
int Curl_http2_ver(char *p, size_t len); void Curl_http2_ver(char *p, size_t len);
const char *Curl_http2_strerror(uint32_t err); const char *Curl_http2_strerror(uint32_t err);

View File

@ -45,7 +45,7 @@ CURLcode Curl_quic_is_connected(struct Curl_easy *data,
struct connectdata *conn, struct connectdata *conn,
int sockindex, int sockindex,
bool *connected); bool *connected);
int Curl_quic_ver(char *p, size_t len); void Curl_quic_ver(char *p, size_t len);
CURLcode Curl_quic_done_sending(struct Curl_easy *data); CURLcode Curl_quic_done_sending(struct Curl_easy *data);
void Curl_quic_done(struct Curl_easy *data, bool premature); void Curl_quic_done(struct Curl_easy *data, bool premature);
bool Curl_quic_data_pending(const struct Curl_easy *data); bool Curl_quic_data_pending(const struct Curl_easy *data);

View File

@ -75,28 +75,26 @@
#endif #endif
#ifdef HAVE_BROTLI #ifdef HAVE_BROTLI
static size_t brotli_version(char *buf, size_t bufsz) static void brotli_version(char *buf, size_t bufsz)
{ {
uint32_t brotli_version = BrotliDecoderVersion(); uint32_t brotli_version = BrotliDecoderVersion();
unsigned int major = brotli_version >> 24; unsigned int major = brotli_version >> 24;
unsigned int minor = (brotli_version & 0x00FFFFFF) >> 12; unsigned int minor = (brotli_version & 0x00FFFFFF) >> 12;
unsigned int patch = brotli_version & 0x00000FFF; unsigned int patch = brotli_version & 0x00000FFF;
(void)msnprintf(buf, bufsz, "%u.%u.%u", major, minor, patch);
return msnprintf(buf, bufsz, "%u.%u.%u", major, minor, patch);
} }
#endif #endif
#ifdef HAVE_ZSTD #ifdef HAVE_ZSTD
static size_t zstd_version(char *buf, size_t bufsz) static void zstd_version(char *buf, size_t bufsz)
{ {
unsigned long zstd_version = (unsigned long)ZSTD_versionNumber(); unsigned long zstd_version = (unsigned long)ZSTD_versionNumber();
unsigned int major = (unsigned int)(zstd_version / (100 * 100)); unsigned int major = (unsigned int)(zstd_version / (100 * 100));
unsigned int minor = (unsigned int)((zstd_version - unsigned int minor = (unsigned int)((zstd_version -
(major * 100 * 100)) / 100); (major * 100 * 100)) / 100);
unsigned int patch = (unsigned int)(zstd_version - unsigned int patch = (unsigned int)(zstd_version -
(major * 100 * 100) - (minor * 100)); (major * 100 * 100) - (minor * 100));
(void)msnprintf(buf, bufsz, "%u.%u.%u", major, minor, patch);
return msnprintf(buf, bufsz, "%u.%u.%u", major, minor, patch);
} }
#endif #endif

View File

@ -828,15 +828,14 @@ CURLcode Curl_quic_connect(struct Curl_easy *data,
} }
/* /*
* Store ngtp2 version info in this buffer, Prefix with a space. Return total * Store ngtcp2 version info in this buffer.
* length written.
*/ */
int Curl_quic_ver(char *p, size_t len) void Curl_quic_ver(char *p, size_t len)
{ {
const ngtcp2_info *ng2 = ngtcp2_version(0); const ngtcp2_info *ng2 = ngtcp2_version(0);
nghttp3_info *ht3 = nghttp3_version(0); nghttp3_info *ht3 = nghttp3_version(0);
return msnprintf(p, len, "ngtcp2/%s nghttp3/%s", (void)msnprintf(p, len, "ngtcp2/%s nghttp3/%s",
ng2->version_str, ht3->version_str); ng2->version_str, ht3->version_str);
} }
static int ng_getsock(struct Curl_easy *data, struct connectdata *conn, static int ng_getsock(struct Curl_easy *data, struct connectdata *conn,

View File

@ -604,12 +604,11 @@ static ssize_t h3_stream_send(struct Curl_easy *data,
} }
/* /*
* Store quiche version info in this buffer, Prefix with a space. Return total * Store quiche version info in this buffer.
* length written.
*/ */
int Curl_quic_ver(char *p, size_t len) void Curl_quic_ver(char *p, size_t len)
{ {
return msnprintf(p, len, "quiche/%s", quiche_version()); (void)msnprintf(p, len, "quiche/%s", quiche_version());
} }
/* Index where :authority header field will appear in request header /* Index where :authority header field will appear in request header

View File

@ -2940,9 +2940,9 @@ void Curl_ssh_cleanup(void)
(void)ssh_finalize(); (void)ssh_finalize();
} }
size_t Curl_ssh_version(char *buffer, size_t buflen) void Curl_ssh_version(char *buffer, size_t buflen)
{ {
return msnprintf(buffer, buflen, "libssh/%s", CURL_LIBSSH_VERSION); (void)msnprintf(buffer, buflen, "libssh/%s", CURL_LIBSSH_VERSION);
} }
#endif /* USE_LIBSSH */ #endif /* USE_LIBSSH */

View File

@ -3609,9 +3609,9 @@ void Curl_ssh_cleanup(void)
#endif #endif
} }
size_t Curl_ssh_version(char *buffer, size_t buflen) void Curl_ssh_version(char *buffer, size_t buflen)
{ {
return msnprintf(buffer, buflen, "libssh2/%s", LIBSSH2_VERSION); (void)msnprintf(buffer, buflen, "libssh2/%s", LIBSSH2_VERSION);
} }
/* The SSH session is associated with the *CONNECTION* but the callback user /* The SSH session is associated with the *CONNECTION* but the callback user

View File

@ -262,7 +262,7 @@ extern const struct Curl_handler Curl_handler_sftp;
/* generic SSH backend functions */ /* generic SSH backend functions */
CURLcode Curl_ssh_init(void); CURLcode Curl_ssh_init(void);
void Curl_ssh_cleanup(void); void Curl_ssh_cleanup(void);
size_t Curl_ssh_version(char *buffer, size_t buflen); void Curl_ssh_version(char *buffer, size_t buflen);
void Curl_ssh_attach(struct Curl_easy *data, void Curl_ssh_attach(struct Curl_easy *data,
struct connectdata *conn); struct connectdata *conn);
#else #else

View File

@ -1148,9 +1148,9 @@ static int wssh_getsock(struct Curl_easy *data,
return bitmap; return bitmap;
} }
size_t Curl_ssh_version(char *buffer, size_t buflen) void Curl_ssh_version(char *buffer, size_t buflen)
{ {
return msnprintf(buffer, buflen, "wolfssh/%s", LIBWOLFSSH_VERSION_STRING); (void)msnprintf(buffer, buflen, "wolfssh/%s", LIBWOLFSSH_VERSION_STRING);
} }
CURLcode Curl_ssh_init(void) CURLcode Curl_ssh_init(void)

View File

@ -4250,7 +4250,7 @@ static ssize_t ossl_send(struct Curl_easy *data,
#endif #endif
) { ) {
char ver[120]; char ver[120];
ossl_version(ver, 120); (void)ossl_version(ver, sizeof(ver));
failf(data, "Error: %s does not support double SSL tunneling.", ver); failf(data, "Error: %s does not support double SSL tunneling.", ver);
} }
else else

View File

@ -721,12 +721,12 @@ CURLcode Curl_ssl_initsessions(struct Curl_easy *data, size_t amount)
static size_t multissl_version(char *buffer, size_t size); static size_t multissl_version(char *buffer, size_t size);
size_t Curl_ssl_version(char *buffer, size_t size) void Curl_ssl_version(char *buffer, size_t size)
{ {
#ifdef CURL_WITH_MULTI_SSL #ifdef CURL_WITH_MULTI_SSL
return multissl_version(buffer, size); (void)multissl_version(buffer, size);
#else #else
return Curl_ssl->version(buffer, size); (void)Curl_ssl->version(buffer, size);
#endif #endif
} }

View File

@ -210,7 +210,7 @@ struct curl_slist *Curl_ssl_engines_list(struct Curl_easy *data);
/* init the SSL session ID cache */ /* init the SSL session ID cache */
CURLcode Curl_ssl_initsessions(struct Curl_easy *, size_t); CURLcode Curl_ssl_initsessions(struct Curl_easy *, size_t);
size_t Curl_ssl_version(char *buffer, size_t size); void Curl_ssl_version(char *buffer, size_t size);
bool Curl_ssl_data_pending(const struct connectdata *conn, bool Curl_ssl_data_pending(const struct connectdata *conn,
int connindex); int connindex);
int Curl_ssl_check_cxn(struct connectdata *conn); int Curl_ssl_check_cxn(struct connectdata *conn);