From f4530de4d261447e9da6121d3eb77295f9f961b8 Mon Sep 17 00:00:00 2001 From: Tim Ebbeke Date: Sat, 6 Apr 2024 14:45:40 +0200 Subject: [PATCH] Fixed new warnings. --- docs_source/sphinx/websocket/server.md | 4 ++-- examples/100_continue/main.cpp | 2 +- examples/most_minimal/main.cpp | 2 +- examples/serve_directory/main.cpp | 2 +- examples/simple_server/main.cpp | 2 +- examples/websocket/main.cpp | 2 +- include/roar/directory_server/directory_server.hpp | 2 +- include/roar/error.hpp | 2 +- include/roar/routing/request_listener.hpp | 6 +++--- scripts/publish_docs.sh | 2 +- test/util/common_server_setup.hpp | 6 ++++-- 11 files changed, 17 insertions(+), 15 deletions(-) diff --git a/docs_source/sphinx/websocket/server.md b/docs_source/sphinx/websocket/server.md index 7d0a3df0..b6912294 100644 --- a/docs_source/sphinx/websocket/server.md +++ b/docs_source/sphinx/websocket/server.md @@ -3,7 +3,7 @@ There is no pure websocket server. Instead you have to setup an http server and upgrade your session to a websocket session. Here is an example: -```{code-block} c++ +```c++ --- #include #include @@ -40,5 +40,5 @@ void RequestListener::ws(Roar::Session& session, Roar::EmptyBodyRequest&& reques .fail([](Roar::Error const&) { std::cout << "Could not upgrade to websocket.\n"; }); -} +} ``` \ No newline at end of file diff --git a/examples/100_continue/main.cpp b/examples/100_continue/main.cpp index 27fa9282..3b1ece6b 100644 --- a/examples/100_continue/main.cpp +++ b/examples/100_continue/main.cpp @@ -30,7 +30,7 @@ int main() server.installRequestListener(); // Start server and bind on port "port". - server.start(port); + (void)server.start(port); std::cout << Roar::Curl::Request{}.verbose().source("Small").put("http://localhost:" + std::to_string(port) + "/").code() diff --git a/examples/most_minimal/main.cpp b/examples/most_minimal/main.cpp index b2369774..4d250c89 100644 --- a/examples/most_minimal/main.cpp +++ b/examples/most_minimal/main.cpp @@ -22,7 +22,7 @@ int main() }}; // Start server and bind on port "port". - server.start(8081); + (void)server.start(8081); // Prevent exit somehow: std::cin.get(); diff --git a/examples/serve_directory/main.cpp b/examples/serve_directory/main.cpp index e43dd50a..c4e6a20b 100644 --- a/examples/serve_directory/main.cpp +++ b/examples/serve_directory/main.cpp @@ -28,7 +28,7 @@ int main() }}; // Start server and bind on port "port". - server.start(port); + (void)server.start(port); // Add a request listener class. server.installRequestListener(); diff --git a/examples/simple_server/main.cpp b/examples/simple_server/main.cpp index 2b58ae63..62686594 100644 --- a/examples/simple_server/main.cpp +++ b/examples/simple_server/main.cpp @@ -40,7 +40,7 @@ int main() }}; // Start server and bind on port "port". - server.start(port); + (void)server.start(port); // Add a request listener class. server.installRequestListener(); diff --git a/examples/websocket/main.cpp b/examples/websocket/main.cpp index 60f72692..b15ec8ae 100644 --- a/examples/websocket/main.cpp +++ b/examples/websocket/main.cpp @@ -22,7 +22,7 @@ int main() Roar::Server server{{.executor = executor}}; // Start server and bind on port "port". - server.start(port); + (void)server.start(port); // Add a request listener class. server.installRequestListener(); diff --git a/include/roar/directory_server/directory_server.hpp b/include/roar/directory_server/directory_server.hpp index 8db44c61..ae14b00a 100644 --- a/include/roar/directory_server/directory_server.hpp +++ b/include/roar/directory_server/directory_server.hpp @@ -178,7 +178,7 @@ namespace Roar::Detail else return {.file = *absolute, .relative = *relative, .status = std::filesystem::file_status{}}; } - return {.file = {}, .status = std::filesystem::file_status{}}; + return {}; }; std::pair fileAndStatus; diff --git a/include/roar/error.hpp b/include/roar/error.hpp index dda0cbb8..edcaa300 100644 --- a/include/roar/error.hpp +++ b/include/roar/error.hpp @@ -18,7 +18,7 @@ namespace Roar */ struct Error { - std::variant error; + std::variant error = std::string{}; std::string_view additionalInfo = {}; std::string toString() const; diff --git a/include/roar/routing/request_listener.hpp b/include/roar/routing/request_listener.hpp index 166b4a62..81d0a6b3 100644 --- a/include/roar/routing/request_listener.hpp +++ b/include/roar/routing/request_listener.hpp @@ -90,9 +90,9 @@ namespace Roar struct FileAndStatus { - std::filesystem::path file; - std::filesystem::path relative; - std::filesystem::file_status status; + std::filesystem::path file{}; + std::filesystem::path relative{}; + std::filesystem::file_status status{}; }; template using ServeHandlerType = ServeDecision (RequestListenerT::*)( diff --git a/scripts/publish_docs.sh b/scripts/publish_docs.sh index 7406ec7c..53de9b52 100644 --- a/scripts/publish_docs.sh +++ b/scripts/publish_docs.sh @@ -12,7 +12,7 @@ git clone --branch gh-pages git@github.com:5cript/roar.git . cd .. ./scripts/build_docs.sh -rsync -rts ./build/clang_docs/docs/ gh-pages +rsync -rts ./build/clang_debug/docs/ gh-pages # Do manually: # cd gh-pages diff --git a/test/util/common_server_setup.hpp b/test/util/common_server_setup.hpp index 92f51926..6880fe82 100644 --- a/test/util/common_server_setup.hpp +++ b/test/util/common_server_setup.hpp @@ -40,7 +40,9 @@ namespace Roar::Tests errors_.push_back(std::move(err)); }, }); - server_->start(); + auto result = server_->start(); + if (!result) + throw std::runtime_error{"Failed to start server"}; } std::pair generateCertAndKey() const @@ -86,7 +88,7 @@ namespace Roar::Tests errors_.push_back(std::move(err)); }, }); - secureServer_->start(); + (void)secureServer_->start(); } std::shared_ptr