]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
source: fix -Wshorten-64-to-32 warnings
authorPhilippe Antoine <pantoine@oisf.net>
Mon, 29 Jul 2024 19:57:01 +0000 (21:57 +0200)
committerVictor Julien <victor@inliniac.net>
Thu, 1 Aug 2024 05:05:15 +0000 (07:05 +0200)
Ticket: #6186

src/source-erf-file.c
src/source-pcap.c

index f3102cebf3e797911011dec161c75c1fcc672d88..5253ab660a0f160e45713b72388fa4286aade49b 100644 (file)
@@ -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");
index f916d69354c7fab1d50c63df62f2c0eaea3781ac..3ccc28b8c96801129a5e22e36f0e644c5d025456 100644 (file)
@@ -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);