]> source.dussan.org Git - rspamd.git/commitdiff
Fix warnings.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 15 Jan 2016 15:54:43 +0000 (15:54 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 15 Jan 2016 15:54:43 +0000 (15:54 +0000)
16 files changed:
contrib/librdns/logger.h
contrib/xxhash/xxhash.c
src/fuzzy_storage.c
src/libcryptobox/siphash/siphash.c
src/libmime/mime_expressions.c
src/libserver/cfg_rcl.c
src/libserver/fuzzy_backend.c
src/libserver/html.c
src/libserver/re_cache.c
src/libserver/rspamd_control.c
src/libserver/spf.c
src/lua/lua_util.c
src/lua/lua_xmlrpc.c
src/plugins/surbl.c
src/rspamadm/confighelp.c
src/rspamd.c

index 91108f4e32514bd4eebcc04c636ecbad86a794a5..f9c33bbe4c9cce0f94b6e2d264bf4e635410992f 100644 (file)
@@ -34,9 +34,9 @@ void rdns_logger_helper (struct rdns_resolver *resolver,
                enum rdns_log_level level,
                const char *function, const char *format, ...);
 
-#define rdns_err(...) do { rdns_logger_helper (resolver, RDNS_LOG_ERROR, __FUNCTION__, __VA_ARGS__); } while (0)
-#define rdns_warn(...) do { rdns_logger_helper (resolver, RDNS_LOG_WARNING, __FUNCTION__, __VA_ARGS__); } while (0)
-#define rdns_info(...) do { rdns_logger_helper (resolver, RDNS_LOG_INFO, __FUNCTION__, __VA_ARGS__); } while (0)
-#define rdns_debug(...) do { rdns_logger_helper (resolver, RDNS_LOG_DEBUG, __FUNCTION__, __VA_ARGS__); } while (0)
+#define rdns_err(...) do { rdns_logger_helper (resolver, RDNS_LOG_ERROR, __func__, __VA_ARGS__); } while (0)
+#define rdns_warn(...) do { rdns_logger_helper (resolver, RDNS_LOG_WARNING, __func__, __VA_ARGS__); } while (0)
+#define rdns_info(...) do { rdns_logger_helper (resolver, RDNS_LOG_INFO, __func__, __VA_ARGS__); } while (0)
+#define rdns_debug(...) do { rdns_logger_helper (resolver, RDNS_LOG_DEBUG, __func__, __VA_ARGS__); } while (0)
 
 #endif /* LOGGER_H_ */
index 4e3e2d03fd7b4a23126db23830864481c854375c..db72061dcdfd3145ac982c7272ab922a5b37ccfa 100644 (file)
@@ -544,7 +544,7 @@ XXH_errorcode XXH32_freeState(XXH32_state_t* statePtr)
 {
     XXH_free(statePtr);
     return XXH_OK;
-};
+}
 
 XXH64_state_t* XXH64_createState(void)
 {
@@ -555,7 +555,7 @@ XXH_errorcode XXH64_freeState(XXH64_state_t* statePtr)
 {
     XXH_free(statePtr);
     return XXH_OK;
-};
+}
 
 
 /*** Hash feed ***/
