From: Philippe Antoine Date: Mon, 29 Jul 2024 19:57:01 +0000 (+0200) Subject: source: fix -Wshorten-64-to-32 warnings X-Git-Tag: suricata-8.0.0-beta1~966 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f96994fb3beab64fea67526b44a12bd75d7d2a16;p=thirdparty%2Fsuricata.git source: fix -Wshorten-64-to-32 warnings Ticket: #6186 --- 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);