From: Philippe Antoine Date: Tue, 26 Jul 2022 13:17:56 +0000 (+0200) Subject: util: fix integer warnings in profiling X-Git-Tag: suricata-7.0.0-beta1~379 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=36b1344680c19117cb35489687a45bf38c5c381f;p=thirdparty%2Fsuricata.git util: fix integer warnings in profiling --- diff --git a/src/util-profiling-rules.c b/src/util-profiling-rules.c index d41985adf2..6c3f31d967 100644 --- a/src/util-profiling-rules.c +++ b/src/util-profiling-rules.c @@ -55,7 +55,7 @@ typedef struct SCProfileData_ { typedef struct SCProfileDetectCtx_ { uint32_t size; - uint32_t id; + uint16_t id; SCProfileData *data; pthread_mutex_t data_m; } SCProfileDetectCtx; diff --git a/src/util-profiling.c b/src/util-profiling.c index faeb3b6cc2..b3c98fa552 100644 --- a/src/util-profiling.c +++ b/src/util-profiling.c @@ -515,10 +515,10 @@ void SCProfilingDumpPacketStats(void) total += pd->tot; } } - for (m = 0; m < ALPROTO_MAX; m++) { + for (AppProto a = 0; a < ALPROTO_MAX; a++) { int p; for (p = 0; p < 257; p++) { - SCProfilePacketData *pd = &packet_profile_app_data4[m][p]; + SCProfilePacketData *pd = &packet_profile_app_data4[a][p]; if (pd->cnt == 0) { continue; @@ -528,15 +528,18 @@ void SCProfilingDumpPacketStats(void) double percent = (long double)pd->tot / (long double)total * 100; - fprintf(fp, "%-20s IPv4 %3d %12"PRIu64" %12"PRIu64" %12"PRIu64" %12"PRIu64" %12s %-6.2f\n", - AppProtoToString(m), p, pd->cnt, pd->min, pd->max, (uint64_t)(pd->tot / pd->cnt), totalstr, percent); + fprintf(fp, + "%-20s IPv4 %3d %12" PRIu64 " %12" PRIu64 " %12" PRIu64 + " %12" PRIu64 " %12s %-6.2f\n", + AppProtoToString(a), p, pd->cnt, pd->min, pd->max, + (uint64_t)(pd->tot / pd->cnt), totalstr, percent); } } - for (m = 0; m < ALPROTO_MAX; m++) { + for (AppProto a = 0; a < ALPROTO_MAX; a++) { int p; for (p = 0; p < 257; p++) { - SCProfilePacketData *pd = &packet_profile_app_data6[m][p]; + SCProfilePacketData *pd = &packet_profile_app_data6[a][p]; if (pd->cnt == 0) { continue; @@ -546,8 +549,11 @@ void SCProfilingDumpPacketStats(void) double percent = (long double)pd->tot / (long double)total * 100; - fprintf(fp, "%-20s IPv6 %3d %12"PRIu64" %12"PRIu64" %12"PRIu64" %12"PRIu64" %12s %-6.2f\n", - AppProtoToString(m), p, pd->cnt, pd->min, pd->max, (uint64_t)(pd->tot / pd->cnt), totalstr, percent); + fprintf(fp, + "%-20s IPv6 %3d %12" PRIu64 " %12" PRIu64 " %12" PRIu64 + " %12" PRIu64 " %12s %-6.2f\n", + AppProtoToString(a), p, pd->cnt, pd->min, pd->max, + (uint64_t)(pd->tot / pd->cnt), totalstr, percent); } }