Compilation fixes for old gcc compiler

This commit is contained in:
Luca Deri
2022-05-28 16:06:34 +02:00
parent 7e3d061428
commit 77dc884a4c
3 changed files with 182 additions and 172 deletions
+4 -3
View File
@@ -1640,7 +1640,9 @@ static void printFlowSerialized(u_int16_t thread_id,
ndpi_serialize_start_of_list(serializer, "risks"); ndpi_serialize_start_of_list(serializer, "risks");
if (flow->risk != NDPI_NO_RISK) if (flow->risk != NDPI_NO_RISK)
{ {
for (u_int32_t i = 0; i < NDPI_MAX_RISK; ++i) u_int32_t i;
for(i = 0; i < NDPI_MAX_RISK; ++i)
{ {
if (NDPI_ISSET_BIT(flow->risk, i) != 0) if (NDPI_ISSET_BIT(flow->risk, i) != 0)
{ {
@@ -3261,8 +3263,7 @@ static void printFlowsStats() {
num_flows = 0; num_flows = 0;
for(thread_id = 0; thread_id < num_threads; thread_id++) { for(thread_id = 0; thread_id < num_threads; thread_id++) {
for (i = 0; i < NUM_ROOTS; i++) for(i = 0; i < NUM_ROOTS; i++) {
{
ndpi_twalk(ndpi_thread_info[thread_id].workflow->ndpi_flows_root[i], ndpi_twalk(ndpi_thread_info[thread_id].workflow->ndpi_flows_root[i],
node_print_known_proto_walker, &thread_id); node_print_known_proto_walker, &thread_id);
ndpi_twalk(ndpi_thread_info[thread_id].workflow->ndpi_flows_root[i], ndpi_twalk(ndpi_thread_info[thread_id].workflow->ndpi_flows_root[i],
+8 -4
View File
@@ -2260,8 +2260,9 @@ int ndpi_isset_risk(struct ndpi_detection_module_struct *ndpi_str,
int ndpi_is_printable_string(char * const str, size_t len) { int ndpi_is_printable_string(char * const str, size_t len) {
int retval = 1; int retval = 1;
size_t i;
for (size_t i = 0; i < len; ++i) { for(i = 0; i < len; ++i) {
if(ndpi_isprint(str[i]) == 0) { if(ndpi_isprint(str[i]) == 0) {
str[i] = '?'; str[i] = '?';
retval = 0; retval = 0;
@@ -2274,7 +2275,9 @@ int ndpi_is_printable_string(char * const str, size_t len) {
/* ******************************************************************** */ /* ******************************************************************** */
int ndpi_is_valid_hostname(char * const str, size_t len) { int ndpi_is_valid_hostname(char * const str, size_t len) {
for (size_t i = 0; i < len; ++i) { size_t i;
for(i = 0; i < len; ++i) {
if((str[i] == '.') if((str[i] == '.')
|| (str[i] == '-') || (str[i] == '-')
|| (str[i] == '_') || (str[i] == '_')
@@ -2297,14 +2300,15 @@ int ndpi_is_valid_hostname(char * const str, size_t len) {
float ndpi_entropy(u_int8_t const * const buf, size_t len) { float ndpi_entropy(u_int8_t const * const buf, size_t len) {
float entropy = 0.0f; float entropy = 0.0f;
u_int32_t byte_counters[256]; u_int32_t byte_counters[256];
size_t i;
memset(byte_counters, 0, sizeof(byte_counters)); memset(byte_counters, 0, sizeof(byte_counters));
for (size_t i = 0; i < len; ++i) { for(i = 0; i < len; ++i) {
byte_counters[buf[i]]++; byte_counters[buf[i]]++;
} }
for (size_t i = 0; i < sizeof(byte_counters) / sizeof(byte_counters[0]); ++i) { for(i = 0; i < sizeof(byte_counters) / sizeof(byte_counters[0]); ++i) {
if(byte_counters[i] == 0) { if(byte_counters[i] == 0) {
continue; continue;
} }
+166 -161
View File
File diff suppressed because it is too large Load Diff