]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Fix couple of warnings and disable -pedantic mode
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 5 Jul 2016 11:57:58 +0000 (12:57 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 5 Jul 2016 11:57:58 +0000 (12:57 +0100)
12 files changed:
CMakeLists.txt
src/controller.c
src/fuzzy_storage.c
src/libmime/archives.c
src/libserver/cfg_rcl.c
src/libserver/fuzzy_backend.c
src/libserver/html.c
src/libutil/heap.c
src/libutil/map.c
src/libutil/multipattern.c
src/libutil/shingles.c
src/lua/lua_common.c

index 40b4907a6090c321ee982bfc6f012412df0c41c3..608f5d5df43f435e6aee8ceeae90a8d04a653ec9 100644 (file)
@@ -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()
index b45e5add5cb17a984b499a88d818b45280915ef3..13835ae7740cd327b6fd1df83dca19903490dc0b 100644 (file)
@@ -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);
index 7f3dd4020686dfc9ea894fa2c44c6ce839ad3201..1501da58e08f6bd3376bce7f148f7b3e517ff7d0 100644 (file)
@@ -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,
index 2a38a3641e22db560c1a15629675f50e07fed97d..5fdf8e47a02888408651319452f0d763f86d1835 100644 (file)
@@ -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;
 
index 849ec92c0287898e3f273fe72ad8efac98b6a898..b4201fdd9c752991f5dc4341c11de3688cdc36de 100644 (file)
@@ -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,
index 6f312818af884efa747e8b6af261e0451517f43b..7023ab575c8e279e51a2340837892f7d31e28d00 100644 (file)
@@ -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,
index 3d63817dfba1332e980a17964116cf2326a5a677..33ee10d8306066bf0e218aab687520fd1ee152de 100644 (file)
@@ -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 */
index f5084e4b08781cf9323cde62d92aa896bf4b7011..ae8e14131e353e6c7fe547980b3f7bf411537708 100644 (file)
@@ -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);
 }
index 354ac722ec736c6c75c1a6f96c886628795ca1a2..0c8e6b925a7479efeebbc81daf650d456e43b812 100644 (file)
@@ -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));
                                }
                        }
                }
index 9f5bdb4cc9c4369c8c461d58ed236d74095daf1f..c4085e31580fe9474ddb001e31f127189d67b248 100644 (file)
@@ -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;
index 66f6b457cf2b7ece2da55248bd858e7203c3183c..0f35a07e094de879d91c1e82f276b66568bce7de 100644 (file)
@@ -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);
index 3715676956a9581512fc9170cce594db3caa2165..310db5fa9900d0e10a6da249ba36f2ded59b9662 100644 (file)
@@ -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);