From: Vsevolod Stakhov Date: Tue, 14 Feb 2017 14:35:52 +0000 (+0000) Subject: [Fix] Fix tokens usage X-Git-Tag: 1.5.0~103 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0064208668433a36973f828adf1db81b6e418f78;p=rspamd.git [Fix] Fix tokens usage --- diff --git a/src/libutil/shingles.c b/src/libutil/shingles.c index b2990de63..236e8113a 100644 --- a/src/libutil/shingles.c +++ b/src/libutil/shingles.c @@ -17,6 +17,7 @@ #include "fstring.h" #include "cryptobox.h" #include "images.h" +#include "libstat/stat_api.h" #define SHINGLES_WINDOW 3 @@ -34,7 +35,7 @@ rspamd_shingles_from_text (GArray *input, guchar shabuf[rspamd_cryptobox_HASHBYTES], *out_key; const guchar *cur_key; rspamd_fstring_t *row; - rspamd_ftok_t *word; + rspamd_stat_token_t *word; rspamd_cryptobox_hash_state_t bs; guint64 val; gint i, j, k; @@ -81,7 +82,7 @@ rspamd_shingles_from_text (GArray *input, for (i = 0; i <= (gint)input->len; i ++) { if (i - beg >= SHINGLES_WINDOW || i == (gint)input->len) { for (j = beg; j < i; j ++) { - word = &g_array_index (input, rspamd_ftok_t, j); + word = &g_array_index (input, rspamd_stat_token_t, j); row = rspamd_fstring_append (row, word->begin, word->len); } @@ -125,7 +126,7 @@ rspamd_shingles_from_text (GArray *input, res[j * SHINGLES_WINDOW + k + 1]; } - word = &g_array_index (input, rspamd_ftok_t, beg); + word = &g_array_index (input, rspamd_stat_token_t, beg); /* Insert the last element to the pipe */ memcpy (&seed, keys[j], sizeof (seed)); res[j * SHINGLES_WINDOW + SHINGLES_WINDOW - 1] = diff --git a/src/plugins/chartable.c b/src/plugins/chartable.c index 172a69261..6e55ad358 100644 --- a/src/plugins/chartable.c +++ b/src/plugins/chartable.c @@ -254,7 +254,8 @@ rspamd_chartable_process_word_utf (struct rspamd_task *task, } } - msg_debug_chartable ("word %T, badness: %.2f", w, badness); + msg_debug_chartable ("word %*s, badness: %.2f", (gint)w->len, w->begin, + badness); return badness; } @@ -337,7 +338,8 @@ rspamd_chartable_process_word_ascii (struct rspamd_task *task, badness = 4.0; } - msg_debug_chartable ("word %T, badness: %.2f", w, badness); + msg_debug_chartable ("word %*s, badness: %.2f", (gint)w->len, w->begin, + badness); return badness; }