Browse Source

[Fix] Fix tokens usage

tags/1.5.0
Vsevolod Stakhov 7 years ago
parent
commit
0064208668
2 changed files with 8 additions and 5 deletions
  1. 4
    3
      src/libutil/shingles.c
  2. 4
    2
      src/plugins/chartable.c

+ 4
- 3
src/libutil/shingles.c View File

#include "fstring.h" #include "fstring.h"
#include "cryptobox.h" #include "cryptobox.h"
#include "images.h" #include "images.h"
#include "libstat/stat_api.h"


#define SHINGLES_WINDOW 3 #define SHINGLES_WINDOW 3


guchar shabuf[rspamd_cryptobox_HASHBYTES], *out_key; guchar shabuf[rspamd_cryptobox_HASHBYTES], *out_key;
const guchar *cur_key; const guchar *cur_key;
rspamd_fstring_t *row; rspamd_fstring_t *row;
rspamd_ftok_t *word;
rspamd_stat_token_t *word;
rspamd_cryptobox_hash_state_t bs; rspamd_cryptobox_hash_state_t bs;
guint64 val; guint64 val;
gint i, j, k; gint i, j, k;
for (i = 0; i <= (gint)input->len; i ++) { for (i = 0; i <= (gint)input->len; i ++) {
if (i - beg >= SHINGLES_WINDOW || i == (gint)input->len) { if (i - beg >= SHINGLES_WINDOW || i == (gint)input->len) {
for (j = beg; j < i; j ++) { 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); row = rspamd_fstring_append (row, word->begin, word->len);
} }


res[j * SHINGLES_WINDOW + k + 1]; 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 */ /* Insert the last element to the pipe */
memcpy (&seed, keys[j], sizeof (seed)); memcpy (&seed, keys[j], sizeof (seed));
res[j * SHINGLES_WINDOW + SHINGLES_WINDOW - 1] = res[j * SHINGLES_WINDOW + SHINGLES_WINDOW - 1] =

+ 4
- 2
src/plugins/chartable.c View File

} }
} }


msg_debug_chartable ("word %T, badness: %.2f", w, badness);
msg_debug_chartable ("word %*s, badness: %.2f", (gint)w->len, w->begin,
badness);


return badness; return badness;
} }
badness = 4.0; 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; return badness;
} }

Loading…
Cancel
Save