summaryrefslogtreecommitdiffstats
path: root/src/client
diff options
context:
space:
mode:
Diffstat (limited to 'src/client')
-rw-r--r--src/client/rspamc.cxx32
-rw-r--r--src/client/rspamdclient.c36
-rw-r--r--src/client/rspamdclient.h32
3 files changed, 50 insertions, 50 deletions
diff --git a/src/client/rspamc.cxx b/src/client/rspamc.cxx
index d1b6a8ed0..af3276ede 100644
--- a/src/client/rspamc.cxx
+++ b/src/client/rspamc.cxx
@@ -91,10 +91,10 @@ std::vector<GPid> children;
static GPatternSpec **exclude_compiled = nullptr;
static struct rspamd_http_context *http_ctx;
-static gint retcode = EXIT_SUCCESS;
+static int retcode = EXIT_SUCCESS;
-static gboolean rspamc_password_callback(const gchar *option_name,
- const gchar *value,
+static gboolean rspamc_password_callback(const char *option_name,
+ const char *value,
gpointer data,
GError **error);
@@ -496,8 +496,8 @@ auto sort_ucl_container_with_default(T &cont, const char *default_sort,
static gboolean
-rspamc_password_callback(const gchar *option_name,
- const gchar *value,
+rspamc_password_callback(const char *option_name,
+ const char *value,
gpointer data,
GError **error)
{
@@ -558,7 +558,7 @@ rspamc_password_callback(const gchar *option_name,
* Parse command line
*/
static void
-read_cmd_line(gint *argc, gchar ***argv)
+read_cmd_line(int *argc, char ***argv)
{
GError *error = nullptr;
GOptionContext *context;
@@ -672,7 +672,7 @@ check_rspamc_command(const char *cmd) -> std::optional<rspamc_command>
static void
print_commands_list()
{
- guint cmd_len = 0;
+ unsigned int cmd_len = 0;
rspamc_print(stdout, "Rspamc commands summary:\n");
@@ -1584,10 +1584,10 @@ rspamc_output_headers(FILE *out, struct rspamd_http_message *msg)
static void
rspamc_mime_output(FILE *out, ucl_object_t *result, GString *input,
- gdouble time, GError *err)
+ double time, GError *err)
{
- const gchar *action = "no action", *line_end = "\r\n", *p;
- gdouble score = 0.0, required_score = 0.0;
+ const char *action = "no action", *line_end = "\r\n", *p;
+ double score = 0.0, required_score = 0.0;
gboolean is_spam = FALSE;
auto nl_type = RSPAMD_TASK_NEWLINES_CRLF;
@@ -1748,10 +1748,10 @@ rspamc_mime_output(FILE *out, ucl_object_t *result, GString *input,
static void
rspamc_client_execute_cmd(const struct rspamc_command &cmd, ucl_object_t *result,
- GString *input, gdouble time, GError *err)
+ GString *input, double time, GError *err)
{
- gchar **eargv;
- gint eargc, infd, outfd, errfd;
+ char **eargv;
+ int eargc, infd, outfd, errfd;
GError *exec_err = nullptr;
GPid cld;
@@ -1814,13 +1814,13 @@ static void
rspamc_client_cb(struct rspamd_client_connection *conn,
struct rspamd_http_message *msg,
const char *name, ucl_object_t *result, GString *input,
- gpointer ud, gdouble start_time, gdouble send_time,
+ gpointer ud, double start_time, double send_time,
const char *body, gsize bodylen,
GError *err)
{
struct rspamc_callback_data *cbdata = (struct rspamc_callback_data *) ud;
FILE *out = stdout;
- gdouble finish = rspamd_get_ticks(FALSE), diff;
+ double finish = rspamd_get_ticks(FALSE), diff;
auto &cmd = cbdata->cmd;
@@ -1939,7 +1939,7 @@ rspamc_process_input(struct ev_loop *ev_base, const struct rspamc_command &cmd,
{
struct rspamd_client_connection *conn;
const char *p;
- guint16 port;
+ uint16_t port;
GError *err = nullptr;
std::string hostbuf;
diff --git a/src/client/rspamdclient.c b/src/client/rspamdclient.c
index e77f662eb..2b8d0e9bb 100644
--- a/src/client/rspamdclient.c
+++ b/src/client/rspamdclient.c
@@ -38,7 +38,7 @@ struct rspamd_client_request;
* Since rspamd uses untagged HTTP we can pass a single message per socket
*/
struct rspamd_client_connection {
- gint fd;
+ int fd;
GString *server_name;
struct rspamd_cryptobox_pubkey *key;
struct rspamd_cryptobox_keypair *keypair;
@@ -46,8 +46,8 @@ struct rspamd_client_connection {
ev_tstamp timeout;
struct rspamd_http_connection *http_conn;
gboolean req_sent;
- gdouble start_time;
- gdouble send_time;
+ double start_time;
+ double send_time;
struct rspamd_client_request *req;
struct rspamd_keypair_cache *keys_cache;
};
@@ -82,10 +82,10 @@ rspamd_client_request_free(struct rspamd_client_request *req)
}
}
-static gint
+static int
rspamd_client_body_handler(struct rspamd_http_connection *conn,
struct rspamd_http_message *msg,
- const gchar *chunk, gsize len)
+ const char *chunk, gsize len)
{
/* Do nothing here */
return 0;
@@ -104,7 +104,7 @@ rspamd_client_error_handler(struct rspamd_http_connection *conn, GError *err)
c->start_time, c->send_time, NULL, 0, err);
}
-static gint
+static int
rspamd_client_finish_handler(struct rspamd_http_connection *conn,
struct rspamd_http_message *msg)
{
@@ -114,8 +114,8 @@ rspamd_client_finish_handler(struct rspamd_http_connection *conn,
struct ucl_parser *parser;
GError *err;
const rspamd_ftok_t *tok;
- const gchar *start, *body = NULL;
- guchar *out = NULL;
+ const char *start, *body = NULL;
+ unsigned char *out = NULL;
gsize len, bodylen = 0;
c = req->conn;
@@ -134,7 +134,7 @@ rspamd_client_finish_handler(struct rspamd_http_connection *conn,
if (rspamd_http_message_get_body(msg, NULL) == NULL || msg->code / 100 != 2) {
err = g_error_new(RCLIENT_ERROR, msg->code, "HTTP error: %d, %.*s",
msg->code,
- (gint) msg->status->len, msg->status->str);
+ (int) msg->status->len, msg->status->str);
req->cb(c, msg, c->server_name->str, NULL, req->input, req->ud,
c->start_time, c->send_time, body, bodylen, err);
g_error_free(err);
@@ -263,11 +263,11 @@ end:
struct rspamd_client_connection *
rspamd_client_init(struct rspamd_http_context *http_ctx,
- struct ev_loop *ev_base, const gchar *name,
- guint16 port, gdouble timeout, const gchar *key)
+ struct ev_loop *ev_base, const char *name,
+ uint16_t port, double timeout, const char *key)
{
struct rspamd_client_connection *conn;
- gint fd;
+ int fd;
fd = rspamd_socket(name, port, SOCK_STREAM, TRUE, FALSE, TRUE);
@@ -321,21 +321,21 @@ rspamd_client_init(struct rspamd_http_context *http_ctx,
gboolean
rspamd_client_command(struct rspamd_client_connection *conn,
- const gchar *command, GQueue *attrs,
+ const char *command, GQueue *attrs,
FILE *in, rspamd_client_callback cb,
gpointer ud, gboolean compressed,
- const gchar *comp_dictionary,
- const gchar *filename,
+ const char *comp_dictionary,
+ const char *filename,
GError **err)
{
struct rspamd_client_request *req;
struct rspamd_http_client_header *nh;
- gchar *p;
+ char *p;
gsize remain, old_len;
GList *cur;
GString *input = NULL;
rspamd_fstring_t *body;
- guint dict_id = 0;
+ unsigned int dict_id = 0;
gsize dict_len = 0;
void *dict = NULL;
ZSTD_CCtx *zctx;
@@ -445,7 +445,7 @@ rspamd_client_command(struct rspamd_client_connection *conn,
rspamd_http_message_add_header(req->msg, COMPRESSION_HEADER, "zstd");
if (dict_id != 0) {
- gchar dict_str[32];
+ char dict_str[32];
rspamd_snprintf(dict_str, sizeof(dict_str), "%ud", dict_id);
rspamd_http_message_add_header(req->msg, "Dictionary", dict_str);
diff --git a/src/client/rspamdclient.h b/src/client/rspamdclient.h
index 27597dfb2..094676cfb 100644
--- a/src/client/rspamdclient.h
+++ b/src/client/rspamdclient.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,
@@ -28,8 +28,8 @@ struct rspamd_client_connection;
struct rspamd_http_message;
struct rspamd_http_client_header {
- gchar *name;
- gchar *value;
+ char *name;
+ char *value;
};
/**
@@ -43,13 +43,13 @@ struct rspamd_http_client_header {
typedef void (*rspamd_client_callback)(
struct rspamd_client_connection *conn,
struct rspamd_http_message *msg,
- const gchar *name,
+ const char *name,
ucl_object_t *result,
GString *input,
gpointer ud,
- gdouble start_time,
- gdouble send_time,
- const gchar *body,
+ double start_time,
+ double send_time,
+ const char *body,
gsize body_len,
GError *err);
@@ -66,10 +66,10 @@ struct rspamd_http_context;
struct rspamd_client_connection *rspamd_client_init(
struct rspamd_http_context *http_ctx,
struct ev_loop *ev_base,
- const gchar *name,
- guint16 port,
- gdouble timeout,
- const gchar *key);
+ const char *name,
+ uint16_t port,
+ double timeout,
+ const char *key);
/**
*
@@ -83,14 +83,14 @@ struct rspamd_client_connection *rspamd_client_init(
*/
gboolean rspamd_client_command(
struct rspamd_client_connection *conn,
- const gchar *command,
+ const char *command,
GQueue *attrs,
FILE *in,
rspamd_client_callback cb,
gpointer ud,
gboolean compressed,
- const gchar *comp_dictionary,
- const gchar *filename,
+ const char *comp_dictionary,
+ const char *filename,
GError **err);
/**