The bloom filters computing had been implemented in the past, basing
on systemd. However, the reimplementation introduced two bugs:
- no clearing of 'p' variable;
- clearing of hash_index variable in a wrong place.
This fixes the bugs.
The same applies to libdbus.
Change-Id: I92d5fe7f270306c96e8a38c96d0a06d38b8e59b1
guint hash_index = 0;
guint c = 0;
- guint64 p = 0;
bit_num = (guint64)worker->bloom_size * 8;
if (bit_num > 1)
bytes_num = ((__builtin_clzll(bit_num) ^ 63U) + 7) / 8;
- for (cnt_1 = 0; cnt_1 < (worker->bloom_n_hash); cnt_1++)
+ for (cnt_1 = 0, hash_index = 0; cnt_1 < (worker->bloom_n_hash); cnt_1++)
{
- for (cnt_2 = 0, hash_index = 0; cnt_2 < bytes_num; cnt_2++)
+ guint64 p = 0;
+ for (cnt_2 = 0; cnt_2 < bytes_num; cnt_2++)
{
if (c <= 0)
{