From: Vsevolod Stakhov Date: Tue, 5 Sep 2023 14:01:18 +0000 (+0100) Subject: [Minor] Learn to cycle back on unsigned X-Git-Tag: 3.7.1~56 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=509dad33dddfda31c889dfa4849f3053e24c4c1e;p=rspamd.git [Minor] Learn to cycle back on unsigned --- diff --git a/src/libserver/rspamd_symcache.h b/src/libserver/rspamd_symcache.h index 45e460c11..2c67cba0d 100644 --- a/src/libserver/rspamd_symcache.h +++ b/src/libserver/rspamd_symcache.h @@ -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) diff --git a/src/libserver/symcache/symcache_c.cxx b/src/libserver/symcache/symcache_c.cxx index 06801d244..6a7e41cc9 100644 --- a/src/libserver/symcache/symcache_c.cxx +++ b/src/libserver/symcache/symcache_c.cxx @@ -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); diff --git a/src/libserver/symcache/symcache_runtime.cxx b/src/libserver/symcache/symcache_runtime.cxx index b4da5a888..d9622d8a2 100644 --- a/src/libserver/symcache/symcache_runtime.cxx +++ b/src/libserver/symcache/symcache_runtime.cxx @@ -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::min(); auto all_done = true; diff --git a/src/libserver/symcache/symcache_runtime.hxx b/src/libserver/symcache/symcache_runtime.hxx index 91fe1c783..aa8f66c0f 100644 --- a/src/libserver/symcache/symcache_runtime.hxx +++ b/src/libserver/symcache/symcache_runtime.hxx @@ -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 diff --git a/src/libserver/task.c b/src/libserver/task.c index 937dd8b05..9763d1eb4 100644 --- a/src/libserver/task.c +++ b/src/libserver/task.c @@ -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];