From: Vsevolod Stakhov Date: Fri, 16 Jul 2021 15:14:43 +0000 (+0100) Subject: [Minor] Fix some calcs X-Git-Tag: 3.0~142 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=cf8665ebe3f5a2acdc740076a70cd8df6f73d8f3;p=rspamd.git [Minor] Fix some calcs --- diff --git a/src/libserver/composites/composites.cxx b/src/libserver/composites/composites.cxx index b03edaf71..99a2038c3 100644 --- a/src/libserver/composites/composites.cxx +++ b/src/libserver/composites/composites.cxx @@ -88,7 +88,8 @@ struct composites_data { explicit composites_data(struct rspamd_task *task, struct rspamd_scan_result *mres) : task(task), composite(nullptr), metric_res(mres) { - checked.resize(rspamd_composites_manager_nelts(task->cfg->composites_manager) * 2); + checked.resize(rspamd_composites_manager_nelts(task->cfg->composites_manager) * 2, + false); } }; diff --git a/src/libserver/composites/composites_internal.hxx b/src/libserver/composites/composites_internal.hxx index 12fa3ecb2..c38f3d377 100644 --- a/src/libserver/composites/composites_internal.hxx +++ b/src/libserver/composites/composites_internal.hxx @@ -57,7 +57,7 @@ public: } auto size(void) const -> std::size_t { - return composites.size(); + return all_composites.size(); } auto find(std::string_view name) const -> const rspamd_composite * { diff --git a/src/libserver/composites/composites_manager.cxx b/src/libserver/composites/composites_manager.cxx index c2e719c89..cf91d1136 100644 --- a/src/libserver/composites/composites_manager.cxx +++ b/src/libserver/composites/composites_manager.cxx @@ -87,7 +87,7 @@ composites_manager::add_composite(std::string_view composite_name, const ucl_obj auto &composite = all_composites.emplace_back(std::make_shared()); composite->expr = expr; - composite->id = all_composites.size(); + composite->id = all_composites.size() - 1; composite->str_expr = composite_expression; composite->sym = composite_name;