]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Learn to cycle back on unsigned
authorVsevolod Stakhov <vsevolod@rspamd.com>
Tue, 5 Sep 2023 14:01:18 +0000 (15:01 +0100)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Tue, 5 Sep 2023 14:01:18 +0000 (15:01 +0100)
src/libserver/rspamd_symcache.h
src/libserver/symcache/symcache_c.cxx
src/libserver/symcache/symcache_runtime.cxx
src/libserver/symcache/symcache_runtime.hxx
src/libserver/task.c

index 45e460c11efb3158260f17220b34b96962a3d67e..2c67cba0df1cba0cee7be438ecd9e896e3c35877 100644 (file)
@@ -209,7 +209,7 @@ gboolean rspamd_symcache_validate(struct rspamd_symcache *cache,
  */
 gboolean rspamd_symcache_process_symbols(struct rspamd_task *task,
                                                                                 struct rspamd_symcache *cache,
-                                                                                gint stage);
+                                                                                guint stage);
 
 /**
  * Return statistics about the cache as ucl object (array of objects one per item)
index 06801d24417bb1bd337ca712e52d82a687294227..6a7e41cc9c27d2b2e1dade881d2ee09077ac74e3 100644 (file)
@@ -687,7 +687,7 @@ void rspamd_symcache_composites_foreach(struct rspamd_task *task,
 gboolean
 rspamd_symcache_process_symbols(struct rspamd_task *task,
                                                                struct rspamd_symcache *cache,
-                                                               gint stage)
+                                                               guint stage)
 {
        auto *real_cache = C_API_SYMCACHE(cache);
 
index b4da5a8881fcdb7e9876c404c44e737b303c8211..d9622d8a26b6cc53d1cfd739559e298fe429b5bf 100644 (file)
@@ -1,11 +1,11 @@
-/*-
- * Copyright 2022 Vsevolod Stakhov
+/*
+ * Copyright 2023 Vsevolod Stakhov
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
- *   http://www.apache.org/licenses/LICENSE-2.0
+ *    http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -279,7 +279,7 @@ auto symcache_runtime::get_dynamic_item(int id) const -> cache_dynamic_item *
        return nullptr;
 }
 
-auto symcache_runtime::process_symbols(struct rspamd_task *task, symcache &cache, int stage) -> bool
+auto symcache_runtime::process_symbols(struct rspamd_task *task, symcache &cache, unsigned int stage) -> bool
 {
        msg_debug_cache_task("symbols processing stage at pass: %d", stage);
 
@@ -308,7 +308,7 @@ auto symcache_runtime::process_symbols(struct rspamd_task *task, symcache &cache
 auto symcache_runtime::process_pre_postfilters(struct rspamd_task *task,
                                                                                           symcache &cache,
                                                                                           int start_events,
-                                                                                          int stage) -> bool
+                                                                                          unsigned int stage) -> bool
 {
        auto saved_priority = std::numeric_limits<int>::min();
        auto all_done = true;
index 91fe1c7837db39ffd301205db346f3d780402c2b..aa8f66c0f21eef27a7a6742893bb82611d4b9446 100644 (file)
@@ -1,11 +1,11 @@
-/*-
- * Copyright 2022 Vsevolod Stakhov
+/*
+ * Copyright 2023 Vsevolod Stakhov
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
- *   http://www.apache.org/licenses/LICENSE-2.0
+ *    http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -64,7 +64,7 @@ class symcache_runtime {
        auto process_symbol(struct rspamd_task *task, symcache &cache, cache_item *item,
                                                cache_dynamic_item *dyn_item) -> bool;
        /* Specific stages of the processing */
-       auto process_pre_postfilters(struct rspamd_task *task, symcache &cache, int start_events, int stage) -> bool;
+       auto process_pre_postfilters(struct rspamd_task *task, symcache &cache, int start_events, unsigned int stage) -> bool;
        auto process_filters(struct rspamd_task *task, symcache &cache, int start_events) -> bool;
        auto check_metric_limit(struct rspamd_task *task) -> bool;
        auto check_item_deps(struct rspamd_task *task, symcache &cache, cache_item *item,
@@ -180,7 +180,7 @@ public:
         * @param stage
         * @return
         */
-       auto process_symbols(struct rspamd_task *task, symcache &cache, int stage) -> bool;
+       auto process_symbols(struct rspamd_task *task, symcache &cache, unsigned int stage) -> bool;
 
        /**
         * Finalize execution of some item in the cache
index 937dd8b054a4d9eeca45bce70ac6b8afbc249d4b..9763d1eb4785e51c50d3dc53bf9bcb96d0605a00 100644 (file)
@@ -1662,7 +1662,7 @@ rspamd_task_get_required_score(struct rspamd_task *task, struct rspamd_scan_resu
                }
        }
 
-       for (guint i = m->nactions - 1; i >= 0; i--) {
+       for (guint i = m->nactions; i-- > 0;) {
                struct rspamd_action_config *action_lim = &m->actions_config[i];