mirror of
https://github.com/weechat/weechat.git
synced 2026-07-07 18:23:13 +02:00
core, plugins: add missing parentheses when dereferencing a pointer with an array index
This commit is contained in:
@@ -568,7 +568,7 @@ buflist_bar_item_buflist_cb (const void *pointer, void *data,
|
||||
str_hotlist_count);
|
||||
if (count > 0)
|
||||
{
|
||||
if (*hotlist[0])
|
||||
if ((*hotlist)[0])
|
||||
{
|
||||
weechat_string_dyn_concat (
|
||||
hotlist,
|
||||
@@ -644,7 +644,7 @@ buflist_bar_item_buflist_cb (const void *pointer, void *data,
|
||||
|
||||
/* add newline between each buffer (if needed) */
|
||||
if (weechat_config_boolean (buflist_config_look_add_newline)
|
||||
&& *buflist[0])
|
||||
&& (*buflist)[0])
|
||||
{
|
||||
if (!weechat_string_dyn_concat (buflist, "\n", -1))
|
||||
goto error;
|
||||
|
||||
@@ -122,7 +122,7 @@ weechat_guile_output_flush ()
|
||||
char *temp_buffer, *command;
|
||||
int length;
|
||||
|
||||
if (!*guile_buffer_output[0])
|
||||
if (!(*guile_buffer_output)[0])
|
||||
return;
|
||||
|
||||
/* if there's no buffer, we catch the output, so there's no flush */
|
||||
|
||||
@@ -418,7 +418,7 @@ irc_batch_process_multiline (struct t_irc_server *server,
|
||||
if (tags && tags[0])
|
||||
irc_tag_parse (tags, hash_tags, NULL);
|
||||
}
|
||||
if (*result[0])
|
||||
if ((*result)[0])
|
||||
{
|
||||
if (!hash_tags
|
||||
|| !weechat_hashtable_has_key (hash_tags,
|
||||
|
||||
@@ -265,7 +265,7 @@ irc_command_mode_masks_convert_ranges (char **argv, int arg_start)
|
||||
{
|
||||
for (j = number1; j <= number2; j++)
|
||||
{
|
||||
if (*str_masks[0])
|
||||
if ((*str_masks)[0])
|
||||
weechat_string_dyn_concat (str_masks, " ", -1);
|
||||
snprintf (str_number, sizeof (str_number),
|
||||
"%ld", j);
|
||||
@@ -278,7 +278,7 @@ irc_command_mode_masks_convert_ranges (char **argv, int arg_start)
|
||||
|
||||
if (!added)
|
||||
{
|
||||
if (*str_masks[0])
|
||||
if ((*str_masks)[0])
|
||||
weechat_string_dyn_concat (str_masks, " ", -1);
|
||||
weechat_string_dyn_concat (str_masks, argv[i], -1);
|
||||
}
|
||||
@@ -392,7 +392,7 @@ irc_command_mode_masks (struct t_irc_server *server,
|
||||
* if we reached the max number of modes allowed, send the MODE
|
||||
* command now and flush the modes/masks strings
|
||||
*/
|
||||
if (*modes[0] && (modes_added == max_modes))
|
||||
if ((*modes)[0] && (modes_added == max_modes))
|
||||
{
|
||||
irc_server_sendf (server, msg_priority, NULL,
|
||||
"MODE %s %s%s %s",
|
||||
@@ -408,7 +408,7 @@ irc_command_mode_masks (struct t_irc_server *server,
|
||||
|
||||
/* add one mode letter (after +/-) and add the mask in masks */
|
||||
weechat_string_dyn_concat (modes, mode, -1);
|
||||
if (*masks[0])
|
||||
if ((*masks)[0])
|
||||
weechat_string_dyn_concat (masks, " ", -1);
|
||||
weechat_string_dyn_concat (masks, (mask) ? mask : argv[pos_masks], -1);
|
||||
modes_added++;
|
||||
@@ -417,7 +417,7 @@ irc_command_mode_masks (struct t_irc_server *server,
|
||||
}
|
||||
|
||||
/* send a final MODE command if some masks are remaining */
|
||||
if (*modes[0] && *masks[0])
|
||||
if ((*modes)[0] && (*masks)[0])
|
||||
{
|
||||
irc_server_sendf (server, msg_priority, NULL,
|
||||
"MODE %s %s%s %s",
|
||||
|
||||
@@ -602,7 +602,7 @@ irc_ctcp_get_supported_ctcp (struct t_irc_server *server)
|
||||
(const char *)weechat_arraylist_get (list_ctcp, i));
|
||||
if (ctcp_upper)
|
||||
{
|
||||
if (*result[0])
|
||||
if ((*result)[0])
|
||||
weechat_string_dyn_concat (result, " ", -1);
|
||||
weechat_string_dyn_concat (result, ctcp_upper, -1);
|
||||
free (ctcp_upper);
|
||||
|
||||
@@ -413,18 +413,18 @@ irc_join_build_string (struct t_arraylist *arraylist)
|
||||
{
|
||||
ptr_join_chan = (struct t_irc_join_channel *)weechat_arraylist_get (
|
||||
arraylist, i);
|
||||
if (*channels[0])
|
||||
if ((*channels)[0])
|
||||
weechat_string_dyn_concat (channels, ",", -1);
|
||||
weechat_string_dyn_concat (channels, ptr_join_chan->name, -1);
|
||||
if (ptr_join_chan->key)
|
||||
{
|
||||
if (*keys[0])
|
||||
if ((*keys)[0])
|
||||
weechat_string_dyn_concat (keys, ",", -1);
|
||||
weechat_string_dyn_concat (keys, ptr_join_chan->key, -1);
|
||||
}
|
||||
}
|
||||
|
||||
if (*keys[0])
|
||||
if ((*keys)[0])
|
||||
{
|
||||
weechat_string_dyn_concat (channels, " ", -1);
|
||||
weechat_string_dyn_concat (channels, *keys, -1);
|
||||
|
||||
@@ -82,7 +82,7 @@ irc_message_parse_params (const char *parameters,
|
||||
*params = malloc ((alloc_params + 1) * sizeof ((*params)[0]));
|
||||
if (!*params)
|
||||
return;
|
||||
*params[0] = NULL;
|
||||
(*params)[0] = NULL;
|
||||
}
|
||||
|
||||
ptr_params = parameters;
|
||||
|
||||
@@ -181,7 +181,7 @@ irc_protocol_tags_add_cb (void *data,
|
||||
|
||||
str_tags = (char **)data;
|
||||
|
||||
if (*str_tags[0])
|
||||
if ((*str_tags)[0])
|
||||
weechat_string_dyn_concat (str_tags, ",", -1);
|
||||
|
||||
weechat_string_dyn_concat (str_tags, "irc_tag_", -1);
|
||||
@@ -274,7 +274,7 @@ irc_protocol_tags (struct t_irc_protocol_ctxt *ctxt, const char *extra_tags)
|
||||
ptr_batch = irc_batch_search (ctxt->server, ptr_tag_batch);
|
||||
if (ptr_batch)
|
||||
{
|
||||
if (*str_irc_tags[0])
|
||||
if ((*str_irc_tags)[0])
|
||||
weechat_string_dyn_concat (str_irc_tags, ",", -1);
|
||||
weechat_string_dyn_concat (str_irc_tags,
|
||||
"irc_batch_type_", -1);
|
||||
@@ -301,8 +301,8 @@ irc_protocol_tags (struct t_irc_protocol_ctxt *ctxt, const char *extra_tags)
|
||||
(ctxt->command && ctxt->command[0]) ? ctxt->command : "",
|
||||
(is_numeric) ? "," : "",
|
||||
(is_numeric) ? "irc_numeric" : "",
|
||||
(str_irc_tags && *str_irc_tags[0]) ? "," : "",
|
||||
(str_irc_tags && *str_irc_tags[0]) ? *str_irc_tags : "",
|
||||
(str_irc_tags && (*str_irc_tags)[0]) ? "," : "",
|
||||
(str_irc_tags && (*str_irc_tags)[0]) ? *str_irc_tags : "",
|
||||
(extra_tags && extra_tags[0]) ? "," : "",
|
||||
(extra_tags && extra_tags[0]) ? extra_tags : "",
|
||||
(ctxt->ignore_tag) ? ",irc_ignored" : "",
|
||||
@@ -717,7 +717,7 @@ irc_protocol_cap_print_cb (void *data,
|
||||
|
||||
str_caps = (char **)data;
|
||||
|
||||
if (*str_caps[0])
|
||||
if ((*str_caps)[0])
|
||||
weechat_string_dyn_concat (str_caps, " ", -1);
|
||||
weechat_string_dyn_concat (str_caps, key, -1);
|
||||
if (value)
|
||||
@@ -767,7 +767,7 @@ irc_protocol_cap_to_enable (const char *capabilities, int sasl_requested)
|
||||
",");
|
||||
if (supported_caps)
|
||||
{
|
||||
if (*str_caps[0])
|
||||
if ((*str_caps)[0])
|
||||
weechat_string_dyn_concat (str_caps, ",", -1);
|
||||
weechat_string_dyn_concat (str_caps, supported_caps, -1);
|
||||
free (supported_caps);
|
||||
@@ -775,7 +775,7 @@ irc_protocol_cap_to_enable (const char *capabilities, int sasl_requested)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (*str_caps[0])
|
||||
if ((*str_caps)[0])
|
||||
weechat_string_dyn_concat (str_caps, ",", -1);
|
||||
weechat_string_dyn_concat (str_caps, caps[i], -1);
|
||||
}
|
||||
@@ -786,7 +786,7 @@ irc_protocol_cap_to_enable (const char *capabilities, int sasl_requested)
|
||||
|
||||
if (sasl_requested)
|
||||
{
|
||||
if (*str_caps[0])
|
||||
if ((*str_caps)[0])
|
||||
weechat_string_dyn_concat (str_caps, ",", -1);
|
||||
weechat_string_dyn_concat (str_caps, "sasl", -1);
|
||||
}
|
||||
@@ -897,7 +897,7 @@ irc_protocol_cap_sync (struct t_irc_server *server, int sasl)
|
||||
{
|
||||
if (sasl && strcmp (caps_server[i], "sasl") == 0)
|
||||
sasl_to_do = 1;
|
||||
if (*cap_req[0])
|
||||
if ((*cap_req)[0])
|
||||
weechat_string_dyn_concat (cap_req, " ", -1);
|
||||
weechat_string_dyn_concat (cap_req, caps_server[i], -1);
|
||||
}
|
||||
@@ -1165,7 +1165,7 @@ IRC_PROTOCOL_CALLBACK(cap)
|
||||
{
|
||||
if (caps_supported[j][0] == '-')
|
||||
{
|
||||
if (*str_caps_disabled[0])
|
||||
if ((*str_caps_disabled)[0])
|
||||
weechat_string_dyn_concat (str_caps_disabled, " ", -1);
|
||||
weechat_string_dyn_concat (str_caps_disabled,
|
||||
caps_supported[j] + 1,
|
||||
@@ -1177,7 +1177,7 @@ IRC_PROTOCOL_CALLBACK(cap)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (*str_caps_enabled[0])
|
||||
if ((*str_caps_enabled)[0])
|
||||
weechat_string_dyn_concat (str_caps_enabled, " ", -1);
|
||||
weechat_string_dyn_concat (str_caps_enabled,
|
||||
caps_supported[j],
|
||||
@@ -1192,7 +1192,7 @@ IRC_PROTOCOL_CALLBACK(cap)
|
||||
}
|
||||
weechat_string_free_split (caps_supported);
|
||||
}
|
||||
if (*str_caps_enabled[0] && *str_caps_disabled[0])
|
||||
if ((*str_caps_enabled)[0] && (*str_caps_disabled)[0])
|
||||
{
|
||||
weechat_printf_datetime_tags (
|
||||
ctxt->server->buffer,
|
||||
@@ -1203,7 +1203,7 @@ IRC_PROTOCOL_CALLBACK(cap)
|
||||
weechat_prefix ("network"), IRC_PLUGIN_NAME,
|
||||
*str_caps_enabled, *str_caps_disabled);
|
||||
}
|
||||
else if (*str_caps_enabled[0])
|
||||
else if ((*str_caps_enabled)[0])
|
||||
{
|
||||
weechat_printf_datetime_tags (
|
||||
ctxt->server->buffer,
|
||||
@@ -1214,7 +1214,7 @@ IRC_PROTOCOL_CALLBACK(cap)
|
||||
weechat_prefix ("network"), IRC_PLUGIN_NAME,
|
||||
*str_caps_enabled);
|
||||
}
|
||||
else if (*str_caps_disabled[0])
|
||||
else if ((*str_caps_disabled)[0])
|
||||
{
|
||||
weechat_printf_datetime_tags (
|
||||
ctxt->server->buffer,
|
||||
@@ -6208,7 +6208,7 @@ IRC_PROTOCOL_CALLBACK(353)
|
||||
}
|
||||
else if (!ptr_channel && str_nicks)
|
||||
{
|
||||
if (*str_nicks[0])
|
||||
if ((*str_nicks)[0])
|
||||
{
|
||||
weechat_string_dyn_concat (str_nicks, IRC_COLOR_RESET, -1);
|
||||
weechat_string_dyn_concat (str_nicks, " ", -1);
|
||||
@@ -6473,7 +6473,7 @@ irc_protocol_get_string_channel_nicks (struct t_irc_server *server,
|
||||
if (!filter_ok)
|
||||
continue;
|
||||
|
||||
if (*str_nicks[0])
|
||||
if ((*str_nicks)[0])
|
||||
{
|
||||
weechat_string_dyn_concat (str_nicks,
|
||||
IRC_COLOR_RESET,
|
||||
@@ -6608,7 +6608,7 @@ irc_protocol_get_string_channel_nicks_count (struct t_irc_server *server,
|
||||
snprintf (str_mode_name, sizeof (str_mode_name),
|
||||
"+%c", ptr_prefix_modes[i]);
|
||||
}
|
||||
if (*str_counts[0])
|
||||
if ((*str_counts)[0])
|
||||
weechat_string_dyn_concat (str_counts, ", ", -1);
|
||||
weechat_string_dyn_concat (str_counts, str_count, -1);
|
||||
weechat_string_dyn_concat (str_counts, str_mode_name, -1);
|
||||
|
||||
@@ -6067,19 +6067,19 @@ irc_server_build_autojoin (struct t_irc_server *server)
|
||||
if (ptr_channel->key)
|
||||
{
|
||||
/* add channel with key and the key */
|
||||
if (*channels_with_key[0])
|
||||
if ((*channels_with_key)[0])
|
||||
weechat_string_dyn_concat (channels_with_key, ",", -1);
|
||||
weechat_string_dyn_concat (channels_with_key,
|
||||
ptr_channel->name,
|
||||
-1);
|
||||
if (*keys[0])
|
||||
if ((*keys)[0])
|
||||
weechat_string_dyn_concat (keys, ",", -1);
|
||||
weechat_string_dyn_concat (keys, ptr_channel->key, -1);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* add channel without key */
|
||||
if (*channels_others[0])
|
||||
if ((*channels_others)[0])
|
||||
weechat_string_dyn_concat (channels_others, ",", -1);
|
||||
weechat_string_dyn_concat (channels_others,
|
||||
ptr_channel->name,
|
||||
@@ -6096,13 +6096,13 @@ irc_server_build_autojoin (struct t_irc_server *server)
|
||||
* concatenate channels_with_key + channels_others + keys
|
||||
* into channels_with_key
|
||||
*/
|
||||
if (*channels_others[0])
|
||||
if ((*channels_others)[0])
|
||||
{
|
||||
if (*channels_with_key[0])
|
||||
if ((*channels_with_key)[0])
|
||||
weechat_string_dyn_concat (channels_with_key, ",", -1);
|
||||
weechat_string_dyn_concat (channels_with_key, *channels_others, -1);
|
||||
}
|
||||
if (*keys[0])
|
||||
if ((*keys)[0])
|
||||
{
|
||||
weechat_string_dyn_concat (channels_with_key, " ", -1);
|
||||
weechat_string_dyn_concat (channels_with_key, *keys, -1);
|
||||
|
||||
@@ -301,7 +301,7 @@ irc_tag_add_to_string_cb (void *data,
|
||||
|
||||
string = (char **)data;
|
||||
|
||||
if (*string[0])
|
||||
if ((*string)[0])
|
||||
weechat_string_dyn_concat (string, ";", -1);
|
||||
|
||||
weechat_string_dyn_concat (string, key, -1);
|
||||
|
||||
@@ -192,7 +192,7 @@ weechat_lua_output_flush ()
|
||||
char *temp_buffer, *command;
|
||||
int length;
|
||||
|
||||
if (!*lua_buffer_output[0])
|
||||
if (!(*lua_buffer_output)[0])
|
||||
return;
|
||||
|
||||
/* if there's no buffer, we catch the output, so there's no flush */
|
||||
|
||||
@@ -229,7 +229,7 @@ weechat_perl_output_flush ()
|
||||
char *temp_buffer, *command;
|
||||
int length;
|
||||
|
||||
if (!*perl_buffer_output[0])
|
||||
if (!(*perl_buffer_output)[0])
|
||||
return;
|
||||
|
||||
/* if there's no buffer, we catch the output, so there's no flush */
|
||||
|
||||
@@ -292,7 +292,7 @@ weechat_python_output_flush ()
|
||||
char *temp_buffer, *command;
|
||||
int length;
|
||||
|
||||
if (!*python_buffer_output[0])
|
||||
if (!(*python_buffer_output)[0])
|
||||
return;
|
||||
|
||||
/* if there's no buffer, we catch the output, so there's no flush */
|
||||
|
||||
@@ -156,7 +156,7 @@ relay_remote_build_string_tags (cJSON *json_tags, int line_id, int highlight)
|
||||
ptr_tag = cJSON_GetStringValue (json_tag);
|
||||
if (ptr_tag)
|
||||
{
|
||||
if (*tags[0])
|
||||
if ((*tags)[0])
|
||||
weechat_string_dyn_concat (tags, ",", -1);
|
||||
if (highlight && (strncmp (ptr_tag, "notify_", 7) == 0))
|
||||
{
|
||||
@@ -177,14 +177,14 @@ relay_remote_build_string_tags (cJSON *json_tags, int line_id, int highlight)
|
||||
*/
|
||||
if (highlight && !tag_notify_highlight)
|
||||
{
|
||||
if (*tags[0])
|
||||
if ((*tags)[0])
|
||||
weechat_string_dyn_concat (tags, ",", -1);
|
||||
weechat_string_dyn_concat (tags, "notify_highlight", -1);
|
||||
}
|
||||
|
||||
/* add tag with remote line id */
|
||||
snprintf (str_tag_id, sizeof (str_tag_id), "relay_remote_line_id_%d", line_id);
|
||||
if (*tags[0])
|
||||
if ((*tags)[0])
|
||||
weechat_string_dyn_concat (tags, ",", -1);
|
||||
weechat_string_dyn_concat (tags, str_tag_id, -1);
|
||||
|
||||
|
||||
@@ -354,7 +354,7 @@ weechat_ruby_output_flush ()
|
||||
char *temp_buffer, *command;
|
||||
int length;
|
||||
|
||||
if (!*ruby_buffer_output[0])
|
||||
if (!(*ruby_buffer_output)[0])
|
||||
return;
|
||||
|
||||
/* if there's no buffer, we catch the output, so there's no flush */
|
||||
|
||||
@@ -123,7 +123,7 @@ script_action_run_list_input (struct t_gui_buffer *buffer,
|
||||
ptr_script = weechat_hdata_get_list (hdata, "scripts");
|
||||
while (ptr_script)
|
||||
{
|
||||
if (*output[0])
|
||||
if ((*output)[0])
|
||||
{
|
||||
weechat_string_dyn_concat (output, ", ", -1);
|
||||
}
|
||||
@@ -152,7 +152,7 @@ script_action_run_list_input (struct t_gui_buffer *buffer,
|
||||
}
|
||||
}
|
||||
|
||||
if (!*output[0])
|
||||
if (!(*output)[0])
|
||||
{
|
||||
weechat_string_dyn_concat (
|
||||
output,
|
||||
@@ -1257,7 +1257,7 @@ script_action_add (struct t_gui_buffer *buffer, const char *action)
|
||||
return;
|
||||
}
|
||||
|
||||
if (*script_actions[0])
|
||||
if ((*script_actions)[0])
|
||||
weechat_string_dyn_concat (script_actions, "\n", -1);
|
||||
|
||||
weechat_string_dyn_concat (
|
||||
|
||||
@@ -54,7 +54,7 @@ typing_bar_item_nicks_map_cb (void *data,
|
||||
if ((ptr_typing_status->state == TYPING_STATUS_STATE_TYPING)
|
||||
|| (ptr_typing_status->state == TYPING_STATUS_STATE_PAUSED))
|
||||
{
|
||||
if (*str_nicks_typing[0])
|
||||
if ((*str_nicks_typing)[0])
|
||||
weechat_string_dyn_concat (str_nicks_typing, ", ", -1);
|
||||
if (ptr_typing_status->state == TYPING_STATUS_STATE_PAUSED)
|
||||
weechat_string_dyn_concat (str_nicks_typing, "(", -1);
|
||||
|
||||
Reference in New Issue
Block a user