aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2023-02-11 12:29:10 +0000
committerVsevolod Stakhov <vsevolod@rspamd.com>2023-02-11 12:29:10 +0000
commit41a93a39b05c8fc046299c2ac6baec7d91cb2947 (patch)
tree9594cd73304f3744a96e60bc4c6c8715319a1078 /src
parent5c9e9f60b38a0b630d03b35efe1eadf675d2e232 (diff)
downloadrspamd-41a93a39b05c8fc046299c2ac6baec7d91cb2947.tar.gz
rspamd-41a93a39b05c8fc046299c2ac6baec7d91cb2947.zip
[Minor] Fix some warnings
Diffstat (limited to 'src')
-rw-r--r--src/libserver/cfg_file.h2
-rw-r--r--src/libserver/cfg_utils.c12
-rw-r--r--src/libserver/hyperscan_tools.cxx4
3 files changed, 7 insertions, 11 deletions
diff --git a/src/libserver/cfg_file.h b/src/libserver/cfg_file.h
index 18524af8d..44502ebb7 100644
--- a/src/libserver/cfg_file.h
+++ b/src/libserver/cfg_file.h
@@ -557,7 +557,7 @@ const ucl_object_t *rspamd_config_get_module_opt (struct rspamd_config *cfg,
* @param str string representation of flag (eg. 'on')
* @return numeric value of flag (0 or 1)
*/
-gchar rspamd_config_parse_flag (const gchar *str, guint len);
+gint rspamd_config_parse_flag (const gchar *str, guint len);
enum rspamd_post_load_options {
RSPAMD_CONFIG_INIT_URL = 1 << 0,
diff --git a/src/libserver/cfg_utils.c b/src/libserver/cfg_utils.c
index 1820f97cd..09e2ab158 100644
--- a/src/libserver/cfg_utils.c
+++ b/src/libserver/cfg_utils.c
@@ -385,10 +385,10 @@ rspamd_config_get_module_opt (struct rspamd_config *cfg,
return res;
}
-gchar
+gint
rspamd_config_parse_flag (const gchar *str, guint len)
{
- gchar c;
+ gint c;
if (!str || !*str) {
return -1;
@@ -1795,9 +1795,7 @@ rspamd_config_is_enabled_from_ucl (rspamd_mempool_t *pool,
return ucl_object_toboolean(enabled);
}
else if (ucl_object_type(enabled) == UCL_STRING) {
- gchar ret;
-
- ret = rspamd_config_parse_flag(ucl_object_tostring(enabled), 0);
+ gint ret = rspamd_config_parse_flag(ucl_object_tostring(enabled), 0);
if (ret == 0) {
return FALSE;
@@ -1822,9 +1820,7 @@ rspamd_config_is_enabled_from_ucl (rspamd_mempool_t *pool,
return !ucl_object_toboolean(disabled);
}
else if (ucl_object_type(disabled) == UCL_STRING) {
- gchar ret;
-
- ret = rspamd_config_parse_flag(ucl_object_tostring(disabled), 0);
+ gint ret = rspamd_config_parse_flag(ucl_object_tostring(disabled), 0);
if (ret == 0) {
return TRUE;
diff --git a/src/libserver/hyperscan_tools.cxx b/src/libserver/hyperscan_tools.cxx
index d30f11a14..cb2e15c9a 100644
--- a/src/libserver/hyperscan_tools.cxx
+++ b/src/libserver/hyperscan_tools.cxx
@@ -331,8 +331,8 @@ auto load_cached_hs_file(const char *fname, std::int64_t offset = 0) -> tl::expe
if (page_size == -1) {
page_size = 4096;
}
- posix_memalign(&buf, page_size, unserialized_size);
- if (buf == nullptr) {
+ auto errcode = posix_memalign(&buf, page_size, unserialized_size);
+ if (errcode != 0 || buf == nullptr) {
return tl::make_unexpected(error {"Cannot allocate memory", errno, error_category::CRITICAL });
}