From 2a22b4ca1f7f3254d28c555a80dbcfc76da5da85 Mon Sep 17 00:00:00 2001 From: Philippe Antoine Date: Thu, 14 Apr 2022 14:44:20 +0200 Subject: [PATCH] flow: fix integer warnings Ticket: 4516 --- src/flow-timeout.c | 4 ++-- src/flow.c | 3 ++- src/stream-tcp-reassemble.c | 2 +- src/stream-tcp.h | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/flow-timeout.c b/src/flow-timeout.c index d6cca49008..1fa057ae29 100644 --- a/src/flow-timeout.c +++ b/src/flow-timeout.c @@ -300,8 +300,8 @@ int FlowForceReassemblyNeedReassembly(Flow *f) } TcpSession *ssn = (TcpSession *)f->protoctx; - int client = StreamNeedsReassembly(ssn, STREAM_TOSERVER); - int server = StreamNeedsReassembly(ssn, STREAM_TOCLIENT); + uint8_t client = StreamNeedsReassembly(ssn, STREAM_TOSERVER); + uint8_t server = StreamNeedsReassembly(ssn, STREAM_TOCLIENT); /* if state is not fully closed we assume that we haven't fully * inspected the app layer state yet */ diff --git a/src/flow.c b/src/flow.c index c1353a8a31..b77c318d1a 100644 --- a/src/flow.c +++ b/src/flow.c @@ -1159,7 +1159,8 @@ void FlowUpdateState(Flow *f, const enum FlowState s) { if (s != f->flow_state) { /* set the state */ - f->flow_state = s; + // Explicit cast from the enum type to the compact version + f->flow_state = (FlowStateType)s; /* update timeout policy and value */ const uint32_t timeout_policy = FlowGetTimeoutPolicy(f); diff --git a/src/stream-tcp-reassemble.c b/src/stream-tcp-reassemble.c index cdc3e66dd3..114dba6e97 100644 --- a/src/stream-tcp-reassemble.c +++ b/src/stream-tcp-reassemble.c @@ -800,7 +800,7 @@ static int StreamTcpReassembleRawCheckLimit(const TcpSession *ssn, /** * \brief see what if any work the TCP session still needs */ -int StreamNeedsReassembly(const TcpSession *ssn, uint8_t direction) +uint8_t StreamNeedsReassembly(const TcpSession *ssn, uint8_t direction) { const TcpStream *stream = NULL; #ifdef DEBUG diff --git a/src/stream-tcp.h b/src/stream-tcp.h index 3b4f4fc8a4..4284f5e73f 100644 --- a/src/stream-tcp.h +++ b/src/stream-tcp.h @@ -175,7 +175,7 @@ enum { }; TmEcode StreamTcp (ThreadVars *, Packet *, void *, PacketQueueNoLock *); -int StreamNeedsReassembly(const TcpSession *ssn, uint8_t direction); +uint8_t StreamNeedsReassembly(const TcpSession *ssn, uint8_t direction); TmEcode StreamTcpThreadInit(ThreadVars *, void *, void **); TmEcode StreamTcpThreadDeinit(ThreadVars *tv, void *data); void StreamTcpRegisterTests (void); -- 2.47.2