server: Fix int type of batch execution enum

This commit is contained in:
Dominik Nakamura 2022-02-02 10:36:59 +09:00
parent e80bcad1e1
commit 403c69463a
No known key found for this signature in database
GPG Key ID: E4C6A749B2491910
2 changed files with 3 additions and 3 deletions

View File

@ -22,7 +22,7 @@ with this program. If not, see <https://www.gnu.org/licenses/>
#include <stdint.h> #include <stdint.h>
namespace RequestBatchExecutionType { namespace RequestBatchExecutionType {
enum RequestBatchExecutionType { enum RequestBatchExecutionType: int8_t {
/** /**
* Not a request batch. * Not a request batch.
* *
@ -77,7 +77,7 @@ namespace RequestBatchExecutionType {
Parallel = 2, Parallel = 2,
}; };
inline bool IsValid(int executionType) inline bool IsValid(int8_t executionType)
{ {
return executionType >= None && executionType <= Parallel; return executionType >= None && executionType <= Parallel;
} }

View File

@ -233,7 +233,7 @@ void WebSocketServer::ProcessMessage(SessionPtr session, WebSocketServer::Proces
return; return;
} }
uint8_t requestedExecutionType = payloadData["executionType"]; int8_t requestedExecutionType = payloadData["executionType"];
if (!RequestBatchExecutionType::IsValid(requestedExecutionType) || requestedExecutionType == RequestBatchExecutionType::None) { if (!RequestBatchExecutionType::IsValid(requestedExecutionType) || requestedExecutionType == RequestBatchExecutionType::None) {
ret.closeCode = WebSocketCloseCode::InvalidDataFieldValue; ret.closeCode = WebSocketCloseCode::InvalidDataFieldValue;
ret.closeReason = "Your `executionType` has an invalid value."; ret.closeReason = "Your `executionType` has an invalid value.";