From a9f5f8683ff4ff95fa3628b8852cce8519e9d92a Mon Sep 17 00:00:00 2001 From: yhirose Date: Thu, 31 Dec 2020 11:35:11 -0500 Subject: [PATCH] Fixed warnings on Visual C++ --- httplib.h | 3 +-- test/test.cc | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/httplib.h b/httplib.h index c312f9e..9b76290 100644 --- a/httplib.h +++ b/httplib.h @@ -3555,7 +3555,7 @@ inline bool load_system_certs_on_windows(X509_STORE *store) { if (!hStore) { return false; } PCCERT_CONTEXT pContext = NULL; - while (pContext = CertEnumCertificatesInStore(hStore, pContext)) { + while ((pContext = CertEnumCertificatesInStore(hStore, pContext)) != nullptr) { auto encoded_cert = static_cast(pContext->pbCertEncoded); @@ -4348,7 +4348,6 @@ Server::write_content_with_provider(Stream &strm, const Request &req, is_shutting_down); } } - return true; } inline bool Server::read_content(Stream &strm, Request &req, Response &res) { diff --git a/test/test.cc b/test/test.cc index eef3236..69ce410 100644 --- a/test/test.cc +++ b/test/test.cc @@ -3148,9 +3148,9 @@ TEST(MountTest, Unmount) { TEST(ExceptionTest, ThrowExceptionInHandler) { Server svr; - svr.Get("/hi", [&](const Request & /*req*/, Response &res) { + svr.Get("/hi", [&](const Request & /*req*/, Response & /*res*/) { throw std::runtime_error("exception..."); - res.set_content("Hello World!", "text/plain"); + //res.set_content("Hello World!", "text/plain"); }); auto listen_thread = std::thread([&svr]() { svr.listen("localhost", PORT); });