aboutsummaryrefslogtreecommitdiffstats
path: root/src
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
parent39fec823f124a82dd6a4bcd06a53a0ff062f4ac0 (diff)
downloadrspamd-2d0e4061c78be4c7d1fc713a7e2f199f26134658.tar.gz
rspamd-2d0e4061c78be4c7d1fc713a7e2f199f26134658.zip
[Minor] Fix couple of warnings and disable -pedantic mode
Diffstat (limited to 'src')
-rw-r--r--src/controller.c2
-rw-r--r--src/fuzzy_storage.c48
-rw-r--r--src/libmime/archives.c2
-rw-r--r--src/libserver/cfg_rcl.c4
-rw-r--r--src/libserver/fuzzy_backend.c5
-rw-r--r--src/libserver/html.c3
-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
-rw-r--r--src/lua/lua_common.c2
11 files changed, 39 insertions, 41 deletions
diff --git a/src/controller.c b/src/controller.c
index b45e5add5..13835ae77 100644
--- a/src/controller.c
+++ b/src/controller.c
@@ -1165,6 +1165,8 @@ rspamd_controller_handle_graph (
start_row = rrd_result->cur_row == rrd_result->rra_rows - 1 ?
0 : rrd_result->cur_row;
+ t = ts * rrd_result->pdp_per_cdp;
+ k = 0;
/* Create window */
step = (rrd_result->rra_rows / desired_points + 0.5);
diff --git a/src/fuzzy_storage.c b/src/fuzzy_storage.c
index 7f3dd4020..1501da58e 100644
--- a/src/fuzzy_storage.c
+++ b/src/fuzzy_storage.c
@@ -712,28 +712,30 @@ rspamd_fuzzy_process_command (struct fuzzy_session *session)
}
reply:
- result.tag = cmd->tag;
-
- memcpy (&session->reply.rep, &result, sizeof (result));
-
- rspamd_fuzzy_update_stats (session->ctx,
- session->epoch,
- result.prob > 0.5,
- is_shingle,
- session->key_stat,
- ip_stat, cmd->cmd,
- result.value);
-
- if (encrypted) {
- /* We need also to encrypt reply */
- ottery_rand_bytes (session->reply.hdr.nonce,
- sizeof (session->reply.hdr.nonce));
- rspamd_cryptobox_encrypt_nm_inplace ((guchar *)&session->reply.rep,
- sizeof (session->reply.rep),
- session->reply.hdr.nonce,
- session->nm,
- session->reply.hdr.mac,
- RSPAMD_CRYPTOBOX_MODE_25519);
+ if (cmd) {
+ result.tag = cmd->tag;
+
+ memcpy (&session->reply.rep, &result, sizeof (result));
+
+ rspamd_fuzzy_update_stats (session->ctx,
+ session->epoch,
+ result.prob > 0.5,
+ is_shingle,
+ session->key_stat,
+ ip_stat, cmd->cmd,
+ result.value);
+
+ if (encrypted) {
+ /* We need also to encrypt reply */
+ ottery_rand_bytes (session->reply.hdr.nonce,
+ sizeof (session->reply.hdr.nonce));
+ rspamd_cryptobox_encrypt_nm_inplace ((guchar *)&session->reply.rep,
+ sizeof (session->reply.rep),
+ session->reply.hdr.nonce,
+ session->nm,
+ session->reply.hdr.mac,
+ RSPAMD_CRYPTOBOX_MODE_25519);
+ }
}
rspamd_fuzzy_write_reply (session);
@@ -926,7 +928,7 @@ rspamd_fuzzy_mirror_process_update (struct fuzzy_master_update_session *session,
gchar *src = NULL, *psrc;
gsize remain;
gint32 revision, our_rev;
- guint32 len, cnt = 0;
+ guint32 len = 0, cnt = 0;
struct fuzzy_peer_cmd cmd, *pcmd;
enum {
read_len = 0,
diff --git a/src/libmime/archives.c b/src/libmime/archives.c
index 2a38a3641..5fdf8e47a 100644
--- a/src/libmime/archives.c
+++ b/src/libmime/archives.c
@@ -252,7 +252,7 @@ rspamd_archive_process_rar_v4 (struct rspamd_task *task, const guchar *start,
const guchar *p = start, *start_section;
guint8 type;
guint flags;
- guint64 sz, comp_sz, uncomp_sz;
+ guint64 sz, comp_sz = 0, uncomp_sz = 0;
struct rspamd_archive *arch;
struct rspamd_archive_file *f;
diff --git a/src/libserver/cfg_rcl.c b/src/libserver/cfg_rcl.c
index 849ec92c0..b4201fdd9 100644
--- a/src/libserver/cfg_rcl.c
+++ b/src/libserver/cfg_rcl.c
@@ -1576,7 +1576,7 @@ rspamd_rcl_add_default_handler (struct rspamd_rcl_section *section,
struct rspamd_rcl_section *
rspamd_rcl_config_init (struct rspamd_config *cfg)
{
- struct rspamd_rcl_section *new = NULL, *sub, *ssub, *sssub;
+ struct rspamd_rcl_section *new = NULL, *sub, *ssub;
/*
* Important notice:
@@ -2089,7 +2089,7 @@ rspamd_rcl_config_init (struct rspamd_config *cfg)
"Maximum score that could be reached by this symbols group");
/* Grouped symbols */
- sssub = rspamd_rcl_add_section_doc (&ssub->subsections,
+ rspamd_rcl_add_section_doc (&ssub->subsections,
"symbol", "name",
rspamd_rcl_symbol_handler,
UCL_OBJECT,
diff --git a/src/libserver/fuzzy_backend.c b/src/libserver/fuzzy_backend.c
index 6f312818a..7023ab575 100644
--- a/src/libserver/fuzzy_backend.c
+++ b/src/libserver/fuzzy_backend.c
@@ -803,7 +803,6 @@ rspamd_fuzzy_backend_del (struct rspamd_fuzzy_backend *backend,
const struct rspamd_fuzzy_cmd *cmd)
{
int rc = -1;
- guint32 flag;
if (backend == NULL) {
return FALSE;
@@ -814,10 +813,6 @@ rspamd_fuzzy_backend_del (struct rspamd_fuzzy_backend *backend,
cmd->digest);
if (rc == SQLITE_OK) {
- /* Check flag */
- flag = sqlite3_column_int64 (
- prepared_stmts[RSPAMD_FUZZY_BACKEND_CHECK].stmt,
- 2);
rspamd_fuzzy_backend_cleanup_stmt (backend, RSPAMD_FUZZY_BACKEND_CHECK);
rc = rspamd_fuzzy_backend_run_stmt (backend, TRUE,
diff --git a/src/libserver/html.c b/src/libserver/html.c
index 3d63817df..33ee10d83 100644
--- a/src/libserver/html.c
+++ b/src/libserver/html.c
@@ -1128,7 +1128,6 @@ rspamd_html_process_url (rspamd_mempool_t *pool, const gchar *start, guint len,
gchar *decoded;
gint rc;
gsize decoded_len;
- gboolean has_spaces = FALSE;
const gchar *p;
gchar *t, *h;
@@ -1140,7 +1139,6 @@ rspamd_html_process_url (rspamd_mempool_t *pool, const gchar *start, guint len,
p ++;
start ++;
len --;
- has_spaces = TRUE;
}
if (comp) {
@@ -1158,7 +1156,6 @@ rspamd_html_process_url (rspamd_mempool_t *pool, const gchar *start, guint len,
if (comp) {
comp->len --;
}
- has_spaces = TRUE;
}
/* Also we need to perform url decode */
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);
diff --git a/src/lua/lua_common.c b/src/lua/lua_common.c
index 371567695..310db5fa9 100644
--- a/src/lua/lua_common.c
+++ b/src/lua/lua_common.c
@@ -479,7 +479,7 @@ rspamd_lua_parse_table_arguments (lua_State *L, gint pos,
read_semicolon
} state = read_key;
gsize keylen = 0, *valuelen, clslen;
- gint idx, t;
+ gint idx = 0, t;
g_assert (extraction_pattern != NULL);