mirror of
https://github.com/weechat/weechat.git
synced 2026-07-03 16:23:14 +02:00
relay: use "const char *" variables for result of string functions with const parameter
This commit is contained in:
@@ -202,9 +202,9 @@ void
|
||||
relay_irc_sendf (struct t_relay_client *client, const char *format, ...)
|
||||
{
|
||||
int number;
|
||||
char *pos, hash_key[32], *message, *new_msg1, *new_msg2;
|
||||
char *pos, hash_key[32], *message, *new_msg1, *new_msg2, *ptr_msg1, *ptr_msg2;
|
||||
char modifier_data[128];
|
||||
const char *str_message, *ptr_msg1, *ptr_msg2;
|
||||
const char *str_message;
|
||||
struct t_hashtable *hashtable_in, *hashtable_out;
|
||||
|
||||
if (!client || !format)
|
||||
@@ -234,7 +234,12 @@ relay_irc_sendf (struct t_relay_client *client, const char *format, ...)
|
||||
if (new_msg1 && !new_msg1[0])
|
||||
goto end;
|
||||
|
||||
ptr_msg1 = (new_msg1) ? new_msg1 : vbuffer;
|
||||
if (!new_msg1)
|
||||
new_msg1 = strdup (vbuffer);
|
||||
if (!new_msg1)
|
||||
goto end;
|
||||
|
||||
ptr_msg1 = new_msg1;
|
||||
|
||||
pos = strchr (ptr_msg1, '\r');
|
||||
if (pos)
|
||||
@@ -275,7 +280,11 @@ relay_irc_sendf (struct t_relay_client *client, const char *format, ...)
|
||||
/* message not dropped? */
|
||||
if (!new_msg2 || new_msg2[0])
|
||||
{
|
||||
ptr_msg2 = (new_msg2) ? new_msg2 : str_message;
|
||||
if (!new_msg2)
|
||||
new_msg2 = strdup (str_message);
|
||||
if (!new_msg2)
|
||||
break;
|
||||
ptr_msg2 = new_msg2;
|
||||
if (weechat_asprintf (&message, "%s\r\n", ptr_msg2) >= 0)
|
||||
{
|
||||
relay_client_send (client, RELAY_MSG_STANDARD,
|
||||
@@ -470,10 +479,9 @@ relay_irc_signal_irc_outtags_cb (const void *pointer, void *data,
|
||||
{
|
||||
struct t_relay_client *client;
|
||||
struct t_hashtable *hash_parsed;
|
||||
const char *irc_command, *irc_args, *host, *ptr_message;
|
||||
char *pos, *tags, *irc_channel, *message;
|
||||
const char *irc_command, *irc_args, *host, *ptr_message, *pos;
|
||||
char *pos_cr, *tags, *irc_channel, *message, str_infolist_args[256];
|
||||
struct t_infolist *infolist_nick;
|
||||
char str_infolist_args[256];
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
@@ -487,9 +495,9 @@ relay_irc_signal_irc_outtags_cb (const void *pointer, void *data,
|
||||
message = strdup ((char *)signal_data);
|
||||
if (!message)
|
||||
goto end;
|
||||
pos = strchr (message, '\r');
|
||||
if (pos)
|
||||
pos[0] = '\0';
|
||||
pos_cr = strchr (message, '\r');
|
||||
if (pos_cr)
|
||||
pos_cr[0] = '\0';
|
||||
|
||||
ptr_message = message;
|
||||
|
||||
@@ -1595,10 +1603,10 @@ relay_irc_recv (struct t_relay_client *client, const char *data)
|
||||
struct t_hashtable *hash_parsed, *hash_redirect;
|
||||
struct t_infolist *infolist_server;
|
||||
const char *irc_command, *str_num_params, *isupport, *pos_password;
|
||||
const char *ptr_data, *ptr_nick_modes;
|
||||
const char *ptr_data, *ptr_nick_modes, *pos;
|
||||
char str_time[128], str_signal[128], str_server_channel[256], *nick;
|
||||
char str_param[128], *str_args, *version, str_command[128], **params;
|
||||
char *pos, *password, *irc_is_channel, *info, *error, *str_cmd_lower;
|
||||
char *password, *irc_is_channel, *info, *error, *str_cmd_lower;
|
||||
char modifier_data[128], *new_data, *ctcp_type, *ctcp_params, *nick_modes;
|
||||
long num_params;
|
||||
int i, redirect_msg;
|
||||
|
||||
@@ -999,7 +999,8 @@ struct t_relay_remote *
|
||||
relay_config_get_remote_from_option_name (const char *name)
|
||||
{
|
||||
struct t_relay_remote *ptr_remote;
|
||||
char *pos_option, *remote_name;
|
||||
const char *pos_option;
|
||||
char *remote_name;
|
||||
|
||||
ptr_remote = NULL;
|
||||
|
||||
@@ -1244,7 +1245,8 @@ relay_config_remote_read_cb (const void *pointer, void *data,
|
||||
struct t_config_section *section,
|
||||
const char *option_name, const char *value)
|
||||
{
|
||||
char *pos_option, *remote_name;
|
||||
const char *pos_option;
|
||||
char *remote_name;
|
||||
struct t_relay_remote *ptr_temp_remote;
|
||||
int index_option;
|
||||
|
||||
|
||||
@@ -244,7 +244,8 @@ relay_http_parse_path (const char *path,
|
||||
char ***paths, int *num_paths,
|
||||
struct t_hashtable *params)
|
||||
{
|
||||
char *pos, *str_path, *str_params, **items_path, **items2_path;
|
||||
const char *pos;
|
||||
char *str_path, *str_params, **items_path, **items2_path;
|
||||
char **items_params, *name, *value;
|
||||
int i, num_items_path, num_items_params;
|
||||
|
||||
@@ -410,8 +411,8 @@ relay_http_parse_header (struct t_relay_http_request *request,
|
||||
const char *header,
|
||||
int ws_deflate_allowed)
|
||||
{
|
||||
char *pos, *name, *name_lower, *error, **items;
|
||||
const char *existing_value, *ptr_value;
|
||||
char *name, *name_lower, *error, **items;
|
||||
const char *pos, *existing_value, *ptr_value;
|
||||
int i, num_items;
|
||||
long number;
|
||||
|
||||
@@ -999,7 +1000,8 @@ relay_http_process_request (struct t_relay_client *client)
|
||||
void
|
||||
relay_http_recv (struct t_relay_client *client, const char *data, int size)
|
||||
{
|
||||
char *new_partial, *pos, **null_char;
|
||||
const void *null_char;
|
||||
char *new_partial, *pos;
|
||||
int length, ws_deflate_allowed;
|
||||
|
||||
null_char = memchr (data, 0, size);
|
||||
@@ -1564,8 +1566,8 @@ int
|
||||
relay_http_parse_response_header (struct t_relay_http_response *response,
|
||||
const char *header)
|
||||
{
|
||||
char *pos, *name, *name_lower, *error;
|
||||
const char *ptr_value;
|
||||
char *name, *name_lower, *error;
|
||||
const char *pos, *ptr_value;
|
||||
long number;
|
||||
|
||||
/* empty line => end of headers */
|
||||
|
||||
@@ -202,8 +202,8 @@ int
|
||||
relay_remote_parse_url (const char *url,
|
||||
int *tls, char **address, int *port)
|
||||
{
|
||||
const char *ptr_url;
|
||||
char *pos, *str_port, *error;
|
||||
const char *ptr_url, *pos;
|
||||
char *str_port, *error;
|
||||
long number;
|
||||
|
||||
if (tls)
|
||||
|
||||
@@ -79,7 +79,7 @@ relay_server_get_protocol_args (const char *protocol_and_args,
|
||||
char **protocol, char **protocol_args)
|
||||
{
|
||||
int opt_ipv4, opt_ipv6, opt_tls, opt_unix_socket;
|
||||
char *pos;
|
||||
const char *pos;
|
||||
|
||||
opt_ipv4 = -1;
|
||||
opt_ipv6 = -1;
|
||||
|
||||
@@ -586,9 +586,9 @@ relay_weechat_msg_add_hdata (struct t_relay_weechat_msg *msg,
|
||||
const char *path, const char *keys)
|
||||
{
|
||||
struct t_hdata *ptr_hdata_head, *ptr_hdata;
|
||||
char *hdata_head, *pos, **list_keys, *keys_types, **list_path;
|
||||
char *path_returned;
|
||||
const char *hdata_name, *array_size;
|
||||
char *hdata_head, **list_keys, *keys_types, **list_path;
|
||||
char *path_returned, *pos_paren;
|
||||
const char *hdata_name, *array_size, *pos;
|
||||
void *pointer, **path_pointers;
|
||||
unsigned long value;
|
||||
int rc, num_keys, num_path, i, type, pos_count, count, rc_sscanf;
|
||||
@@ -626,9 +626,9 @@ relay_weechat_msg_add_hdata (struct t_relay_weechat_msg *msg,
|
||||
|
||||
/* extract pointer from first path (direct pointer or list name) */
|
||||
pointer = NULL;
|
||||
pos = strchr (list_path[0], '(');
|
||||
if (pos)
|
||||
pos[0] = '\0';
|
||||
pos_paren = strchr (list_path[0], '(');
|
||||
if (pos_paren)
|
||||
pos_paren[0] = '\0';
|
||||
if (strncmp (list_path[0], "0x", 2) == 0)
|
||||
{
|
||||
rc_sscanf = sscanf (list_path[0], "%lx", &value);
|
||||
@@ -651,8 +651,8 @@ relay_weechat_msg_add_hdata (struct t_relay_weechat_msg *msg,
|
||||
}
|
||||
else
|
||||
pointer = weechat_hdata_get_list (ptr_hdata_head, list_path[0]);
|
||||
if (pos)
|
||||
pos[0] = '(';
|
||||
if (pos_paren)
|
||||
pos_paren[0] = '(';
|
||||
if (!pointer)
|
||||
goto end;
|
||||
|
||||
@@ -668,9 +668,9 @@ relay_weechat_msg_add_hdata (struct t_relay_weechat_msg *msg,
|
||||
strcpy (path_returned, hdata_head);
|
||||
for (i = 1; i < num_path; i++)
|
||||
{
|
||||
pos = strchr (list_path[i], '(');
|
||||
if (pos)
|
||||
pos[0] = '\0';
|
||||
pos_paren = strchr (list_path[i], '(');
|
||||
if (pos_paren)
|
||||
pos_paren[0] = '\0';
|
||||
hdata_name = weechat_hdata_get_var_hdata (ptr_hdata, list_path[i]);
|
||||
if (!hdata_name)
|
||||
goto end;
|
||||
@@ -679,8 +679,8 @@ relay_weechat_msg_add_hdata (struct t_relay_weechat_msg *msg,
|
||||
goto end;
|
||||
strcat (path_returned, "/");
|
||||
strcat (path_returned, hdata_name);
|
||||
if (pos)
|
||||
pos[0] = '(';
|
||||
if (pos_paren)
|
||||
pos_paren[0] = '(';
|
||||
}
|
||||
|
||||
/* split keys */
|
||||
|
||||
@@ -1740,8 +1740,8 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(quit)
|
||||
void
|
||||
relay_weechat_protocol_recv (struct t_relay_client *client, const char *data)
|
||||
{
|
||||
const char *ptr_data;
|
||||
char *data_unescaped, *pos, *id, *command, **argv, **argv_eol;
|
||||
const char *ptr_data, *pos;
|
||||
char *data_unescaped, *id, *command, **argv, **argv_eol;
|
||||
int i, argc, return_code;
|
||||
struct t_relay_weechat_protocol_cb protocol_cb[] =
|
||||
{ { "handshake", &relay_weechat_protocol_cb_handshake },
|
||||
|
||||
Reference in New Issue
Block a user