]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Fix some warnings
authorVsevolod Stakhov <vsevolod@rspamd.com>
Sat, 11 Feb 2023 12:29:10 +0000 (12:29 +0000)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Sat, 11 Feb 2023 12:29:10 +0000 (12:29 +0000)
src/libserver/cfg_file.h
src/libserver/cfg_utils.c
src/libserver/hyperscan_tools.cxx

index 18524af8dda6b3ebf450ff31c52b3f8533356b19..44502ebb78665694fb455857c5746ec373080c65 100644 (file)
@@ -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,
index 1820f97cdeea38dc68dfc5f84e0435e9c0b0f443..09e2ab1588b50ac14da05aa1963b76d41f98557e 100644 (file)
@@ -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;
index d30f11a147b73311d04fbf032d0526080e37291f..cb2e15c9a5fcfdaaf868cc3fe478e454ae89a974 100644 (file)
@@ -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 });
                                                }