From 203e9ed9b6663c3285fb6ff65bd8628867f7a92c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ange-Marie=20MAURIN=20-=20A2M=20Syst=C3=A8mes?= Date: Sat, 7 Nov 2026 04:37:59 +0100 Subject: [PATCH] =?UTF-8?q?fix(studio/host):=20corrections=20signal=C3=A9e?= =?UTF-8?q?s=20par=20clangd?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Initialiseurs désignés pour ParsedOptions, RequestResult et Error ; candidate non const dans find_ui_dir pour permettre le déplacement au retour ; ErrorCode sur std::uint8_t. --- studio/host/app/src/options.cpp | 9 +++++---- studio/host/app/src/studio_host.cpp | 4 +++- studio/host/client/include/sequa/studio/host/client.hpp | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/studio/host/app/src/options.cpp b/studio/host/app/src/options.cpp index fad57f9..b59ff4d 100644 --- a/studio/host/app/src/options.cpp +++ b/studio/host/app/src/options.cpp @@ -66,7 +66,7 @@ ParsedOptions parse_options(std::span args) for (std::size_t i = 0; i < args.size(); ++i) { const std::string_view arg = args[i]; const bool has_value = i + 1 < args.size(); - const auto fail = [](std::string message) { return ParsedOptions{std::nullopt, std::move(message)}; }; + const auto fail = [](std::string message) { return ParsedOptions{.options=std::nullopt, .error=std::move(message)}; }; if (arg == "--help" || arg == "-h") { options.help = true; } else if (arg == "--detach-core") { @@ -101,9 +101,9 @@ ParsedOptions parse_options(std::span args) } } if (options.core_port == options.ui_port) { - return {std::nullopt, "Le Core et l'interface ne peuvent pas partager le même port."}; + return {.options=std::nullopt, .error="Le Core et l'interface ne peuvent pas partager le même port."}; } - return {options, {}}; + return {.options=options, .error={}}; } std::optional find_core_exe(const std::filesystem::path& exe_dir) @@ -124,7 +124,8 @@ std::optional find_ui_dir(const std::filesystem::path& ex { for (std::filesystem::path dir = exe_dir; dir.has_parent_path() && dir != dir.parent_path(); dir = dir.parent_path()) { - const auto candidate = dir / "studio" / "ui" / "dist"; + // const auto candidate = dir / "studio" / "ui" / "dist"; + auto candidate = dir / "studio" / "ui" / "dist"; if (is_file(candidate / "index.html")) { return candidate; } diff --git a/studio/host/app/src/studio_host.cpp b/studio/host/app/src/studio_host.cpp index 5fa63e2..001f687 100644 --- a/studio/host/app/src/studio_host.cpp +++ b/studio/host/app/src/studio_host.cpp @@ -55,7 +55,9 @@ std::string StudioHost::core_url() const RequestResult StudioHost::request(const std::string& type, const json& payload, std::chrono::milliseconds timeout) { if (!client_) { - return {std::nullopt, Error{ErrorCode::NotConnected, "Pas de connexion au Core.", {}, 0}}; + return {.value=std::nullopt, + .error = Error{.code=ErrorCode::NotConnected,.message= "Pas de connexion au Core.", .server_code={}, .close_code= 0} + }; } return client_->request(type, payload, timeout); } diff --git a/studio/host/client/include/sequa/studio/host/client.hpp b/studio/host/client/include/sequa/studio/host/client.hpp index 9faac22..268f128 100644 --- a/studio/host/client/include/sequa/studio/host/client.hpp +++ b/studio/host/client/include/sequa/studio/host/client.hpp @@ -32,7 +32,7 @@ struct Welcome { }; // Catégorie d'erreur renvoyée par le client. -enum class ErrorCode { +enum class ErrorCode : std::uint8_t { NotConnected, // aucune connexion ouverte au moment de la requête Timeout, // délai dépassé (connexion ou réponse) ConnectFailed, // connexion réseau impossible (hôte/port injoignable)