From 403c69463a8cd843116fd355bd7a62289de4841f Mon Sep 17 00:00:00 2001 From: Dominik Nakamura Date: Wed, 2 Feb 2022 10:36:59 +0900 Subject: [PATCH] server: Fix int type of batch execution enum --- src/requesthandler/types/RequestBatchExecutionType.h | 4 ++-- src/websocketserver/WebSocketServer_Protocol.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/requesthandler/types/RequestBatchExecutionType.h b/src/requesthandler/types/RequestBatchExecutionType.h index d778ee99..df158ffe 100644 --- a/src/requesthandler/types/RequestBatchExecutionType.h +++ b/src/requesthandler/types/RequestBatchExecutionType.h @@ -22,7 +22,7 @@ with this program. If not, see #include namespace RequestBatchExecutionType { - enum RequestBatchExecutionType { + enum RequestBatchExecutionType: int8_t { /** * Not a request batch. * @@ -77,7 +77,7 @@ namespace RequestBatchExecutionType { Parallel = 2, }; - inline bool IsValid(int executionType) + inline bool IsValid(int8_t executionType) { return executionType >= None && executionType <= Parallel; } diff --git a/src/websocketserver/WebSocketServer_Protocol.cpp b/src/websocketserver/WebSocketServer_Protocol.cpp index 689ef977..67c082c3 100644 --- a/src/websocketserver/WebSocketServer_Protocol.cpp +++ b/src/websocketserver/WebSocketServer_Protocol.cpp @@ -233,7 +233,7 @@ void WebSocketServer::ProcessMessage(SessionPtr session, WebSocketServer::Proces return; } - uint8_t requestedExecutionType = payloadData["executionType"]; + int8_t requestedExecutionType = payloadData["executionType"]; if (!RequestBatchExecutionType::IsValid(requestedExecutionType) || requestedExecutionType == RequestBatchExecutionType::None) { ret.closeCode = WebSocketCloseCode::InvalidDataFieldValue; ret.closeReason = "Your `executionType` has an invalid value.";