From f96994fb3beab64fea67526b44a12bd75d7d2a16 Mon Sep 17 00:00:00 2001 From: Philippe Antoine Date: Mon, 29 Jul 2024 21:57:01 +0200 Subject: [PATCH] source: fix -Wshorten-64-to-32 warnings Ticket: #6186 --- src/source-erf-file.c | 2 +- src/source-pcap.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/source-erf-file.c b/src/source-erf-file.c index f3102cebf3..5253ab660a 100644 --- a/src/source-erf-file.c +++ b/src/source-erf-file.c @@ -158,7 +158,7 @@ static inline TmEcode ReadErfRecord(ThreadVars *tv, Packet *p, void *data) ErfFileThreadVars *etv = (ErfFileThreadVars *)data; DagRecord dr; - int r = fread(&dr, sizeof(DagRecord), 1, etv->erf); + size_t r = fread(&dr, sizeof(DagRecord), 1, etv->erf); if (r < 1) { if (feof(etv->erf)) { SCLogInfo("End of ERF file reached"); diff --git a/src/source-pcap.c b/src/source-pcap.c index f916d69354..3ccc28b8c9 100644 --- a/src/source-pcap.c +++ b/src/source-pcap.c @@ -166,7 +166,7 @@ void TmModuleDecodePcapRegister (void) static inline void UpdatePcapStatsValue64(uint64_t *last, uint32_t current32) { /* uint64_t -> uint32_t is defined behaviour. It slices lower 32bits. */ - uint32_t last32 = *last; + uint32_t last32 = (uint32_t)*last; /* Branchless code as wrap-around is defined for unsigned */ *last += (uint32_t)(current32 - last32);