From 405224bffe8c5ec649e35a49cf4422c88efe4a88 Mon Sep 17 00:00:00 2001 From: 0xFEEDC0DE64 Date: Thu, 7 Sep 2023 09:18:40 +0200 Subject: [PATCH] Remove default: switch cases to allow for compiler errors just in case new enum values are introduced --- src/esphttpdutils.cpp | 5 ++--- src/esphttpstatuscodes.cpp | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/esphttpdutils.cpp b/src/esphttpdutils.cpp index bc323af..f8e82b2 100644 --- a/src/esphttpdutils.cpp +++ b/src/esphttpdutils.cpp @@ -107,10 +107,9 @@ std::string toString(httpd_ws_type_t val) case HTTPD_WS_TYPE_CLOSE: return "HTTPD_WS_TYPE_CLOSE"; break; case HTTPD_WS_TYPE_PING: return "HTTPD_WS_TYPE_PING"; break; case HTTPD_WS_TYPE_PONG: return "HTTPD_WS_TYPE_PONG"; break; - default: - ESP_LOGW(TAG, "Unknown httpd_ws_type_t(%i)", std::to_underlying(val)); - return fmt::format("Unknown httpd_ws_type_t({})", std::to_underlying(val)); } + ESP_LOGW(TAG, "Unknown httpd_ws_type_t(%i)", std::to_underlying(val)); + return fmt::format("Unknown httpd_ws_type_t({})", std::to_underlying(val)); } } // namespace esphttpdutils diff --git a/src/esphttpstatuscodes.cpp b/src/esphttpstatuscodes.cpp index 3b439b3..ae36499 100644 --- a/src/esphttpstatuscodes.cpp +++ b/src/esphttpstatuscodes.cpp @@ -67,9 +67,6 @@ const char *toString(ResponseStatus status) case ResponseStatus::TooManyRequests: return "429 Too Many Requests"; case ResponseStatus::RequestHeaderFieldsTooLarge: return "431 Request Header Fields Too Large"; case ResponseStatus::UnavailableForLegalReasons: return "451 Unavailable For Legal Reasons"; - default: - ESP_LOGW(TAG, "unknown httpd_err_code_t(%i)", std::to_underlying(status)); - [[fallthrough]]; case ResponseStatus::InternalServerError: return "500 Internal Server Error"; case ResponseStatus::NotImplemented: return "501 Not Implemented"; case ResponseStatus::BadGateway: return "502 Bad Gateway"; @@ -82,6 +79,9 @@ const char *toString(ResponseStatus status) case ResponseStatus::NotExtended: return "510 Not Extended"; case ResponseStatus::NetworkAuthenticationRequired: return "511 Network Authentication Required"; } + + ESP_LOGW(TAG, "unknown httpd_err_code_t(%i)", std::to_underlying(status)); + return "500 Internal Server Error"; } } // namespace esphttpdutils