@@ -762,9 +762,9 @@ ENDIF(SUPPORT_WPOINTER_SIGN) | |||
IF(SUPPORT_WSTRICT_PROTOTYPES) | |||
SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -Wstrict-prototypes") | |||
ENDIF(SUPPORT_WSTRICT_PROTOTYPES) | |||
IF(SUPPORT_PEDANTIC_FLAG) | |||
SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -pedantic") | |||
ENDIF(SUPPORT_PEDANTIC_FLAG) | |||
#IF(SUPPORT_PEDANTIC_FLAG) | |||
# SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -pedantic") | |||
#ENDIF(SUPPORT_PEDANTIC_FLAG) | |||
IF(SUPPORT_WNULL_DEREFERENCE) | |||
SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -Wnull-dereference") | |||
ENDIF() |
@@ -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); |
@@ -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, |
@@ -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; | |||
@@ -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, |
@@ -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, |
@@ -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 */ |
@@ -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); | |||
} |
@@ -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)); | |||
} | |||
} | |||
} |
@@ -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; |
@@ -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); |
@@ -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); | |||