From 98d16eb8368baa40b05d93fe9a073c5f5b4bf221 Mon Sep 17 00:00:00 2001 From: Sil3ntStorm Date: Sat, 19 Oct 2019 16:40:06 +0200 Subject: [PATCH] Allow use of OpenSSL 1.1.1, fix compile errors --- httplib.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/httplib.h b/httplib.h index 46b3fa8..5b5975e 100644 --- a/httplib.h +++ b/httplib.h @@ -1696,7 +1696,7 @@ inline std::string decode_url(const std::string &s) { int val = 0; if (from_hex_to_i(s, i + 1, 2, val)) { // 2 digits hex codes - result += val; + result += static_cast(val); i += 2; // '00' } else { result += s[i]; @@ -1847,7 +1847,7 @@ inline std::string to_lower(const char *beg, const char *end) { std::string out; auto it = beg; while (it != end) { - out += ::tolower(*it); + out += static_cast(::tolower(*it)); it++; } return out; @@ -3382,11 +3382,19 @@ private: class SSLInit { public: SSLInit() { +#if OPENSSL_VERSION_NUMBER >= 0x1010001fL + OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS | OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL); +#else SSL_load_error_strings(); SSL_library_init(); +#endif } - ~SSLInit() { ERR_free_strings(); } + ~SSLInit() { +#if OPENSSL_VERSION_NUMBER < 0x1010001fL + ERR_free_strings(); +#endif + } private: #if OPENSSL_VERSION_NUMBER < 0x10100000L