aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2024-03-18 14:56:16 +0000
committerVsevolod Stakhov <vsevolod@rspamd.com>2024-03-18 14:56:16 +0000
commit6b2b4167187fee09365271cca182866ecb029af3 (patch)
treea085717bc896b25ff4280eb86abecca0d5c36767 /src/libserver
parent47bcfc8360dfa1754474580e779314b8d6a78da6 (diff)
downloadrspamd-6b2b4167187fee09365271cca182866ecb029af3.tar.gz
rspamd-6b2b4167187fee09365271cca182866ecb029af3.zip
[Rework] Remove some of the GLib types in lieu of standard ones
This types have constant conflicts with the system ones especially on OSX.
Diffstat (limited to 'src/libserver')
-rw-r--r--src/libserver/async_session.c2
-rw-r--r--src/libserver/cfg_file.h44
-rw-r--r--src/libserver/cfg_rcl.cxx16
-rw-r--r--src/libserver/cfg_utils.cxx12
-rw-r--r--src/libserver/dkim.c10
-rw-r--r--src/libserver/dns.c4
-rw-r--r--src/libserver/fuzzy_backend/fuzzy_backend.c4
-rw-r--r--src/libserver/fuzzy_backend/fuzzy_backend.h4
-rw-r--r--src/libserver/fuzzy_backend/fuzzy_backend_redis.c4
-rw-r--r--src/libserver/fuzzy_backend/fuzzy_backend_sqlite.c42
-rw-r--r--src/libserver/fuzzy_backend/fuzzy_backend_sqlite.h10
-rw-r--r--src/libserver/fuzzy_wire.h18
-rw-r--r--src/libserver/http/http_context.c4
-rw-r--r--src/libserver/http/http_private.h8
-rw-r--r--src/libserver/http/http_util.c4
-rw-r--r--src/libserver/logger.h4
-rw-r--r--src/libserver/logger/logger.c10
-rw-r--r--src/libserver/logger/logger_file.c12
-rw-r--r--src/libserver/logger/logger_private.h8
-rw-r--r--src/libserver/maps/map_helpers.c2
-rw-r--r--src/libserver/maps/map_private.h10
-rw-r--r--src/libserver/milter.c30
-rw-r--r--src/libserver/monitored.c2
-rw-r--r--src/libserver/protocol.c4
-rw-r--r--src/libserver/protocol.h8
-rw-r--r--src/libserver/re_cache.c30
-rw-r--r--src/libserver/re_cache.h4
-rw-r--r--src/libserver/rspamd_control.h12
-rw-r--r--src/libserver/rspamd_symcache.h22
-rw-r--r--src/libserver/spf.c30
-rw-r--r--src/libserver/spf.h4
-rw-r--r--src/libserver/symcache/symcache_c.cxx10
-rw-r--r--src/libserver/symcache/symcache_impl.cxx4
-rw-r--r--src/libserver/task.h8
-rw-r--r--src/libserver/url.c4
-rw-r--r--src/libserver/worker_util.c28
-rw-r--r--src/libserver/worker_util.h2
37 files changed, 217 insertions, 217 deletions
diff --git a/src/libserver/async_session.c b/src/libserver/async_session.c
index baaee627e..d12f95550 100644
--- a/src/libserver/async_session.c
+++ b/src/libserver/async_session.c
@@ -61,7 +61,7 @@ rspamd_event_equal(const struct rspamd_async_event *ev1, const struct rspamd_asy
return ev1->fin == ev2->fin && ev1->user_data == ev2->user_data;
}
-static inline guint64
+static inline uint64_t
rspamd_event_hash(const struct rspamd_async_event *ev)
{
union _pointer_fp_thunk {
diff --git a/src/libserver/cfg_file.h b/src/libserver/cfg_file.h
index 4cb87d974..3e9feaced 100644
--- a/src/libserver/cfg_file.h
+++ b/src/libserver/cfg_file.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2023 Vsevolod Stakhov
+ * Copyright 2024 Vsevolod Stakhov
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -174,8 +174,8 @@ struct rspamd_classifier_config {
GList *learn_conditions; /**< list of learn condition callbacks */
GList *classify_conditions; /**< list of classify condition callbacks */
gchar *name; /**< unique name of classifier */
- guint32 min_tokens; /**< minimal number of tokens to process classifier */
- guint32 max_tokens; /**< maximum number of tokens */
+ uint32_t min_tokens; /**< minimal number of tokens to process classifier */
+ uint32_t max_tokens; /**< maximum number of tokens */
guint min_token_hits; /**< minimum number of hits for a token to be considered */
gdouble min_prob_strength; /**< use only tokens with probability in [0.5 - MPS, 0.5 + MPS] */
guint min_learns; /**< minimum number of learns for each statfile */
@@ -205,8 +205,8 @@ struct rspamd_worker_conf {
struct rspamd_worker_bind_conf *bind_conf; /**< bind configuration */
gint16 count; /**< number of workers */
GList *listen_socks; /**< listening sockets descriptors */
- guint64 rlimit_nofile; /**< max files limit */
- guint64 rlimit_maxcore; /**< maximum core file size */
+ uint64_t rlimit_nofile; /**< max files limit */
+ uint64_t rlimit_maxcore; /**< maximum core file size */
GHashTable *params; /**< params for worker */
GQueue *active_workers; /**< linked list of spawned workers */
gpointer ctx; /**< worker's context */
@@ -319,7 +319,7 @@ enum rspamd_gtube_patterns_policy {
};
struct rspamd_config_settings_elt {
- guint32 id;
+ uint32_t id;
enum rspamd_config_settings_policy policy;
const gchar *name;
ucl_object_t *symbols_enabled;
@@ -367,16 +367,16 @@ struct rspamd_config {
enum rspamd_gtube_patterns_policy gtube_patterns_policy; /**< Enable test patterns */
gboolean enable_css_parser; /**< Enable css parsing in HTML */
- gsize max_cores_size; /**< maximum size occupied by rspamd core files */
- gsize max_cores_count; /**< maximum number of core files */
- gchar *cores_dir; /**< directory for core files */
- gsize max_message; /**< maximum size for messages */
- gsize max_pic_size; /**< maximum size for a picture to process */
- gsize images_cache_size; /**< size of LRU cache for DCT data from images */
- gdouble task_timeout; /**< maximum message processing time */
- gint default_max_shots; /**< default maximum count of symbols hits permitted (-1 for unlimited) */
- gint32 heartbeats_loss_max; /**< number of heartbeats lost to consider worker's termination */
- gdouble heartbeat_interval; /**< interval for heartbeats for workers */
+ gsize max_cores_size; /**< maximum size occupied by rspamd core files */
+ gsize max_cores_count; /**< maximum number of core files */
+ gchar *cores_dir; /**< directory for core files */
+ gsize max_message; /**< maximum size for messages */
+ gsize max_pic_size; /**< maximum size for a picture to process */
+ gsize images_cache_size; /**< size of LRU cache for DCT data from images */
+ gdouble task_timeout; /**< maximum message processing time */
+ gint default_max_shots; /**< default maximum count of symbols hits permitted (-1 for unlimited) */
+ int32_t heartbeats_loss_max; /**< number of heartbeats lost to consider worker's termination */
+ gdouble heartbeat_interval; /**< interval for heartbeats for workers */
enum rspamd_log_type log_type; /**< log type */
gint log_facility; /**< log facility in case of syslog */
@@ -384,7 +384,7 @@ struct rspamd_config {
gchar *log_file; /**< path to logfile in case of file logging */
gboolean log_buffered; /**< whether logging is buffered */
gboolean log_silent_workers; /**< silence info messages from workers */
- guint32 log_buf_size; /**< length of log buffer */
+ uint32_t log_buf_size; /**< length of log buffer */
const ucl_object_t *debug_ip_map; /**< turn on debugging for specified ip addresses */
gboolean log_urls; /**< whether we should log URLs */
GHashTable *debug_modules; /**< logging modules to debug */
@@ -440,10 +440,10 @@ struct rspamd_config {
gchar *events_backend; /**< string representation of the events backend used */
gdouble dns_timeout; /**< timeout in milliseconds for waiting for dns reply */
- guint32 dns_retransmits; /**< maximum retransmits count */
- guint32 dns_io_per_server; /**< number of sockets per DNS server */
+ uint32_t dns_retransmits; /**< maximum retransmits count */
+ uint32_t dns_io_per_server; /**< number of sockets per DNS server */
const ucl_object_t *nameservers; /**< list of nameservers or NULL to parse resolv.conf */
- guint32 dns_max_requests; /**< limit of DNS requests per task */
+ uint32_t dns_max_requests; /**< limit of DNS requests per task */
gboolean enable_dnssec; /**< enable dnssec stub resolver */
guint upstream_max_errors; /**< upstream max errors before shutting off */
@@ -760,7 +760,7 @@ void rspamd_config_register_settings_id(struct rspamd_config *cfg,
* @param namelen
* @return
*/
-guint32 rspamd_config_name_to_id(const gchar *name, gsize namelen);
+uint32_t rspamd_config_name_to_id(const gchar *name, gsize namelen);
/**
* Finds settings id element and obtain reference count (must be unrefed by caller)
@@ -770,7 +770,7 @@ guint32 rspamd_config_name_to_id(const gchar *name, gsize namelen);
*/
struct rspamd_config_settings_elt *rspamd_config_find_settings_id_ref(
struct rspamd_config *cfg,
- guint32 id);
+ uint32_t id);
/**
* Finds settings id element and obtain reference count (must be unrefed by callee)
diff --git a/src/libserver/cfg_rcl.cxx b/src/libserver/cfg_rcl.cxx
index 39360110f..6addd6020 100644
--- a/src/libserver/cfg_rcl.cxx
+++ b/src/libserver/cfg_rcl.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright 2023 Vsevolod Stakhov
+ * Copyright 2024 Vsevolod Stakhov
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -2792,16 +2792,16 @@ rspamd_rcl_parse_struct_integer(rspamd_mempool_t *pool,
auto *pd = (struct rspamd_rcl_struct_parser *) ud;
union {
gint *ip;
- gint32 *i32p;
+ int32_t *i32p;
gint16 *i16p;
- gint64 *i64p;
+ int64_t *i64p;
guint *up;
gsize *sp;
} target;
int64_t val;
if (pd->flags == RSPAMD_CL_FLAG_INT_32) {
- target.i32p = (gint32 *) (((gchar *) pd->user_struct) + pd->offset);
+ target.i32p = (int32_t *) (((gchar *) pd->user_struct) + pd->offset);
if (!ucl_object_toint_safe(obj, &val)) {
g_set_error(err,
CFG_RCL_ERROR,
@@ -2814,7 +2814,7 @@ rspamd_rcl_parse_struct_integer(rspamd_mempool_t *pool,
*target.i32p = val;
}
else if (pd->flags == RSPAMD_CL_FLAG_INT_64) {
- target.i64p = (gint64 *) (((gchar *) pd->user_struct) + pd->offset);
+ target.i64p = (int64_t *) (((gchar *) pd->user_struct) + pd->offset);
if (!ucl_object_toint_safe(obj, &val)) {
g_set_error(err,
CFG_RCL_ERROR,
@@ -2917,7 +2917,7 @@ rspamd_rcl_parse_struct_time(rspamd_mempool_t *pool,
auto *pd = (struct rspamd_rcl_struct_parser *) ud;
union {
gint *psec;
- guint32 *pu32;
+ uint32_t *pu32;
gdouble *pdv;
struct timeval *ptv;
struct timespec *pts;
@@ -2955,7 +2955,7 @@ rspamd_rcl_parse_struct_time(rspamd_mempool_t *pool,
*target.psec = val * 1000;
}
else if (pd->flags == RSPAMD_CL_FLAG_TIME_UINT_32) {
- target.pu32 = (guint32 *) (((gchar *) pd->user_struct) + pd->offset);
+ target.pu32 = (uint32_t *) (((gchar *) pd->user_struct) + pd->offset);
*target.pu32 = val * 1000;
}
else {
@@ -3385,7 +3385,7 @@ static int
rspamd_rcl_emitter_append_c(unsigned char c, size_t nchars, void *ud)
{
auto *hs = (rspamd_cryptobox_hash_state_t *) ud;
- guint64 d[2];
+ uint64_t d[2];
d[0] = nchars;
d[1] = c;
diff --git a/src/libserver/cfg_utils.cxx b/src/libserver/cfg_utils.cxx
index 3a94b47a9..ec9ce0bcf 100644
--- a/src/libserver/cfg_utils.cxx
+++ b/src/libserver/cfg_utils.cxx
@@ -2399,20 +2399,20 @@ rspamd_config_settings_elt_dtor(struct rspamd_config_settings_elt *e)
}
}
-guint32
+uint32_t
rspamd_config_name_to_id(const gchar *name, gsize namelen)
{
- guint64 h;
+ uint64_t h;
h = rspamd_cryptobox_fast_hash_specific(RSPAMD_CRYPTOBOX_XXHASH64,
name, namelen, 0x0);
/* Take the lower part of hash as LE number */
- return ((guint32) GUINT64_TO_LE(h));
+ return ((uint32_t) GUINT64_TO_LE(h));
}
struct rspamd_config_settings_elt *
rspamd_config_find_settings_id_ref(struct rspamd_config *cfg,
- guint32 id)
+ uint32_t id)
{
struct rspamd_config_settings_elt *cur;
@@ -2431,7 +2431,7 @@ struct rspamd_config_settings_elt *rspamd_config_find_settings_name_ref(
struct rspamd_config *cfg,
const gchar *name, gsize namelen)
{
- guint32 id;
+ uint32_t id;
id = rspamd_config_name_to_id(name, namelen);
@@ -2445,7 +2445,7 @@ void rspamd_config_register_settings_id(struct rspamd_config *cfg,
enum rspamd_config_settings_policy policy)
{
struct rspamd_config_settings_elt *elt;
- guint32 id;
+ uint32_t id;
id = rspamd_config_name_to_id(name, strlen(name));
elt = rspamd_config_find_settings_id_ref(cfg, id);
diff --git a/src/libserver/dkim.c b/src/libserver/dkim.c
index 4318e87ad..7bf7b1f30 100644
--- a/src/libserver/dkim.c
+++ b/src/libserver/dkim.c
@@ -97,12 +97,12 @@ union rspamd_dkim_header_stat {
guint16 count;
guint16 flags;
} s;
- guint32 n;
+ uint32_t n;
};
struct rspamd_dkim_common_ctx {
rspamd_mempool_t *pool;
- guint64 sig_hash;
+ uint64_t sig_hash;
gsize len;
GPtrArray *hlist;
GHashTable *htable; /* header -> count mapping */
@@ -2469,7 +2469,7 @@ rspamd_dkim_canonize_header(struct rspamd_dkim_common_ctx *ctx,
}
if ((rh->flags & RSPAMD_HEADER_UNIQUE) && hdr_cnt > 1) {
- guint64 random_cookie = ottery_rand_uint64();
+ uint64_t random_cookie = ottery_rand_uint64();
msg_warn_dkim("header %s is intended to be unique by"
" email standards, but we have %d headers of this"
@@ -2586,8 +2586,8 @@ rspamd_dkim_canonize_header(struct rspamd_dkim_common_ctx *ctx,
DL_FOREACH(rh, cur)
{
- guint64 th = rspamd_cryptobox_fast_hash(cur->decoded,
- strlen(cur->decoded), rspamd_hash_seed());
+ uint64_t th = rspamd_cryptobox_fast_hash(cur->decoded,
+ strlen(cur->decoded), rspamd_hash_seed());
if (th == ctx->sig_hash) {
rspamd_dkim_signature_update(ctx, cur->raw_value,
diff --git a/src/libserver/dns.c b/src/libserver/dns.c
index be2d5a3dd..980be1dba 100644
--- a/src/libserver/dns.c
+++ b/src/libserver/dns.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2023 Vsevolod Stakhov
+ * Copyright 2024 Vsevolod Stakhov
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -64,7 +64,7 @@ struct rspamd_dns_request_ud {
struct rspamd_dns_fail_cache_entry {
const char *name;
- gint32 namelen;
+ int32_t namelen;
enum rdns_request_type type;
};
diff --git a/src/libserver/fuzzy_backend/fuzzy_backend.c b/src/libserver/fuzzy_backend/fuzzy_backend.c
index 9099f38dd..607a92e85 100644
--- a/src/libserver/fuzzy_backend/fuzzy_backend.c
+++ b/src/libserver/fuzzy_backend/fuzzy_backend.c
@@ -215,7 +215,7 @@ rspamd_fuzzy_backend_count_sqlite(struct rspamd_fuzzy_backend *bk,
void *subr_ud)
{
struct rspamd_fuzzy_backend_sqlite *sq = subr_ud;
- guint64 nhashes;
+ uint64_t nhashes;
nhashes = rspamd_fuzzy_backend_sqlite_count(sq);
@@ -231,7 +231,7 @@ rspamd_fuzzy_backend_version_sqlite(struct rspamd_fuzzy_backend *bk,
void *subr_ud)
{
struct rspamd_fuzzy_backend_sqlite *sq = subr_ud;
- guint64 rev;
+ uint64_t rev;
rev = rspamd_fuzzy_backend_sqlite_version(sq, src);
diff --git a/src/libserver/fuzzy_backend/fuzzy_backend.h b/src/libserver/fuzzy_backend/fuzzy_backend.h
index a1b74bcd0..11b60abb3 100644
--- a/src/libserver/fuzzy_backend/fuzzy_backend.h
+++ b/src/libserver/fuzzy_backend/fuzzy_backend.h
@@ -39,9 +39,9 @@ typedef void (*rspamd_fuzzy_update_cb)(gboolean success,
guint nignored,
void *ud);
-typedef void (*rspamd_fuzzy_version_cb)(guint64 rev, void *ud);
+typedef void (*rspamd_fuzzy_version_cb)(uint64_t rev, void *ud);
-typedef void (*rspamd_fuzzy_count_cb)(guint64 count, void *ud);
+typedef void (*rspamd_fuzzy_count_cb)(uint64_t count, void *ud);
typedef gboolean (*rspamd_fuzzy_periodic_cb)(void *ud);
diff --git a/src/libserver/fuzzy_backend/fuzzy_backend_redis.c b/src/libserver/fuzzy_backend/fuzzy_backend_redis.c
index 7ab7ca63e..e1f24dd1a 100644
--- a/src/libserver/fuzzy_backend/fuzzy_backend_redis.c
+++ b/src/libserver/fuzzy_backend/fuzzy_backend_redis.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2023 Vsevolod Stakhov
+ * Copyright 2024 Vsevolod Stakhov
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -1094,7 +1094,7 @@ rspamd_fuzzy_update_append_command(struct rspamd_fuzzy_backend *bk,
g_string_append(key, session->backend->redis_object);
g_string_append_len(key, cmd->digest, sizeof(cmd->digest));
value = g_string_sized_new(sizeof("18446744073709551616"));
- rspamd_printf_gstring(value, "%L", (gint64) rspamd_get_calendar_ticks());
+ rspamd_printf_gstring(value, "%L", (int64_t) rspamd_get_calendar_ticks());
session->argv[cur_shift] = g_strdup("HSETNX");
session->argv_lens[cur_shift++] = sizeof("HSETNX") - 1;
session->argv[cur_shift] = key->str;
diff --git a/src/libserver/fuzzy_backend/fuzzy_backend_sqlite.c b/src/libserver/fuzzy_backend/fuzzy_backend_sqlite.c
index 9ec448ebc..df91c65b0 100644
--- a/src/libserver/fuzzy_backend/fuzzy_backend_sqlite.c
+++ b/src/libserver/fuzzy_backend/fuzzy_backend_sqlite.c
@@ -1,11 +1,11 @@
-/*-
- * Copyright 2016 Vsevolod Stakhov
+/*
+ * Copyright 2024 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,
@@ -303,7 +303,7 @@ rspamd_fuzzy_backend_sqlite_run_stmt(struct rspamd_fuzzy_backend_sqlite *backend
SQLITE_STATIC);
break;
case 'I':
- sqlite3_bind_int64(stmt, i + 1, va_arg(ap, gint64));
+ sqlite3_bind_int64(stmt, i + 1, va_arg(ap, int64_t));
break;
case 'S':
sqlite3_bind_int(stmt, i + 1, va_arg(ap, gint));
@@ -454,20 +454,20 @@ rspamd_fuzzy_backend_sqlite_open(const gchar *path,
static gint
rspamd_fuzzy_backend_sqlite_int64_cmp(const void *a, const void *b)
{
- gint64 ia = *(gint64 *) a, ib = *(gint64 *) b;
+ int64_t ia = *(int64_t *) a, ib = *(int64_t *) b;
return (ia - ib);
}
struct rspamd_fuzzy_reply
rspamd_fuzzy_backend_sqlite_check(struct rspamd_fuzzy_backend_sqlite *backend,
- const struct rspamd_fuzzy_cmd *cmd, gint64 expire)
+ const struct rspamd_fuzzy_cmd *cmd, int64_t expire)
{
struct rspamd_fuzzy_reply rep;
const struct rspamd_fuzzy_shingle_cmd *shcmd;
int rc;
- gint64 timestamp;
- gint64 shingle_values[RSPAMD_SHINGLE_SIZE], i, sel_id, cur_id,
+ int64_t timestamp;
+ int64_t shingle_values[RSPAMD_SHINGLE_SIZE], i, sel_id, cur_id,
cur_cnt, max_cnt;
memset(&rep, 0, sizeof(rep));
@@ -524,7 +524,7 @@ rspamd_fuzzy_backend_sqlite_check(struct rspamd_fuzzy_backend_sqlite *backend,
rspamd_fuzzy_backend_sqlite_cleanup_stmt(backend,
RSPAMD_FUZZY_BACKEND_CHECK_SHINGLE);
- qsort(shingle_values, RSPAMD_SHINGLE_SIZE, sizeof(gint64),
+ qsort(shingle_values, RSPAMD_SHINGLE_SIZE, sizeof(int64_t),
rspamd_fuzzy_backend_sqlite_int64_cmp);
sel_id = -1;
cur_id = -1;
@@ -630,7 +630,7 @@ rspamd_fuzzy_backend_sqlite_add(struct rspamd_fuzzy_backend_sqlite *backend,
const struct rspamd_fuzzy_cmd *cmd)
{
int rc, i;
- gint64 id, flag;
+ int64_t id, flag;
const struct rspamd_fuzzy_shingle_cmd *shcmd;
if (backend == NULL) {
@@ -652,7 +652,7 @@ rspamd_fuzzy_backend_sqlite_add(struct rspamd_fuzzy_backend_sqlite *backend,
/* We need to increase weight */
rc = rspamd_fuzzy_backend_sqlite_run_stmt(backend, TRUE,
RSPAMD_FUZZY_BACKEND_UPDATE,
- (gint64) cmd->value,
+ (int64_t) cmd->value,
cmd->digest);
if (rc != SQLITE_OK) {
msg_warn_fuzzy_backend("cannot update hash to %d -> "
@@ -667,8 +667,8 @@ rspamd_fuzzy_backend_sqlite_add(struct rspamd_fuzzy_backend_sqlite *backend,
rc = rspamd_fuzzy_backend_sqlite_run_stmt(backend, TRUE,
RSPAMD_FUZZY_BACKEND_UPDATE_FLAG,
- (gint64) cmd->value,
- (gint64) cmd->flag,
+ (int64_t) cmd->value,
+ (int64_t) cmd->flag,
cmd->digest);
if (rc != SQLITE_OK) {
@@ -686,7 +686,7 @@ rspamd_fuzzy_backend_sqlite_add(struct rspamd_fuzzy_backend_sqlite *backend,
RSPAMD_FUZZY_BACKEND_INSERT,
(gint) cmd->flag,
cmd->digest,
- (gint64) cmd->value);
+ (int64_t) cmd->value);
if (rc == SQLITE_OK) {
if (cmd->shingles_count > 0) {
@@ -696,7 +696,7 @@ rspamd_fuzzy_backend_sqlite_add(struct rspamd_fuzzy_backend_sqlite *backend,
for (i = 0; i < RSPAMD_SHINGLE_SIZE; i++) {
rc = rspamd_fuzzy_backend_sqlite_run_stmt(backend, TRUE,
RSPAMD_FUZZY_BACKEND_INSERT_SHINGLE,
- shcmd->sgl.hashes[i], (gint64) i, id);
+ shcmd->sgl.hashes[i], (int64_t) i, id);
msg_debug_fuzzy_backend("add shingle %d -> %L: %L",
i,
shcmd->sgl.hashes[i],
@@ -740,7 +740,7 @@ rspamd_fuzzy_backend_sqlite_finish_update(struct rspamd_fuzzy_backend_sqlite *ba
rc = rspamd_fuzzy_backend_sqlite_run_stmt(backend, TRUE,
RSPAMD_FUZZY_BACKEND_SET_VERSION,
- (gint64) ver, (gint64) time(NULL), source);
+ (int64_t) ver, (int64_t) time(NULL), source);
}
if (rc == SQLITE_OK) {
@@ -815,18 +815,18 @@ rspamd_fuzzy_backend_sqlite_del(struct rspamd_fuzzy_backend_sqlite *backend,
gboolean
rspamd_fuzzy_backend_sqlite_sync(struct rspamd_fuzzy_backend_sqlite *backend,
- gint64 expire,
+ int64_t expire,
gboolean clean_orphaned)
{
struct orphaned_shingle_elt {
- gint64 value;
- gint64 number;
+ int64_t value;
+ int64_t number;
};
/* Do not do more than 5k ops per step */
- const guint64 max_changes = 5000;
+ const uint64_t max_changes = 5000;
gboolean ret = FALSE;
- gint64 expire_lim, expired;
+ int64_t expire_lim, expired;
gint rc, i, orphaned_cnt = 0;
GError *err = NULL;
static const gchar orphaned_shingles[] = "SELECT shingles.value,shingles.number "
diff --git a/src/libserver/fuzzy_backend/fuzzy_backend_sqlite.h b/src/libserver/fuzzy_backend/fuzzy_backend_sqlite.h
index 766f7c9d2..62c028f3d 100644
--- a/src/libserver/fuzzy_backend/fuzzy_backend_sqlite.h
+++ b/src/libserver/fuzzy_backend/fuzzy_backend_sqlite.h
@@ -1,11 +1,11 @@
-/*-
- * Copyright 2016 Vsevolod Stakhov
+/*
+ * Copyright 2024 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,
@@ -44,7 +44,7 @@ struct rspamd_fuzzy_backend_sqlite *rspamd_fuzzy_backend_sqlite_open(const gchar
struct rspamd_fuzzy_reply rspamd_fuzzy_backend_sqlite_check(
struct rspamd_fuzzy_backend_sqlite *backend,
const struct rspamd_fuzzy_cmd *cmd,
- gint64 expire);
+ int64_t expire);
/**
* Prepare storage for updates (by starting transaction)
@@ -83,7 +83,7 @@ gboolean rspamd_fuzzy_backend_sqlite_finish_update(struct rspamd_fuzzy_backend_s
* @return
*/
gboolean rspamd_fuzzy_backend_sqlite_sync(struct rspamd_fuzzy_backend_sqlite *backend,
- gint64 expire,
+ int64_t expire,
gboolean clean_orphaned);
/**
diff --git a/src/libserver/fuzzy_wire.h b/src/libserver/fuzzy_wire.h
index c2f93b8dc..40ca66c97 100644
--- a/src/libserver/fuzzy_wire.h
+++ b/src/libserver/fuzzy_wire.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2023 Vsevolod Stakhov
+ * Copyright 2024 Vsevolod Stakhov
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -58,8 +58,8 @@ RSPAMD_PACKED(rspamd_fuzzy_cmd)
guint8 cmd;
guint8 shingles_count;
guint8 flag;
- gint32 value;
- guint32 tag;
+ int32_t value;
+ uint32_t tag;
gchar digest[rspamd_cryptobox_HASHBYTES];
};
@@ -71,9 +71,9 @@ RSPAMD_PACKED(rspamd_fuzzy_shingle_cmd)
RSPAMD_PACKED(rspamd_fuzzy_reply_v1)
{
- gint32 value;
- guint32 flag;
- guint32 tag;
+ int32_t value;
+ uint32_t flag;
+ uint32_t tag;
float prob;
};
@@ -81,7 +81,7 @@ RSPAMD_PACKED(rspamd_fuzzy_reply)
{
struct rspamd_fuzzy_reply_v1 v1;
gchar digest[rspamd_cryptobox_HASHBYTES];
- guint32 ts;
+ uint32_t ts;
guchar reserved[12];
};
@@ -135,12 +135,12 @@ struct rspamd_fuzzy_cmd_extension {
struct rspamd_fuzzy_stat_entry {
const gchar *name;
- guint64 fuzzy_cnt;
+ uint64_t fuzzy_cnt;
};
RSPAMD_PACKED(fuzzy_peer_cmd)
{
- gint32 is_shingle;
+ int32_t is_shingle;
union {
struct rspamd_fuzzy_cmd normal;
struct rspamd_fuzzy_shingle_cmd shingle;
diff --git a/src/libserver/http/http_context.c b/src/libserver/http/http_context.c
index f08e33baf..e9cfe187d 100644
--- a/src/libserver/http/http_context.c
+++ b/src/libserver/http/http_context.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2023 Vsevolod Stakhov
+ * Copyright 2024 Vsevolod Stakhov
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -361,7 +361,7 @@ rspamd_http_context_default(void)
return default_ctx;
}
-gint32
+int32_t
rspamd_keep_alive_key_hash(struct rspamd_keepalive_hash_key *k)
{
rspamd_cryptobox_fast_hash_state_t hst;
diff --git a/src/libserver/http/http_private.h b/src/libserver/http/http_private.h
index 096545e7e..bad0231a8 100644
--- a/src/libserver/http/http_private.h
+++ b/src/libserver/http/http_private.h
@@ -1,11 +1,11 @@
-/*-
- * Copyright 2016 Vsevolod Stakhov
+/*
+ * Copyright 2024 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,
@@ -91,7 +91,7 @@ struct rspamd_keepalive_hash_key {
GQueue conns;
};
-gint32 rspamd_keep_alive_key_hash(struct rspamd_keepalive_hash_key *k);
+int32_t rspamd_keep_alive_key_hash(struct rspamd_keepalive_hash_key *k);
bool rspamd_keep_alive_key_equal(struct rspamd_keepalive_hash_key *k1,
struct rspamd_keepalive_hash_key *k2);
diff --git a/src/libserver/http/http_util.c b/src/libserver/http/http_util.c
index d5c4a57f9..b43785be6 100644
--- a/src/libserver/http/http_util.c
+++ b/src/libserver/http/http_util.c
@@ -34,7 +34,7 @@ rspamd_http_parse_date(const gchar *header, gsize len)
const gchar *p, *end;
gint month;
guint day, year, hour, min, sec;
- guint64 time;
+ uint64_t time;
enum {
no = 0,
rfc822, /* Tue, 10 Nov 2002 23:50:13 */
@@ -257,7 +257,7 @@ rspamd_http_parse_date(const gchar *header, gsize len)
/* Gauss' formula for Gregorian days since March 1, 1 BC */
- time = (guint64) (
+ time = (uint64_t) (
/* days in years including leap years since March 1, 1 BC */
365 * year + year / 4 - year / 100 + year / 400
diff --git a/src/libserver/logger.h b/src/libserver/logger.h
index 8d4e313a8..4d8a6ec81 100644
--- a/src/libserver/logger.h
+++ b/src/libserver/logger.h
@@ -189,7 +189,7 @@ bool rspamd_conditional_debug_fast(rspamd_logger_t *logger,
bool rspamd_conditional_debug_fast_num_id(rspamd_logger_t *logger,
rspamd_inet_addr_t *addr,
gint mod_id,
- const gchar *module, guint64 id,
+ const gchar *module, uint64_t id,
const gchar *function, const gchar *fmt, ...);
gboolean rspamd_logger_need_log(rspamd_logger_t *rspamd_log,
GLogLevelFlags log_level,
@@ -234,7 +234,7 @@ void rspamd_log_nodebug(rspamd_logger_t *logger);
* 2 - info messages
* 3 - debug messages
*/
-const guint64 *rspamd_log_counters(rspamd_logger_t *logger);
+const uint64_t *rspamd_log_counters(rspamd_logger_t *logger);
/**
* Returns errors ring buffer as ucl array
diff --git a/src/libserver/logger/logger.c b/src/libserver/logger/logger.c
index 2dae6329b..202837563 100644
--- a/src/libserver/logger/logger.c
+++ b/src/libserver/logger/logger.c
@@ -373,7 +373,7 @@ rspamd_log_write_ringbuffer(rspamd_logger_t *rspamd_log,
const gchar *module, const gchar *id,
const gchar *data, glong len)
{
- guint32 row_num;
+ uint32_t row_num;
struct rspamd_logger_error_log *elog;
struct rspamd_logger_error_elt *elt;
@@ -644,7 +644,7 @@ bool rspamd_conditional_debug_fast(rspamd_logger_t *rspamd_log,
bool rspamd_conditional_debug_fast_num_id(rspamd_logger_t *rspamd_log,
rspamd_inet_addr_t *addr,
- gint mod_id, const gchar *module, guint64 id,
+ gint mod_id, const gchar *module, uint64_t id,
const gchar *function, const gchar *fmt, ...)
{
static gchar logbuf[LOGBUF_LEN], idbuf[64];
@@ -725,7 +725,7 @@ void rspamd_log_nodebug(rspamd_logger_t *rspamd_log)
rspamd_log->is_debug = FALSE;
}
-const guint64 *
+const uint64_t *
rspamd_log_counters(rspamd_logger_t *logger)
{
if (logger) {
@@ -905,7 +905,7 @@ rspamd_log_line_hex_escape(const guchar *src, gsize srclen,
static const gchar hexdigests[16] = "0123456789ABCDEF";
gchar *d = dst;
- static guint32 escape[] = {
+ static uint32_t escape[] = {
0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */
/* ?>=< ;:98 7654 3210 /.-, +*)( '&%$ #"! */
@@ -952,7 +952,7 @@ rspamd_log_line_hex_escape(const guchar *src, gsize srclen,
gsize rspamd_log_line_need_escape(const guchar *src, gsize srclen)
{
- static guint32 escape[] = {
+ static uint32_t escape[] = {
0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */
/* ?>=< ;:98 7654 3210 /.-, +*)( '&%$ #"! */
diff --git a/src/libserver/logger/logger_file.c b/src/libserver/logger/logger_file.c
index 20b04b852..f45d61cf1 100644
--- a/src/libserver/logger/logger_file.c
+++ b/src/libserver/logger/logger_file.c
@@ -27,8 +27,8 @@
struct rspamd_file_logger_priv {
gint fd;
struct {
- guint32 size;
- guint32 used;
+ uint32_t size;
+ uint32_t used;
u_char *buf;
} io_buf;
gboolean throttling;
@@ -36,8 +36,8 @@ struct rspamd_file_logger_priv {
gboolean is_buffered;
gboolean log_severity;
time_t throttling_time;
- guint32 repeats;
- guint64 last_line_cksum;
+ uint32_t repeats;
+ uint64_t last_line_cksum;
gchar *saved_message;
gsize saved_mlen;
gchar *saved_function;
@@ -49,7 +49,7 @@ struct rspamd_file_logger_priv {
/**
* Calculate checksum for log line (used for repeating logic)
*/
-static inline guint64
+static inline uint64_t
rspamd_log_calculate_cksum(const gchar *message, size_t mlen)
{
return rspamd_cryptobox_fast_hash(message, mlen, rspamd_hash_seed());
@@ -376,7 +376,7 @@ bool rspamd_log_file_log(const gchar *module, const gchar *id,
{
struct rspamd_file_logger_priv *priv = (struct rspamd_file_logger_priv *) arg;
gdouble now;
- guint64 cksum;
+ uint64_t cksum;
gboolean got_time = FALSE;
diff --git a/src/libserver/logger/logger_private.h b/src/libserver/logger/logger_private.h
index 234a207e5..d155bdcb0 100644
--- a/src/libserver/logger/logger_private.h
+++ b/src/libserver/logger/logger_private.h
@@ -48,10 +48,10 @@ struct rspamd_logger_error_elt {
struct rspamd_logger_error_log {
struct rspamd_logger_error_elt *elts;
rspamd_mempool_t *pool;
- guint32 max_elts;
- guint32 elt_len;
+ uint32_t max_elts;
+ uint32_t elt_len;
/* Avoid false cache sharing */
- guchar __padding[64 - sizeof(gpointer) * 2 - sizeof(guint64)];
+ guchar __padding[64 - sizeof(gpointer) * 2 - sizeof(uint64_t)];
guint cur_row;
};
@@ -78,7 +78,7 @@ struct rspamd_logger_s {
struct rspamd_radix_map_helper *debug_ip;
rspamd_mempool_mutex_t *mtx;
rspamd_mempool_t *pool;
- guint64 log_cnt[4];
+ uint64_t log_cnt[4];
};
/*
diff --git a/src/libserver/maps/map_helpers.c b/src/libserver/maps/map_helpers.c
index 65478c567..8cb5eda78 100644
--- a/src/libserver/maps/map_helpers.c
+++ b/src/libserver/maps/map_helpers.c
@@ -35,7 +35,7 @@
#endif
-static const guint64 map_hash_seed = 0xdeadbabeULL;
+static const uint64_t map_hash_seed = 0xdeadbabeULL;
static const gchar *const hash_fill = "1";
struct rspamd_map_helper_value {
diff --git a/src/libserver/maps/map_private.h b/src/libserver/maps/map_private.h
index b88a18e3f..458c83230 100644
--- a/src/libserver/maps/map_private.h
+++ b/src/libserver/maps/map_private.h
@@ -72,7 +72,7 @@ struct rspamd_http_map_cached_cbdata {
struct rspamd_storage_shmem *shm;
struct rspamd_map *map;
struct http_map_data *data;
- guint64 gen;
+ uint64_t gen;
time_t last_checked;
};
@@ -99,7 +99,7 @@ struct http_map_data {
time_t last_modified;
time_t last_checked;
gboolean request_sent;
- guint64 gen;
+ uint64_t gen;
guint16 port;
};
@@ -124,7 +124,7 @@ struct rspamd_map_backend {
gboolean is_fallback;
struct rspamd_map *map;
struct ev_loop *event_loop;
- guint32 id;
+ uint32_t id;
struct rspamd_cryptobox_pubkey *trusted_pubkey;
union rspamd_map_backend_data data;
gchar *uri;
@@ -146,7 +146,7 @@ struct rspamd_map {
struct rspamd_worker *wrk;
gchar *description;
gchar *name;
- guint32 id;
+ uint32_t id;
struct map_periodic_cbdata *scheduled_check;
rspamd_map_tmp_dtor tmp_dtor;
gpointer tmp_dtor_data;
@@ -156,7 +156,7 @@ struct rspamd_map {
GDestroyNotify on_load_ud_dtor;
gpointer lua_map;
gsize nelts;
- guint64 digest;
+ uint64_t digest;
/* Should we check HTTP or just load cached data */
ev_tstamp timeout;
gdouble poll_timeout;
diff --git a/src/libserver/milter.c b/src/libserver/milter.c
index cfb7d3ce3..f60c606f3 100644
--- a/src/libserver/milter.c
+++ b/src/libserver/milter.c
@@ -331,7 +331,7 @@ rspamd_milter_process_command(struct rspamd_milter_session *session,
rspamd_fstring_t *buf;
const guchar *pos, *end, *zero;
guint cmdlen;
- guint32 version, actions, protocol;
+ uint32_t version, actions, protocol;
buf = priv->parser.buf;
pos = buf->str + priv->parser.cmd_start;
@@ -689,7 +689,7 @@ rspamd_milter_process_command(struct rspamd_milter_session *session,
"\r\n", 2);
break;
case RSPAMD_MILTER_CMD_OPTNEG:
- if (cmdlen != sizeof(guint32) * 3) {
+ if (cmdlen != sizeof(uint32_t) * 3) {
err = g_error_new(rspamd_milter_quark(), EINVAL, "invalid "
"optneg command");
rspamd_milter_on_protocol_error(session, priv, err);
@@ -1268,7 +1268,7 @@ rspamd_milter_set_reply(struct rspamd_milter_session *session,
#define SET_COMMAND(cmd, sz, reply, pos) \
do { \
- guint32 _len; \
+ uint32_t _len; \
_len = (sz) + 1; \
(reply) = rspamd_fstring_sized_new(sizeof(_len) + _len); \
(reply)->len = sizeof(_len) + _len; \
@@ -1282,7 +1282,7 @@ gboolean
rspamd_milter_send_action(struct rspamd_milter_session *session,
enum rspamd_milter_reply act, ...)
{
- guint32 ver, actions, protocol, idx;
+ uint32_t ver, actions, protocol, idx;
va_list ap;
guchar cmd, *pos;
rspamd_fstring_t *reply = NULL;
@@ -1331,14 +1331,14 @@ rspamd_milter_send_action(struct rspamd_milter_session *session,
break;
case RSPAMD_MILTER_CHGHEADER:
case RSPAMD_MILTER_INSHEADER:
- idx = va_arg(ap, guint32);
+ idx = va_arg(ap, uint32_t);
name = va_arg(ap, GString *);
value = va_arg(ap, GString *);
msg_debug_milter("change/insert header command pos = %d- \"%v\"=\"%v\"",
idx, name, value);
/* Name and value must be zero terminated */
- SET_COMMAND(cmd, name->len + value->len + 2 + sizeof(guint32),
+ SET_COMMAND(cmd, name->len + value->len + 2 + sizeof(uint32_t),
reply, pos);
idx = htonl(idx);
memcpy(pos, &idx, sizeof(idx));
@@ -1366,16 +1366,16 @@ rspamd_milter_send_action(struct rspamd_milter_session *session,
memcpy(pos, value->str, value->len + 1);
break;
case RSPAMD_MILTER_OPTNEG:
- ver = va_arg(ap, guint32);
- actions = va_arg(ap, guint32);
- protocol = va_arg(ap, guint32);
+ ver = va_arg(ap, uint32_t);
+ actions = va_arg(ap, uint32_t);
+ protocol = va_arg(ap, uint32_t);
msg_debug_milter("optneg reply: ver=%d, actions=%d, protocol=%d",
ver, actions, protocol);
ver = htonl(ver);
actions = htonl(actions);
protocol = htonl(protocol);
- SET_COMMAND(cmd, sizeof(guint32) * 3, reply, pos);
+ SET_COMMAND(cmd, sizeof(uint32_t) * 3, reply, pos);
memcpy(pos, &ver, sizeof(ver));
pos += sizeof(ver);
memcpy(pos, &actions, sizeof(actions));
@@ -1416,7 +1416,7 @@ rspamd_milter_del_header(struct rspamd_milter_session *session,
GString *name)
{
GString value;
- guint32 idx = 1;
+ uint32_t idx = 1;
value.str = (gchar *) "";
value.len = 0;
@@ -1960,7 +1960,7 @@ rspamd_milter_process_milter_block(struct rspamd_milter_session *session,
hname = g_string_new(milter_ctx->spam_header);
hvalue = g_string_new(ucl_object_tostring(elt));
rspamd_milter_send_action(session, RSPAMD_MILTER_CHGHEADER,
- (guint32) 1, hname, hvalue);
+ (uint32_t) 1, hname, hvalue);
g_string_free(hname, TRUE);
g_string_free(hvalue, TRUE);
rspamd_milter_send_action(session, RSPAMD_MILTER_ACCEPT);
@@ -1978,7 +1978,7 @@ rspamd_milter_process_milter_block(struct rspamd_milter_session *session,
hname = g_string_new(ucl_object_key(cur));
hvalue = g_string_new(ucl_object_tostring(cur));
rspamd_milter_send_action(session, RSPAMD_MILTER_CHGHEADER,
- (guint32) 1, hname, hvalue);
+ (uint32_t) 1, hname, hvalue);
g_string_free(hname, TRUE);
g_string_free(hvalue, TRUE);
}
@@ -2169,7 +2169,7 @@ void rspamd_milter_send_task_results(struct rspamd_milter_session *session,
hvalue = g_string_new(ucl_object_tostring(elt));
rspamd_milter_send_action(session, RSPAMD_MILTER_CHGHEADER,
- (guint32) 1, hname, hvalue);
+ (uint32_t) 1, hname, hvalue);
g_string_free(hname, TRUE);
g_string_free(hvalue, TRUE);
}
@@ -2186,7 +2186,7 @@ void rspamd_milter_send_task_results(struct rspamd_milter_session *session,
hname = g_string_new(milter_ctx->spam_header);
hvalue = g_string_new("Yes");
rspamd_milter_send_action(session, RSPAMD_MILTER_CHGHEADER,
- (guint32) 1, hname, hvalue);
+ (uint32_t) 1, hname, hvalue);
g_string_free(hname, TRUE);
g_string_free(hvalue, TRUE);
rspamd_milter_send_action(session, RSPAMD_MILTER_ACCEPT);
diff --git a/src/libserver/monitored.c b/src/libserver/monitored.c
index 3aebaf660..cd8b4d675 100644
--- a/src/libserver/monitored.c
+++ b/src/libserver/monitored.c
@@ -365,7 +365,7 @@ rspamd_monitored_dns_cb(struct rdns_reply *reply, void *arg)
LL_FOREACH(reply->entries, cur)
{
if (cur->type == RDNS_REQUEST_A) {
- if ((guint32) cur->content.a.addr.s_addr ==
+ if ((uint32_t) cur->content.a.addr.s_addr ==
htonl(INADDR_LOOPBACK)) {
is_special_reply = TRUE;
}
diff --git a/src/libserver/protocol.c b/src/libserver/protocol.c
index a251dcd05..20b0a6117 100644
--- a/src/libserver/protocol.c
+++ b/src/libserver/protocol.c
@@ -1867,7 +1867,7 @@ end:
#endif
/* Set average processing time */
- guint32 slot;
+ uint32_t slot;
float processing_time = task->time_real_finish - task->task_timestamp;
#ifndef HAVE_ATOMIC_BUILTINS
@@ -1890,7 +1890,7 @@ void rspamd_protocol_write_log_pipe(struct rspamd_task *task)
struct rspamd_scan_result *mres;
struct rspamd_symbol_result *sym;
gint id, i;
- guint32 n = 0, nextra = 0;
+ uint32_t n = 0, nextra = 0;
gsize sz;
GArray *extra;
struct rspamd_protocol_log_symbol_result er;
diff --git a/src/libserver/protocol.h b/src/libserver/protocol.h
index 38d9cef4b..fb4625caf 100644
--- a/src/libserver/protocol.h
+++ b/src/libserver/protocol.h
@@ -39,13 +39,13 @@ extern "C" {
#define RSPAMD_STATFILE_ERROR RSPAMD_BASE_ERROR + 5
struct rspamd_protocol_log_symbol_result {
- guint32 id;
+ uint32_t id;
float score;
};
struct rspamd_protocol_log_message_sum {
- guint32 nresults;
- guint32 nextra;
- guint32 settings_id;
+ uint32_t nresults;
+ uint32_t nextra;
+ uint32_t settings_id;
gdouble score;
gdouble required_score;
struct rspamd_protocol_log_symbol_result results[];
diff --git a/src/libserver/re_cache.c b/src/libserver/re_cache.c
index 15a52228b..da667fc5e 100644
--- a/src/libserver/re_cache.c
+++ b/src/libserver/re_cache.c
@@ -84,7 +84,7 @@ static const guchar rspamd_hs_magic[] = {'r', 's', 'h', 's', 'r', 'e', '1', '1'}
struct rspamd_re_class {
- guint64 id;
+ uint64_t id;
enum rspamd_re_type type;
gboolean has_utf8; /* if there are any utf8 regexps */
gpointer type_data;
@@ -157,7 +157,7 @@ rspamd_re_cache_quark(void)
return g_quark_from_static_string("re_cache");
}
-static guint64
+static uint64_t
rspamd_re_cache_class_id(enum rspamd_re_type type,
gconstpointer type_data,
gsize datalen)
@@ -279,7 +279,7 @@ rspamd_re_cache_add(struct rspamd_re_cache *cache,
gconstpointer type_data, gsize datalen,
gint lua_cbref)
{
- guint64 class_id;
+ uint64_t class_id;
struct rspamd_re_class *re_class;
rspamd_regexp_t *nre;
struct rspamd_re_cache_elt *elt;
@@ -334,7 +334,7 @@ void rspamd_re_cache_replace(struct rspamd_re_cache *cache,
rspamd_regexp_t *what,
rspamd_regexp_t *with)
{
- guint64 re_id;
+ uint64_t re_id;
struct rspamd_re_class *re_class;
rspamd_regexp_t *src;
struct rspamd_re_cache_elt *elt;
@@ -590,7 +590,7 @@ rspamd_re_cache_process_pcre(struct rspamd_re_runtime *rt,
guint r = 0;
const gchar *start = NULL, *end = NULL;
guint max_hits = rspamd_regexp_get_maxhits(re);
- guint64 id = rspamd_regexp_get_cache_id(re);
+ uint64_t id = rspamd_regexp_get_cache_id(re);
gdouble t1 = NAN, t2, pr;
const gdouble slow_time = 1e8;
@@ -736,7 +736,7 @@ rspamd_re_cache_process_regexp_data(struct rspamd_re_runtime *rt,
gboolean *processed_hyperscan)
{
- guint64 re_id;
+ uint64_t re_id;
guint ret = 0;
guint i;
struct rspamd_re_cache_elt *cache_elt;
@@ -834,7 +834,7 @@ rspamd_re_cache_finish_class(struct rspamd_task *task,
{
#ifdef WITH_HYPERSCAN
guint i;
- guint64 re_id;
+ uint64_t re_id;
guint found = 0;
/* Set all bits that are not checked and included in hyperscan to 1 */
@@ -1504,7 +1504,7 @@ gint rspamd_re_cache_process(struct rspamd_task *task,
gsize datalen,
gboolean is_strong)
{
- guint64 re_id;
+ uint64_t re_id;
struct rspamd_re_class *re_class;
struct rspamd_re_cache *cache;
struct rspamd_re_runtime *rt;
@@ -1678,7 +1678,7 @@ enum rspamd_re_type
rspamd_re_cache_type_from_string(const char *str)
{
enum rspamd_re_type ret;
- guint64 h;
+ uint64_t h;
/*
* To optimize this function, we apply hash to input string and
@@ -1889,7 +1889,7 @@ rspamd_re_cache_compile_timer_cb(EV_P_ ev_timer *w, int revents)
hs_database_t *test_db;
gint fd, i, n, *hs_ids = NULL, pcre_flags, re_flags;
rspamd_cryptobox_fast_hash_state_t crc_st;
- guint64 crc;
+ uint64_t crc;
rspamd_regexp_t *re;
hs_compile_error_t *hs_errors = NULL;
guint *hs_flags = NULL;
@@ -2273,7 +2273,7 @@ rspamd_re_cache_is_valid_hyperscan_file(struct rspamd_re_cache *cache,
hs_database_t *test_db = NULL;
guchar *map, *p, *end;
rspamd_cryptobox_fast_hash_state_t crc_st;
- guint64 crc, valid_crc;
+ uint64_t crc, valid_crc;
len = strlen(path);
@@ -2406,7 +2406,7 @@ rspamd_re_cache_is_valid_hyperscan_file(struct rspamd_re_cache *cache,
p += sizeof(gint);
if (n <= 0 || 2 * n * sizeof(gint) + /* IDs + flags */
- sizeof(guint64) + /* crc */
+ sizeof(uint64_t) + /* crc */
RSPAMD_HS_MAGIC_LEN + /* header */
sizeof(cache->plt) >
len) {
@@ -2437,7 +2437,7 @@ rspamd_re_cache_is_valid_hyperscan_file(struct rspamd_re_cache *cache,
rspamd_cryptobox_fast_hash_update(&crc_st, p + n * sizeof(gint),
n * sizeof(gint));
/* HS database */
- p += n * sizeof(gint) * 2 + sizeof(guint64);
+ p += n * sizeof(gint) * 2 + sizeof(uint64_t);
rspamd_cryptobox_fast_hash_update(&crc_st, p, end - p);
valid_crc = rspamd_cryptobox_fast_hash_final(&crc_st);
@@ -2539,7 +2539,7 @@ rspamd_re_cache_load_hyperscan(struct rspamd_re_cache *cache,
n = *(gint *) p;
if (n <= 0 || 2 * n * sizeof(gint) + /* IDs + flags */
- sizeof(guint64) + /* crc */
+ sizeof(uint64_t) + /* crc */
RSPAMD_HS_MAGIC_LEN + /* header */
sizeof(cache->plt) >
(gsize) st.st_size) {
@@ -2567,7 +2567,7 @@ rspamd_re_cache_load_hyperscan(struct rspamd_re_cache *cache,
memcpy(hs_flags, p, n * sizeof(*hs_flags));
/* Skip crc */
- p += n * sizeof(*hs_ids) + sizeof(guint64);
+ p += n * sizeof(*hs_ids) + sizeof(uint64_t);
/* Cleanup */
if (re_class->hs_scratch != NULL) {
diff --git a/src/libserver/re_cache.h b/src/libserver/re_cache.h
index d6449a9f9..b55942866 100644
--- a/src/libserver/re_cache.h
+++ b/src/libserver/re_cache.h
@@ -48,8 +48,8 @@ enum rspamd_re_type {
};
struct rspamd_re_cache_stat {
- guint64 bytes_scanned;
- guint64 bytes_scanned_pcre;
+ uint64_t bytes_scanned;
+ uint64_t bytes_scanned_pcre;
guint regexp_checked;
guint regexp_matched;
guint regexp_total;
diff --git a/src/libserver/rspamd_control.h b/src/libserver/rspamd_control.h
index c3c861f8e..c9f608fe1 100644
--- a/src/libserver/rspamd_control.h
+++ b/src/libserver/rspamd_control.h
@@ -1,11 +1,11 @@
-/*-
- * Copyright 2016 Vsevolod Stakhov
+/*
+ * Copyright 2024 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,
@@ -55,7 +55,7 @@ enum rspamd_srv_type {
enum rspamd_log_pipe_type {
RSPAMD_LOG_PIPE_SYMBOLS = 0,
};
-#define CONTROL_PATHLEN MIN(PATH_MAX, PIPE_BUF - sizeof(int) * 2 - sizeof(gint64) * 2)
+#define CONTROL_PATHLEN MIN(PATH_MAX, PIPE_BUF - sizeof(int) * 2 - sizeof(int64_t) * 2)
struct rspamd_control_command {
enum rspamd_control_type type;
union {
@@ -154,7 +154,7 @@ struct rspamd_control_reply {
struct rspamd_srv_command {
enum rspamd_srv_type type;
- guint64 id;
+ uint64_t id;
union {
struct {
gint af;
@@ -206,7 +206,7 @@ struct rspamd_srv_command {
struct rspamd_srv_reply {
enum rspamd_srv_type type;
- guint64 id;
+ uint64_t id;
union {
struct {
gint code;
diff --git a/src/libserver/rspamd_symcache.h b/src/libserver/rspamd_symcache.h
index 2c67cba0d..8ad3e34a2 100644
--- a/src/libserver/rspamd_symcache.h
+++ b/src/libserver/rspamd_symcache.h
@@ -66,7 +66,7 @@ enum rspamd_symbol_type {
* Abstract structure for saving callback data for symbols
*/
struct rspamd_abstract_callback_data {
- guint64 magic;
+ uint64_t magic;
char data[];
};
@@ -78,7 +78,7 @@ struct rspamd_symcache_item_stat {
gdouble avg_time;
gdouble weight;
guint hits;
- guint64 total_hits;
+ uint64_t total_hits;
struct rspamd_counter_data frequency_counter;
gdouble avg_frequency;
gdouble stddev_frequency;
@@ -297,7 +297,7 @@ gboolean rspamd_symcache_is_checked(struct rspamd_task *task,
* @param cache
* @return
*/
-guint64 rspamd_symcache_get_cksum(struct rspamd_symcache *cache);
+uint64_t rspamd_symcache_get_cksum(struct rspamd_symcache *cache);
/**
* Checks if a symbols is enabled (not checked and conditions return true if present)
@@ -452,7 +452,7 @@ void rspamd_symcache_composites_foreach(struct rspamd_task *task,
*/
bool rspamd_symcache_set_allowed_settings_ids(struct rspamd_symcache *cache,
const gchar *symbol,
- const guint32 *ids,
+ const uint32_t *ids,
guint nids);
/**
* Sets denied settings ids for a symbol
@@ -463,7 +463,7 @@ bool rspamd_symcache_set_allowed_settings_ids(struct rspamd_symcache *cache,
*/
bool rspamd_symcache_set_forbidden_settings_ids(struct rspamd_symcache *cache,
const gchar *symbol,
- const guint32 *ids,
+ const uint32_t *ids,
guint nids);
/**
@@ -473,9 +473,9 @@ bool rspamd_symcache_set_forbidden_settings_ids(struct rspamd_symcache *cache,
* @param nids
* @return
*/
-const guint32 *rspamd_symcache_get_allowed_settings_ids(struct rspamd_symcache *cache,
- const gchar *symbol,
- guint *nids);
+const uint32_t *rspamd_symcache_get_allowed_settings_ids(struct rspamd_symcache *cache,
+ const gchar *symbol,
+ guint *nids);
/**
* Returns denied ids for a symbol as a constant array
@@ -484,9 +484,9 @@ const guint32 *rspamd_symcache_get_allowed_settings_ids(struct rspamd_symcache *
* @param nids
* @return
*/
-const guint32 *rspamd_symcache_get_forbidden_settings_ids(struct rspamd_symcache *cache,
- const gchar *symbol,
- guint *nids);
+const uint32_t *rspamd_symcache_get_forbidden_settings_ids(struct rspamd_symcache *cache,
+ const gchar *symbol,
+ guint *nids);
/**
diff --git a/src/libserver/spf.c b/src/libserver/spf.c
index 72d8b99b2..5f8fc14ba 100644
--- a/src/libserver/spf.c
+++ b/src/libserver/spf.c
@@ -1,11 +1,11 @@
-/*-
- * Copyright 2016 Vsevolod Stakhov
+/*
+ * Copyright 2024 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,
@@ -181,7 +181,7 @@ spf_record_cached_unref_dtor(gpointer p)
void spf_library_config(const ucl_object_t *obj)
{
const ucl_object_t *value;
- gint64 ival;
+ int64_t ival;
bool bval;
if (obj == NULL) {
@@ -569,14 +569,14 @@ rspamd_spf_record_postprocess(struct spf_resolved *rec, struct rspamd_task *task
struct spf_addr *cur_addr = &g_array_index(rec->elts, struct spf_addr, i);
if (cur_addr->flags & RSPAMD_SPF_FLAG_IPV6) {
- guint64 t[3];
+ uint64_t t[3];
/*
* Fill hash entry for ipv6 addr with 2 int64 from ipv6 address,
* the remaining int64 has mech + mask
*/
- memcpy(t, cur_addr->addr6, sizeof(guint64) * 2);
- t[2] = ((guint64) (cur_addr->mech)) << 48u;
+ memcpy(t, cur_addr->addr6, sizeof(uint64_t) * 2);
+ t[2] = ((uint64_t) (cur_addr->mech)) << 48u;
t[2] |= cur_addr->m.dual.mask_v6;
for (guint j = 0; j < G_N_ELEMENTS(t); j++) {
@@ -584,11 +584,11 @@ rspamd_spf_record_postprocess(struct spf_resolved *rec, struct rspamd_task *task
}
}
else if (cur_addr->flags & RSPAMD_SPF_FLAG_IPV4) {
- guint64 t = 0;
+ uint64_t t = 0;
- memcpy(&t, cur_addr->addr4, sizeof(guint32));
- t |= ((guint64) (cur_addr->mech)) << 48u;
- t |= ((guint64) cur_addr->m.dual.mask_v4) << 32u;
+ memcpy(&t, cur_addr->addr4, sizeof(uint32_t));
+ t |= ((uint64_t) (cur_addr->mech)) << 48u;
+ t |= ((uint64_t) cur_addr->m.dual.mask_v4) << 32u;
rec->digest = mum_hash_step(rec->digest, t);
}
@@ -1433,8 +1433,8 @@ parse_spf_ip4(struct spf_record *rec, struct spf_addr *addr)
const gchar *semicolon, *slash;
gsize len;
gchar ipbuf[INET_ADDRSTRLEN + 1];
- guint32 mask;
- static const guint32 min_valid_mask = 8;
+ uint32_t mask;
+ static const uint32_t min_valid_mask = 8;
semicolon = strchr(addr->spf_string, ':');
@@ -1509,8 +1509,8 @@ parse_spf_ip6(struct spf_record *rec, struct spf_addr *addr)
const gchar *semicolon, *slash;
gsize len;
gchar ipbuf[INET6_ADDRSTRLEN + 1];
- guint32 mask;
- static const guint32 min_valid_mask = 8;
+ uint32_t mask;
+ static const uint32_t min_valid_mask = 8;
semicolon = strchr(addr->spf_string, ':');
diff --git a/src/libserver/spf.h b/src/libserver/spf.h
index 871ed2978..07bb05b1a 100644
--- a/src/libserver/spf.h
+++ b/src/libserver/spf.h
@@ -75,7 +75,7 @@ struct spf_addr {
guint16 mask_v4;
guint16 mask_v6;
} dual;
- guint32 idx;
+ uint32_t idx;
} m;
guint flags;
spf_mech_t mech;
@@ -96,7 +96,7 @@ struct spf_resolved {
guint ttl;
gint flags;
gdouble timestamp;
- guint64 digest;
+ uint64_t digest;
GArray *elts; /* Flat list of struct spf_addr */
ref_entry_t ref; /* Refcounting */
};
diff --git a/src/libserver/symcache/symcache_c.cxx b/src/libserver/symcache/symcache_c.cxx
index 6a7e41cc9..5a5e60c95 100644
--- a/src/libserver/symcache/symcache_c.cxx
+++ b/src/libserver/symcache/symcache_c.cxx
@@ -181,7 +181,7 @@ guint rspamd_symcache_stats_symbols_count(struct rspamd_symcache *cache)
return real_cache->get_stats_symbols_count();
}
-guint64
+uint64_t
rspamd_symcache_get_cksum(struct rspamd_symcache *cache)
{
auto *real_cache = C_API_SYMCACHE(cache);
@@ -362,7 +362,7 @@ void rspamd_symcache_process_settings_elt(struct rspamd_symcache *cache,
bool rspamd_symcache_set_allowed_settings_ids(struct rspamd_symcache *cache,
const gchar *symbol,
- const guint32 *ids,
+ const uint32_t *ids,
guint nids)
{
auto *real_cache = C_API_SYMCACHE(cache);
@@ -379,7 +379,7 @@ bool rspamd_symcache_set_allowed_settings_ids(struct rspamd_symcache *cache,
bool rspamd_symcache_set_forbidden_settings_ids(struct rspamd_symcache *cache,
const gchar *symbol,
- const guint32 *ids,
+ const uint32_t *ids,
guint nids)
{
auto *real_cache = C_API_SYMCACHE(cache);
@@ -394,7 +394,7 @@ bool rspamd_symcache_set_forbidden_settings_ids(struct rspamd_symcache *cache,
return true;
}
-const guint32 *
+const uint32_t *
rspamd_symcache_get_allowed_settings_ids(struct rspamd_symcache *cache,
const gchar *symbol,
guint *nids)
@@ -405,7 +405,7 @@ rspamd_symcache_get_allowed_settings_ids(struct rspamd_symcache *cache,
return item->allowed_ids.get_ids(*nids);
}
-const guint32 *
+const uint32_t *
rspamd_symcache_get_forbidden_settings_ids(struct rspamd_symcache *cache,
const gchar *symbol,
guint *nids)
diff --git a/src/libserver/symcache/symcache_impl.cxx b/src/libserver/symcache/symcache_impl.cxx
index 63ac4a58e..b4236c978 100644
--- a/src/libserver/symcache/symcache_impl.cxx
+++ b/src/libserver/symcache/symcache_impl.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright 2023 Vsevolod Stakhov
+ * Copyright 2024 Vsevolod Stakhov
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -856,7 +856,7 @@ auto symcache::validate(bool strict) -> bool
for (auto &pair: items_by_symbol) {
auto &item = pair.second;
- auto ghost = item->st->weight == 0 ? true : false;
+ auto ghost = item->st->weight == 0;
auto skipped = !ghost;
if (item->is_scoreable() && g_hash_table_lookup(cfg->symbols, item->symbol.c_str()) == nullptr) {
diff --git a/src/libserver/task.h b/src/libserver/task.h
index 5404a1128..8d4fa1b23 100644
--- a/src/libserver/task.h
+++ b/src/libserver/task.h
@@ -171,10 +171,10 @@ struct rspamd_task {
struct rspamd_worker *worker; /**< pointer to worker object */
enum rspamd_command cmd; /**< command */
gint sock; /**< socket descriptor */
- guint32 dns_requests; /**< number of DNS requests per this task */
- guint32 flags; /**< Bit flags */
- guint32 protocol_flags;
- guint32 processed_stages; /**< bits of stages that are processed */
+ uint32_t dns_requests; /**< number of DNS requests per this task */
+ uint32_t flags; /**< Bit flags */
+ uint32_t protocol_flags;
+ uint32_t processed_stages; /**< bits of stages that are processed */
gchar *helo; /**< helo header value */
gchar *queue_id; /**< queue id if specified */
rspamd_inet_addr_t *from_addr; /**< from addr for a task */
diff --git a/src/libserver/url.c b/src/libserver/url.c
index ff75e3c76..cf140f507 100644
--- a/src/libserver/url.c
+++ b/src/libserver/url.c
@@ -1802,7 +1802,7 @@ rspamd_url_maybe_regenerate_from_ip(struct rspamd_url *uri, rspamd_mempool_t *po
struct in_addr in4;
struct in6_addr in6;
gboolean ret = FALSE, check_num = TRUE;
- guint32 n, dots, t = 0, i = 0, shift, nshift;
+ uint32_t n, dots, t = 0, i = 0, shift, nshift;
p = rspamd_url_host_unsafe(uri);
end = p + uri->hostlen;
@@ -2360,7 +2360,7 @@ rspamd_url_parse(struct rspamd_url *uri,
}
UChar *utf16_hostname, *norm_utf16;
- gint32 utf16_len, norm_utf16_len, norm_utf8_len;
+ int32_t utf16_len, norm_utf16_len, norm_utf8_len;
UParseError parse_error;
utf16_hostname = rspamd_mempool_alloc(pool, uri->hostlen * sizeof(UChar));
diff --git a/src/libserver/worker_util.c b/src/libserver/worker_util.c
index 74a3cf887..b8ded1b95 100644
--- a/src/libserver/worker_util.c
+++ b/src/libserver/worker_util.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2023 Vsevolod Stakhov
+ * Copyright 2024 Vsevolod Stakhov
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -726,8 +726,8 @@ rspamd_worker_set_limits(struct rspamd_main *rspamd_main,
}
else {
msg_info_main("set max file descriptors limit: %HL cur and %HL max",
- (guint64) rlmt.rlim_cur,
- (guint64) rlmt.rlim_max);
+ (uint64_t) rlmt.rlim_cur,
+ (uint64_t) rlmt.rlim_max);
}
}
else {
@@ -739,8 +739,8 @@ rspamd_worker_set_limits(struct rspamd_main *rspamd_main,
}
else {
msg_info_main("use system max file descriptors limit: %HL cur and %HL max",
- (guint64) rlmt.rlim_cur,
- (guint64) rlmt.rlim_max);
+ (uint64_t) rlmt.rlim_cur,
+ (uint64_t) rlmt.rlim_max);
}
}
@@ -780,13 +780,13 @@ rspamd_worker_set_limits(struct rspamd_main *rspamd_main,
"%HL was wanted, "
"but we have %HL cur and %HL max",
cf->rlimit_maxcore,
- (guint64) rlmt.rlim_cur,
- (guint64) rlmt.rlim_max);
+ (uint64_t) rlmt.rlim_cur,
+ (uint64_t) rlmt.rlim_max);
}
else {
msg_info_main("set max core size limit: %HL cur and %HL max",
- (guint64) rlmt.rlim_cur,
- (guint64) rlmt.rlim_max);
+ (uint64_t) rlmt.rlim_cur,
+ (uint64_t) rlmt.rlim_max);
}
}
}
@@ -799,8 +799,8 @@ rspamd_worker_set_limits(struct rspamd_main *rspamd_main,
}
else {
msg_info_main("use system max core size limit: %HL cur and %HL max",
- (guint64) rlmt.rlim_cur,
- (guint64) rlmt.rlim_max);
+ (uint64_t) rlmt.rlim_cur,
+ (uint64_t) rlmt.rlim_max);
}
}
}
@@ -1808,8 +1808,8 @@ rspamd_check_termination_clause(struct rspamd_main *rspamd_main,
WEXITSTATUS(res),
g_strsignal(WTERMSIG(res)),
wrk->cores_throttled ? "yes" : "no",
- (gint64) rlmt.rlim_cur,
- (gint64) rlmt.rlim_max);
+ (int64_t) rlmt.rlim_cur,
+ (int64_t) rlmt.rlim_max);
#else
msg_warn_main(
"%s process %P terminated abnormally with exit code %d by signal: %s"
@@ -1884,7 +1884,7 @@ rspamd_worker_hyperscan_ready(struct rspamd_main *rspamd_main,
#endif /* With Hyperscan */
gboolean
-rspamd_worker_check_context(gpointer ctx, guint64 magic)
+rspamd_worker_check_context(gpointer ctx, uint64_t magic)
{
struct rspamd_abstract_worker_ctx *actx = (struct rspamd_abstract_worker_ctx *) ctx;
diff --git a/src/libserver/worker_util.h b/src/libserver/worker_util.h
index ef48188ac..6e3a3ddfd 100644
--- a/src/libserver/worker_util.h
+++ b/src/libserver/worker_util.h
@@ -65,7 +65,7 @@ rspamd_prepare_worker(struct rspamd_worker *worker, const char *name,
* @param magic
* @return
*/
-gboolean rspamd_worker_check_context(gpointer ctx, guint64 magic);
+gboolean rspamd_worker_check_context(gpointer ctx, uint64_t magic);
/**
* Set special signal handler for a worker