Compilation fixes for old gcc compiler
This commit is contained in:
@@ -364,7 +364,7 @@ flowGetBDMeanandVariance(struct ndpi_flow_info* flow) {
|
||||
if (!flow->bidirectional) {
|
||||
array = last_entropy->src2dst_byte_count;
|
||||
num_bytes = last_entropy->src2dst_l4_bytes;
|
||||
for (i=0; i<256; i++) {
|
||||
for(i=0; i<256; i++) {
|
||||
tmp[i] = last_entropy->src2dst_byte_count[i];
|
||||
}
|
||||
|
||||
@@ -378,7 +378,7 @@ flowGetBDMeanandVariance(struct ndpi_flow_info* flow) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (i=0; i<256; i++) {
|
||||
for(i=0; i<256; i++) {
|
||||
tmp[i] = last_entropy->src2dst_byte_count[i] + last_entropy->dst2src_byte_count[i];
|
||||
}
|
||||
array = tmp;
|
||||
@@ -1640,7 +1640,9 @@ static void printFlowSerialized(u_int16_t thread_id,
|
||||
ndpi_serialize_start_of_list(serializer, "risks");
|
||||
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)
|
||||
{
|
||||
@@ -3260,9 +3262,8 @@ static void printFlowsStats() {
|
||||
unsigned int i;
|
||||
|
||||
num_flows = 0;
|
||||
for (thread_id = 0; thread_id < num_threads; thread_id++) {
|
||||
for (i = 0; i < NUM_ROOTS; i++)
|
||||
{
|
||||
for(thread_id = 0; thread_id < num_threads; thread_id++) {
|
||||
for(i = 0; i < NUM_ROOTS; i++) {
|
||||
ndpi_twalk(ndpi_thread_info[thread_id].workflow->ndpi_flows_root[i],
|
||||
node_print_known_proto_walker, &thread_id);
|
||||
ndpi_twalk(ndpi_thread_info[thread_id].workflow->ndpi_flows_root[i],
|
||||
|
||||
@@ -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 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) {
|
||||
str[i] = '?';
|
||||
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) {
|
||||
for (size_t i = 0; i < len; ++i) {
|
||||
size_t i;
|
||||
|
||||
for(i = 0; i < len; ++i) {
|
||||
if((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 entropy = 0.0f;
|
||||
u_int32_t byte_counters[256];
|
||||
size_t i;
|
||||
|
||||
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]]++;
|
||||
}
|
||||
|
||||
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) {
|
||||
continue;
|
||||
}
|
||||
@@ -2330,7 +2334,7 @@ u_int16_t ndpi_calculate_icmp4_checksum(const u_int8_t * buf, size_t len) {
|
||||
* The next two bytes is the checksum, which we want to ignore.
|
||||
*/
|
||||
|
||||
for (; len > 1; len -= 2) {
|
||||
for(; len > 1; len -= 2) {
|
||||
checksum += get_n16bit(buf);
|
||||
buf += 2;
|
||||
}
|
||||
|
||||
Vendored
+166
-161
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user