From: Philippe Antoine Date: Tue, 18 Jan 2022 10:19:21 +0000 (+0100) Subject: app-layer: fix integer warnings X-Git-Tag: suricata-7.0.0-beta1~751 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f30975fb1604c21a4a2fbb2beace91d71ea26dd9;p=thirdparty%2Fsuricata.git app-layer: fix integer warnings Ticket: 4516 --- diff --git a/src/app-layer-detect-proto.c b/src/app-layer-detect-proto.c index 5b43b0a97c..0ee69117d9 100644 --- a/src/app-layer-detect-proto.c +++ b/src/app-layer-detect-proto.c @@ -1845,7 +1845,7 @@ int AppLayerProtoDetectSetup(void) memset(&alpd_ctx, 0, sizeof(alpd_ctx)); uint16_t spm_matcher = SinglePatternMatchDefaultMatcher(); - uint16_t mpm_matcher = PatternMatchDefaultMatcher(); + uint8_t mpm_matcher = PatternMatchDefaultMatcher(); alpd_ctx.spm_global_thread_ctx = SpmInitGlobalThreadCtx(spm_matcher); if (alpd_ctx.spm_global_thread_ctx == NULL) { diff --git a/src/app-layer-frames.c b/src/app-layer-frames.c index cadbfafafc..71f6247e5c 100644 --- a/src/app-layer-frames.c +++ b/src/app-layer-frames.c @@ -70,7 +70,7 @@ Frame *FrameGetByIndex(Frames *frames, const uint32_t idx) FrameDebug("get_by_idx(s)", frames, frame); return frame; } else { - const uint16_t o = idx - FRAMES_STATIC_CNT; + const uint32_t o = idx - FRAMES_STATIC_CNT; Frame *frame = &frames->dframes[o]; FrameDebug("get_by_idx(d)", frames, frame); return frame; diff --git a/src/app-layer-parser.c b/src/app-layer-parser.c index 3b04aa94c5..97172b7046 100644 --- a/src/app-layer-parser.c +++ b/src/app-layer-parser.c @@ -1256,7 +1256,7 @@ int AppLayerParserParse(ThreadVars *tv, AppLayerParserThreadCtx *alp_tctx, Flow void *alstate = NULL; uint64_t p_tx_cnt = 0; uint32_t consumed = input_len; - const int direction = (flags & STREAM_TOSERVER) ? 0 : 1; + const uint8_t direction = (flags & STREAM_TOSERVER) ? 0 : 1; /* we don't have the parser registered for this protocol */ if (p->StateAlloc == NULL) diff --git a/src/app-layer.c b/src/app-layer.c index c7651f571a..01be13c65d 100644 --- a/src/app-layer.c +++ b/src/app-layer.c @@ -345,7 +345,7 @@ static int TCPProtoDetect(ThreadVars *tv, { AppProto *alproto; AppProto *alproto_otherdir; - int direction = (flags & STREAM_TOSERVER) ? 0 : 1; + uint8_t direction = (flags & STREAM_TOSERVER) ? 0 : 1; if (flags & STREAM_TOSERVER) { alproto = &f->alproto_ts; @@ -651,7 +651,7 @@ int AppLayerHandleTCPData(ThreadVars *tv, TcpReassemblyThreadCtx *ra_ctx, goto end; } - const int direction = (flags & STREAM_TOSERVER) ? 0 : 1; + const uint8_t direction = (flags & STREAM_TOSERVER) ? 0 : 1; if (flags & STREAM_TOSERVER) { alproto = f->alproto_ts; diff --git a/src/detect-engine-mpm.c b/src/detect-engine-mpm.c index afff06d960..2d55e709ed 100644 --- a/src/detect-engine-mpm.c +++ b/src/detect-engine-mpm.c @@ -853,10 +853,10 @@ int SignatureHasStreamContent(const Signature *s) * * \retval mpm algo value */ -uint16_t PatternMatchDefaultMatcher(void) +uint8_t PatternMatchDefaultMatcher(void) { const char *mpm_algo; - uint16_t mpm_algo_val = mpm_default_matcher; + uint8_t mpm_algo_val = mpm_default_matcher; /* Get the mpm algo defined in config file by the user */ if ((ConfGet("mpm-algo", &mpm_algo)) == 1) { diff --git a/src/detect-engine-mpm.h b/src/detect-engine-mpm.h index a9149be8e1..2aa2e1a666 100644 --- a/src/detect-engine-mpm.h +++ b/src/detect-engine-mpm.h @@ -43,7 +43,7 @@ int DetectMpmPrepareBuiltinMpms(DetectEngineCtx *de_ctx); uint32_t PatternStrength(uint8_t *, uint16_t); -uint16_t PatternMatchDefaultMatcher(void); +uint8_t PatternMatchDefaultMatcher(void); uint32_t DnsQueryPatternSearch(DetectEngineThreadCtx *det_ctx, uint8_t *buffer, uint32_t buffer_len, uint8_t flags); void PatternMatchPrepare(MpmCtx *, uint16_t);