diff options
author | Brad King <brad.king@kitware.com> | 2020-08-19 16:50:05 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-08-19 16:50:05 (GMT) |
commit | 7d0fa4a943f90567979b5d43c2249cc58ccca5d7 (patch) | |
tree | ad4d0e4827e65d0986220c03fe7a0197d430dd6e /Utilities/cmcurl/lib/version.c | |
parent | c156948327abea7fc569fd94efa474d682a1211f (diff) | |
parent | 7ceb56989f8ab3a4e1b1f2c48c9a0f382b85ec04 (diff) | |
download | CMake-7d0fa4a943f90567979b5d43c2249cc58ccca5d7.zip CMake-7d0fa4a943f90567979b5d43c2249cc58ccca5d7.tar.gz CMake-7d0fa4a943f90567979b5d43c2249cc58ccca5d7.tar.bz2 |
Merge branch 'upstream-curl' into update-curl
* upstream-curl:
curl 2020-08-19 (9d954e49)
Diffstat (limited to 'Utilities/cmcurl/lib/version.c')
-rw-r--r-- | Utilities/cmcurl/lib/version.c | 47 |
1 files changed, 45 insertions, 2 deletions
diff --git a/Utilities/cmcurl/lib/version.c b/Utilities/cmcurl/lib/version.c index 14e5096..4f6dda2 100644 --- a/Utilities/cmcurl/lib/version.c +++ b/Utilities/cmcurl/lib/version.c @@ -66,6 +66,10 @@ #include <brotli/decode.h> #endif +#ifdef HAVE_ZSTD +#include <zstd.h> +#endif + #ifdef HAVE_BROTLI static size_t brotli_version(char *buf, size_t bufsz) { @@ -78,6 +82,20 @@ static size_t brotli_version(char *buf, size_t bufsz) } #endif +#ifdef HAVE_ZSTD +static size_t zstd_version(char *buf, size_t bufsz) +{ + unsigned long zstd_version = (unsigned long)ZSTD_versionNumber(); + unsigned int major = (unsigned int)(zstd_version / (100 * 100)); + unsigned int minor = (unsigned int)((zstd_version - + (major * 100 * 100)) / 100); + unsigned int patch = (unsigned int)(zstd_version - + (major * 100 * 100) - (minor * 100)); + + return msnprintf(buf, bufsz, "%u.%u.%u", major, minor, patch); +} +#endif + /* * curl_version() returns a pointer to a static buffer. * @@ -103,6 +121,9 @@ char *curl_version(void) #ifdef HAVE_BROTLI char br_version[40] = "brotli/"; #endif +#ifdef HAVE_ZSTD + char zst_version[40] = "zstd/"; +#endif #ifdef USE_ARES char cares_version[40]; #endif @@ -153,6 +174,10 @@ char *curl_version(void) brotli_version(&br_version[7], sizeof(br_version) - 7); src[i++] = br_version; #endif +#ifdef HAVE_ZSTD + zstd_version(&zst_version[5], sizeof(zst_version) - 5); + src[i++] = zst_version; +#endif #ifdef USE_ARES msnprintf(cares_version, sizeof(cares_version), "c-ares/%s", ares_version(NULL)); @@ -365,6 +390,9 @@ static curl_version_info_data version_info = { ( (SIZEOF_OFF_T > 4) || defined(USE_WIN32_LARGE_FILES) ) | CURL_VERSION_LARGEFILE #endif +#if defined(WIN32) && defined(UNICODE) && defined(_UNICODE) + | CURL_VERSION_UNICODE +#endif #if defined(CURL_DOES_CONVERSIONS) | CURL_VERSION_CONV #endif @@ -389,6 +417,9 @@ static curl_version_info_data version_info = { #if defined(HAVE_BROTLI) | CURL_VERSION_BROTLI #endif +#if defined(HAVE_ZSTD) + | CURL_VERSION_ZSTD +#endif #if defined(USE_ALTSVC) | CURL_VERSION_ALTSVC #endif @@ -413,10 +444,12 @@ static curl_version_info_data version_info = { NULL, #endif #ifdef CURL_CA_PATH - CURL_CA_PATH /* capath */ + CURL_CA_PATH, /* capath */ #else - NULL + NULL, #endif + 0, /* zstd_ver_num */ + NULL /* zstd version */ }; curl_version_info_data *curl_version_info(CURLversion stamp) @@ -434,6 +467,10 @@ curl_version_info_data *curl_version_info(CURLversion stamp) #ifdef HAVE_BROTLI static char brotli_buffer[80]; #endif +#ifdef HAVE_ZSTD + static char zstd_buffer[80]; +#endif + #ifdef USE_SSL Curl_ssl_version(ssl_buffer, sizeof(ssl_buffer)); @@ -485,6 +522,12 @@ curl_version_info_data *curl_version_info(CURLversion stamp) version_info.brotli_version = brotli_buffer; #endif +#ifdef HAVE_ZSTD + version_info.zstd_ver_num = (unsigned int)ZSTD_versionNumber(); + zstd_version(zstd_buffer, sizeof(zstd_buffer)); + version_info.zstd_version = zstd_buffer; +#endif + #ifdef USE_NGHTTP2 { nghttp2_info *h2 = nghttp2_version(0); |