Browse Source

Fixed warnings on Visual C++

yhirose 5 years ago
parent
commit
a9f5f8683f
2 changed files with 3 additions and 4 deletions
  1. 1 2
      httplib.h
  2. 2 2
      test/test.cc

+ 1 - 2
httplib.h

@@ -3555,7 +3555,7 @@ inline bool load_system_certs_on_windows(X509_STORE *store) {
   if (!hStore) { return false; }
   if (!hStore) { return false; }
 
 
   PCCERT_CONTEXT pContext = NULL;
   PCCERT_CONTEXT pContext = NULL;
-  while (pContext = CertEnumCertificatesInStore(hStore, pContext)) {
+  while ((pContext = CertEnumCertificatesInStore(hStore, pContext)) != nullptr) {
     auto encoded_cert =
     auto encoded_cert =
         static_cast<const unsigned char *>(pContext->pbCertEncoded);
         static_cast<const unsigned char *>(pContext->pbCertEncoded);
 
 
@@ -4348,7 +4348,6 @@ Server::write_content_with_provider(Stream &strm, const Request &req,
                                                   is_shutting_down);
                                                   is_shutting_down);
     }
     }
   }
   }
-  return true;
 }
 }
 
 
 inline bool Server::read_content(Stream &strm, Request &req, Response &res) {
 inline bool Server::read_content(Stream &strm, Request &req, Response &res) {

+ 2 - 2
test/test.cc

@@ -3148,9 +3148,9 @@ TEST(MountTest, Unmount) {
 TEST(ExceptionTest, ThrowExceptionInHandler) {
 TEST(ExceptionTest, ThrowExceptionInHandler) {
   Server svr;
   Server svr;
 
 
-  svr.Get("/hi", [&](const Request & /*req*/, Response &res) {
+  svr.Get("/hi", [&](const Request & /*req*/, Response & /*res*/) {
     throw std::runtime_error("exception...");
     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); });
   auto listen_thread = std::thread([&svr]() { svr.listen("localhost", PORT); });