From 2d0e4061c78be4c7d1fc713a7e2f199f26134658 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 5 Jul 2016 12:57:58 +0100 Subject: [Minor] Fix couple of warnings and disable -pedantic mode --- src/libutil/shingles.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/libutil/shingles.c') 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); -- cgit v1.2.3