index 8022703837faeedfa39aac8fa56670b511fdde7b..d204a7c2a5cf54c4c9bbb6bd24e847d37f34686a 100644 (file)
@@ -864,7 +864,6 @@ rspamd_fuzzy_stat_to_ucl (struct rspamd_fuzzy_storage_ctx *ctx, gboolean ip_stat
        GHashTable *ip_hash;
        struct fuzzy_key_stat *key_stat;
        struct fuzzy_key *key;
-       struct rspamd_http_keypair *kp;
        rspamd_lru_element_t *lru_elt;
        ucl_object_t *obj, *keys_obj, *elt, *ip_elt, *ip_cur;
        gpointer k, v;
@@ -878,7 +877,6 @@ rspamd_fuzzy_stat_to_ucl (struct rspamd_fuzzy_storage_ctx *ctx, gboolean ip_stat
 
        while (g_hash_table_iter_next (&it, &k, &v)) {
                key = v;
-               kp = key->key;
                key_stat = key->stat;
 
                if (key_stat) {
index badb6fece56bc52d0ee10c2073cc32fc7c6f1a9d..32907292a4de49a5f20ba57e885eda7ea91f14ef 100644 (file)
@@ -27,7 +27,7 @@
 #include "platform_config.h"
 
 extern unsigned long cpu_config;
-static const int test_iters = 1000;
+static const size_t test_iters = 1000;
 
 typedef struct siphash_impl_t
 {
index be9912463d040921289ff144296d06f29ddec957..ad550f3bfed443f56fdb8e809724204d996e7e98 100644 (file)
@@ -1560,7 +1560,7 @@ rspamd_content_type_compare_param (struct rspamd_task * task,
        GMimeContentType *ct;
        gint r;
        guint i;
-       gboolean recursive = FALSE, result = FALSE;
+       gboolean recursive = FALSE;
        struct mime_part *cur_part;
 
        if (args == NULL || args->len < 2) {
@@ -1600,14 +1600,15 @@ rspamd_content_type_compare_param (struct rspamd_task * task,
 
                if ((param_data =
                                g_mime_content_type_get_parameter ((GMimeContentType *)ct,
-                                               param_name)) == NULL) {
-                       result = FALSE;
-               }
-               else {
+                                               param_name)) != NULL) {
                        if (arg_pattern->type == EXPRESSION_ARGUMENT_REGEXP) {
                                re = arg_pattern->data;
                                r = rspamd_regexp_search (re, param_data, 0,
                                                        NULL, NULL, FALSE, NULL);
+
+                               if (r) {
+                                       return TRUE;
+                               }
                        }
                        else {
                                /* Just do strcasecmp */
@@ -1745,6 +1746,10 @@ rspamd_content_type_check (struct rspamd_task *task,
                        re = arg_pattern->data;
                        r = rspamd_regexp_search (re, param_data, 0,
                                        NULL, NULL, FALSE, NULL);
+
+                       if (r) {
+                               return TRUE;
+                       }
                }
                else {
                        /* Just do strcasecmp */
index 27ccb57bc137bd99e3e9d01d0fafe3b458290bda..aafbf54279901854ee5694bd871b7f57c36ce556 100644 (file)
@@ -627,7 +627,7 @@ rspamd_rcl_worker_handler (rspamd_mempool_t *pool, const ucl_object_t *obj,
                                                return FALSE;
                                        }
 
-                                       if (!whandler->parser.flags & RSPAMD_CL_FLAG_MULTIPLE) {
+                                       if (!(whandler->parser.flags & RSPAMD_CL_FLAG_MULTIPLE)) {
                                                break;
                                        }
                                }
@@ -1230,7 +1230,7 @@ rspamd_rcl_add_section (struct rspamd_rcl_section **top,
        }
        else {
                parent_doc = (*top)->doc_ref;
-               new->doc_ref = new->doc_ref = rspamd_rcl_add_doc_obj (parent_doc,
+               new->doc_ref = rspamd_rcl_add_doc_obj (parent_doc,
                                NULL,
                                name,
                                type,
@@ -2176,7 +2176,7 @@ rspamd_rcl_section_parse_defaults (struct rspamd_rcl_section *section,
                                        return FALSE;
                                }
 
-                               if (!cur->pd.flags & RSPAMD_CL_FLAG_MULTIPLE) {
+                               if (!(cur->pd.flags & RSPAMD_CL_FLAG_MULTIPLE)) {
                                        break;
                                }
                        }
index b52dae95a617f765f250f05e3e091fb206c81ab2..3f0bed46512648fdde86a5ea850457a6fa220c26 100644 (file)
@@ -280,7 +280,7 @@ rspamd_fuzzy_backend_run_stmt (struct rspamd_fuzzy_backend *backend,
        }
 
        stmt = prepared_stmts[idx].stmt;
-       g_assert (prepared_stmts[idx].idx == idx);
+       g_assert ((int)prepared_stmts[idx].idx == idx);
 
        if (stmt == NULL) {
                if ((retcode = sqlite3_prepare_v2 (backend->db, prepared_stmts[idx].sql, -1,
@@ -472,7 +472,6 @@ rspamd_fuzzy_backend_check (struct rspamd_fuzzy_backend *backend,
        gint64 timestamp;
        gint64 shingle_values[RSPAMD_SHINGLE_SIZE], i, sel_id, cur_id,
                cur_cnt, max_cnt;
-       const char *digest;
 
        if (backend == NULL) {
                return rep;
@@ -566,9 +565,6 @@ rspamd_fuzzy_backend_check (struct rspamd_fuzzy_backend *backend,
                                rc = rspamd_fuzzy_backend_run_stmt (backend, FALSE,
                                                RSPAMD_FUZZY_BACKEND_GET_DIGEST_BY_ID, sel_id);
                                if (rc == SQLITE_OK) {
-                                       digest = sqlite3_column_text (
-                                                       prepared_stmts[RSPAMD_FUZZY_BACKEND_GET_DIGEST_BY_ID].stmt,
-                                                       0);
                                        timestamp = sqlite3_column_int64 (
                                                        prepared_stmts[RSPAMD_FUZZY_BACKEND_GET_DIGEST_BY_ID].stmt,
                                                        2);
index 5c55d6f30f7f7c6fdb3f909ae9de4ae5a1619bf7..77de30e8c2c00b5022a59c7b81551d65873995f9 100644 (file)
@@ -1661,7 +1661,7 @@ GByteArray*
 rspamd_html_process_part_full (rspamd_mempool_t *pool, struct html_content *hc,
                GByteArray *in, GList **exceptions, GHashTable *urls,  GHashTable *emails)
 {
-       const guchar *p, *c, *end, *tag_start = NULL, *savep = NULL;
+       const guchar *p, *c, *end, *savep = NULL;
        guchar t;
        gboolean closing = FALSE, need_decode = FALSE, save_space = FALSE,
                        balanced, url_text;
@@ -1735,7 +1735,6 @@ rspamd_html_process_part_full (rspamd_mempool_t *pool, struct html_content *hc,
                        switch (t) {
                        case '<':
                                p ++;
-                               tag_start = p;
                                closing = FALSE;
                                break;
                        case '!':
@@ -1750,14 +1749,12 @@ rspamd_html_process_part_full (rspamd_mempool_t *pool, struct html_content *hc,
                        case '/':
                                closing = TRUE;
                                p ++;
-                               tag_start = p;
                                break;
                        case '>':
                                /* Empty tag */
                                hc->flags |= RSPAMD_HTML_FLAG_BAD_ELEMENTS;
                                state = tag_end;
                                p ++;
-                               tag_start = NULL;
                                break;
                        default:
                                state = tag_content;
@@ -1786,7 +1783,6 @@ rspamd_html_process_part_full (rspamd_mempool_t *pool, struct html_content *hc,
                                break;
                        default:
                                state = sgml_content;
-                               tag_start = p;
                                break;
                        }
 
@@ -1959,7 +1955,6 @@ rspamd_html_process_part_full (rspamd_mempool_t *pool, struct html_content *hc,
                        break;
 
                case tag_end:
-                       tag_start = NULL;
                        substate = 0;
                        savep = NULL;
 
index 94bed145dd12bfeae4e7c55357d069847c65a4ae..4434576c819efc8f135bb191041322d38e67b59c 100644 (file)
@@ -539,14 +539,11 @@ rspamd_re_cache_process_regexp_data (struct rspamd_re_runtime *rt,
                const guchar *in, gsize len,
                gboolean is_raw)
 {
-       struct rspamd_re_cache_elt *elt;
-       struct rspamd_re_class *re_class;
+
        guint64 re_id;
        guint ret = 0;
 
        re_id = rspamd_regexp_get_cache_id (re);
-       elt = g_ptr_array_index (rt->cache->re, re_id);
-       re_class = rspamd_regexp_get_class (re);
 
        if (len == 0 || in == NULL) {
                /* We assume this as absence of the specified data */
@@ -560,8 +557,13 @@ rspamd_re_cache_process_regexp_data (struct rspamd_re_runtime *rt,
        setbit (rt->checked, re_id);
        rt->results[re_id] = ret;
 #else
+       struct rspamd_re_cache_elt *elt;
+       struct rspamd_re_class *re_class;
        struct rspamd_re_hyperscan_cbdata cbdata;
 
+       elt = g_ptr_array_index (rt->cache->re, re_id);
+       re_class = rspamd_regexp_get_class (re);
+
        if (rt->cache->disable_hyperscan || elt->match_type == RSPAMD_RE_CACHE_PCRE) {
                ret = rspamd_re_cache_process_pcre (rt, re, in, len, is_raw);
                setbit (rt->checked, re_id);
index e274f100b26749a7c011f570dba1b79438d9ec39..6696cd183dafe6ac06e7ae2e3dfdabcfa00c88e5 100644 (file)
@@ -804,7 +804,6 @@ rspamd_srv_request_handler (gint fd, short what, gpointer ud)
        struct rspamd_srv_request_data *rd = ud;
        struct msghdr msg;
        struct iovec iov;
-       struct cmsghdr *cmsg;
        guchar fdspace[CMSG_SPACE(sizeof (int))];
        gssize r;
        gint rfd = -1;
@@ -846,8 +845,6 @@ rspamd_srv_request_handler (gint fd, short what, gpointer ud)
                }
 
                if (msg.msg_controllen >= CMSG_SPACE(sizeof (int))) {
-                       cmsg = CMSG_FIRSTHDR (&msg);
-
                        rfd = *(int *) CMSG_DATA(CMSG_FIRSTHDR (&msg));
                }
 
index e8394ec74a912362ed4aec1a2e101c3b85c58669..31dba5d89a65d8887e724d878548ee44884f5b95 100644 (file)
@@ -429,7 +429,7 @@ spf_record_process_addr (struct spf_record *rec, struct spf_addr *addr, struct
 {
        struct spf_addr *naddr;
 
-       if (!addr->flags & RSPAMD_SPF_FLAG_PROCESSED) {
+       if (!(addr->flags & RSPAMD_SPF_FLAG_PROCESSED)) {
                /* That's the first address */
                if (reply->type == RDNS_REQUEST_AAAA) {
                        memcpy (addr->addr6,
index a5d3a0f87a74c6d528a8df1e6716f34c39bc97aa..eda1ede2bd06aaa0a7be899555fc17bfcbc76f57 100644 (file)
@@ -436,7 +436,7 @@ lua_util_tokenize_text (lua_State *L)
        struct process_exception *ex;
        GArray *res;
        rspamd_ftok_t *w;
-       gboolean compat = FALSE, check_sig = FALSE;
+       gboolean compat = FALSE;
 
        if (lua_type (L, 1) == LUA_TSTRING) {
                in = luaL_checklstring (L, 1, &len);
@@ -485,10 +485,6 @@ lua_util_tokenize_text (lua_State *L)
                compat = lua_toboolean (L, 3);
        }
 
-       if (lua_gettop (L) > 3 && lua_type (L, 4) == LUA_TBOOLEAN) {
-               check_sig = lua_toboolean (L, 4);
-       }
-
        if (exceptions) {
                exceptions = g_list_reverse (exceptions);
        }
index 64587aae694b0fc32aa13220a55c0776a5162736..2d431ce33eed4477d962e48ac2ccdd2ea0056b0e 100644 (file)
@@ -414,8 +414,6 @@ xmlrpc_text (GMarkupParseContext *context,
 static void
 xmlrpc_error (GMarkupParseContext *context, GError *error, gpointer user_data)
 {
-       struct lua_xmlrpc_ud *ud = user_data;
-
        msg_err ("xmlrpc parser error: %s", error->message);
 }
 
index 480c40d4eecb9a096123d64755d7e1f23a1281f6..2923b2d4532804af13995a7f189b276724c01691 100644 (file)
@@ -491,7 +491,6 @@ surbl_module_config (struct rspamd_config *cfg)
        const gchar *redir_val, *ip_val;
        guint32 bit;
        gint cb_id, nrules = 0;
-       gboolean has_subsymbols;
 
        if (!rspamd_config_is_module_enabled (cfg, "surbl")) {
                return TRUE;
@@ -672,7 +671,6 @@ surbl_module_config (struct rspamd_config *cfg)
                                        -1);
                        nrules++;
                        new_suffix->callback_id = cb_id;
-                       has_subsymbols = FALSE;
 
                        cur = ucl_obj_get_key (cur_rule, "bits");
                        if (cur != NULL && cur->type == UCL_OBJECT) {
@@ -701,7 +699,6 @@ surbl_module_config (struct rspamd_config *cfg)
                                                msg_debug_config ("add new bit suffix: %d with symbol: %s",
                                                        (gint)new_bit->bit, new_bit->symbol);
                                                g_array_append_val (new_suffix->bits, *new_bit);
-                                               has_subsymbols = TRUE;
                                        }
                                }
                        }
@@ -746,7 +743,6 @@ surbl_module_config (struct rspamd_config *cfg)
                                                                (gint)new_bit->bit, new_bit->symbol);
                                                g_hash_table_insert (new_suffix->ips, &new_bit->bit,
                                                                new_bit);
-                                               has_subsymbols = TRUE;
                                        }
                                }
                        }
index 3b90a4700d6cbc81d23a63d7d9db926853cabc9d..43128f11cba83f4def2759f1df1705c6200f7bf2 100644 (file)
@@ -195,7 +195,6 @@ rspamadm_confighelp_search_word (const ucl_object_t *obj, const gchar *str)
 static void
 rspamadm_confighelp (gint argc, gchar **argv)
 {
-       struct rspamd_rcl_section *top;
        struct rspamd_config *cfg;
        ucl_object_t *doc_obj;
        const ucl_object_t *elt;
@@ -233,7 +232,7 @@ rspamadm_confighelp (gint argc, gchar **argv)
        cfg->compiled_modules = modules;
        cfg->compiled_workers = workers;
 
-       top = rspamd_rcl_config_init (cfg);
+       rspamd_rcl_config_init (cfg);
 
        /* Init modules to get documentation strings */
        for (pmod = cfg->compiled_modules; pmod != NULL && *pmod != NULL; pmod++) {
index 3137bb3d75eb9a1da0e3f7044d8c4a49ab2f26b3..a71b58810fe58e58a929d2c5a1b41495e52e21e9 100644 (file)
@@ -568,6 +568,7 @@ spawn_workers (struct rspamd_main *rspamd_main, struct event_base *ev_base)
                spawn_worker_type (rspamd_main, ev_base, cf);
        }
 #endif
+       (void)seen_hs_helper; /* Silence warning */
 }
 
 static void