aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-07-05 12:57:58 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-07-05 12:57:58 +0100
commit2d0e4061c78be4c7d1fc713a7e2f199f26134658 (patch)
treeeb68a54f825e13e7e1652820a37a7fe8fefeedc6 /src/libutil
parent39fec823f124a82dd6a4bcd06a53a0ff062f4ac0 (diff)
downloadrspamd-2d0e4061c78be4c7d1fc713a7e2f199f26134658.tar.gz
rspamd-2d0e4061c78be4c7d1fc713a7e2f199f26134658.zip
[Minor] Fix couple of warnings and disable -pedantic mode
Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/heap.c2
-rw-r--r--src/libutil/map.c2
-rw-r--r--src/libutil/multipattern.c2
-rw-r--r--src/libutil/shingles.c8
4 files changed, 8 insertions, 6 deletions
diff --git a/src/libutil/heap.c b/src/libutil/heap.c
index f5084e4b0..ae8e14131 100644
--- a/src/libutil/heap.c
+++ b/src/libutil/heap.c
@@ -193,7 +193,7 @@ struct rspamd_min_heap_elt*
rspamd_min_heap_index (struct rspamd_min_heap *heap, guint idx)
{
g_assert (heap != NULL);
- g_assert (idx >= 0 && idx < heap->ar->len);
+ g_assert (idx < heap->ar->len);
return g_ptr_array_index (heap->ar, idx);
}
diff --git a/src/libutil/map.c b/src/libutil/map.c
index 354ac722e..0c8e6b925 100644
--- a/src/libutil/map.c
+++ b/src/libutil/map.c
@@ -1420,7 +1420,7 @@ rspamd_map_add_from_ucl (struct rspamd_config *cfg,
g_ptr_array_add (map->backends, bk);
if (!map->name) {
- map->name = g_strdup (ucl_object_tostring (cur));
+ map->name = g_strdup (ucl_object_tostring (elt));
}
}
}
diff --git a/src/libutil/multipattern.c b/src/libutil/multipattern.c
index 9f5bdb4cc..c4085e315 100644
--- a/src/libutil/multipattern.c
+++ b/src/libutil/multipattern.c
@@ -514,7 +514,7 @@ rspamd_multipattern_compile (struct rspamd_multipattern *mp, GError **err)
}
#else
if (mp->cnt > 0) {
- mp->t = acism_create (mp->pats->data, mp->cnt);
+ mp->t = acism_create ((const ac_trie_pat_t *)mp->pats->data, mp->cnt);
}
#endif
mp->compiled = TRUE;
diff --git a/src/libutil/shingles.c b/src/libutil/shingles.c
index 66f6b457c..0f35a07e0 100644
--- a/src/libutil/shingles.c
+++ b/src/libutil/shingles.c
@@ -99,7 +99,7 @@ rspamd_shingles_generate (GArray *input,
}
}
else {
- guint64 res[SHINGLES_WINDOW * RSPAMD_SHINGLE_SIZE];
+ guint64 res[SHINGLES_WINDOW * RSPAMD_SHINGLE_SIZE], seed;
switch (alg) {
case RSPAMD_SHINGLES_XXHASH:
@@ -127,13 +127,15 @@ rspamd_shingles_generate (GArray *input,
word = &g_array_index (input, rspamd_ftok_t, beg);
/* Insert the last element to the pipe */
+ memcpy (&seed, keys[j], sizeof (seed));
res[j * SHINGLES_WINDOW + SHINGLES_WINDOW - 1] =
rspamd_cryptobox_fast_hash_specific (ht,
word->begin, word->len,
- *(guint64 *)keys[j]);
+ seed);
val = 0;
for (k = 0; k < SHINGLES_WINDOW; k ++) {
- val ^= res[j * SHINGLES_WINDOW + k] >> (8 * (SHINGLES_WINDOW - k - 1));
+ val ^= res[j * SHINGLES_WINDOW + k] >>
+ (8 * (SHINGLES_WINDOW - k - 1));
}
g_assert (hlen > beg);