1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-12 14:14:48 +02:00

Compare commits

...

19 Commits

Author SHA1 Message Date
Sébastien Helleu 26da6bda4d Version 4.4.2 2024-09-08 11:49:21 +02:00
Sébastien Helleu 1abeb71603 core: update ChangeLog (issue #2178) 2024-09-07 10:54:01 +02:00
Sébastien Helleu 172d383fd1 trigger: fix integer overflow in loop (issue #2178) 2024-09-07 10:53:01 +02:00
Sébastien Helleu de30a87a21 relay: fix integer overflow in loops (issue #2178) 2024-09-07 10:52:59 +02:00
Sébastien Helleu 70cd508cf0 irc: fix integer overflow in loops (issue #2178) 2024-09-07 10:52:57 +02:00
Sébastien Helleu 0973fe0ad4 core: fix integer overflow in loops (issue #2178) 2024-09-07 10:52:54 +02:00
Yiheng Cao db65071db5 core: fix integer overflow in string_free_split functions (issue #2178) 2024-09-07 10:52:52 +02:00
Sébastien Helleu 90ba9264de tests: add tests on function string_rebuild_split_string with empty items 2024-09-07 10:52:48 +02:00
Sébastien Helleu 82a425d226 core, plugins: add missing parentheses when dereferencing a pointer with an array index 2024-09-07 10:52:39 +02:00
Sébastien Helleu af2b48c69e core: fix typo in French translation 2024-09-07 10:51:41 +02:00
Sébastien Helleu 8dfd54ae3d doc/faq: fix suggested value for option irc.server.xxx.tls_priorities 2024-09-07 09:18:54 +02:00
Sébastien Helleu aeb973fdbe doc: fix color of text with syntax highlighting and light theme 2024-09-07 09:17:57 +02:00
Sébastien Helleu 677efe8184 build: replace deprecated "DEPEND" by "BUILD_REQUIRES" in Cygwin packaging 2024-09-07 09:17:02 +02:00
Sébastien Helleu 9b30137dd4 build: add license in Cygwin packaging 2024-09-07 09:16:57 +02:00
Sébastien Helleu 230c637565 Version 4.4.2-dev 2024-08-19 20:00:40 +02:00
Sébastien Helleu e3c76cd7e6 Version 4.4.1 2024-08-19 19:57:29 +02:00
LuK1337 4f45828fd6 cmake: find 'lua' first
On Fedora, `lua` is an up to date package.
2024-08-17 11:29:00 +02:00
LuK1337 25809ff592 lua: fix broken LUA_VERSION check
/usr/include/lua-5.1/lua.h:19:25: error: token ""Lua 5.1"" is not valid
in preprocessor expressions
2024-08-17 10:10:53 +02:00
Sébastien Helleu 1d620ce7c7 Version 4.4.1-dev 2024-08-17 09:22:19 +02:00
52 changed files with 318 additions and 274 deletions
+12
View File
@@ -1,5 +1,17 @@
# WeeChat ChangeLog
## Version 4.4.2 (2024-09-08)
### Fixed
- core, plugins: fix integer overflow in loops ([#2178](https://github.com/weechat/weechat/issues/2178))
## Version 4.4.1 (2024-08-19)
### Fixed
- lua: fix compilation on Fedora with Lua < 5.2.0 ([#2173](https://github.com/weechat/weechat/issues/2173), [#2174](https://github.com/weechat/weechat/issues/2174))
## Version 4.4.0 (2024-08-17)
### Changed
+1 -1
View File
@@ -35,5 +35,5 @@ endif()
find_package(PkgConfig)
if(PKG_CONFIG_FOUND)
pkg_search_module(LUA lua5.4 lua-5.4 lua54 lua5.3 lua-5.3 lua53 lua5.2 lua-5.2 lua52 lua5.1 lua-5.1 lua51 lua-5.0 lua5.0 lua50 lua)
pkg_search_module(LUA lua lua5.4 lua-5.4 lua54 lua5.3 lua-5.3 lua53 lua5.2 lua-5.2 lua52 lua5.1 lua-5.1 lua51 lua-5.0 lua5.0 lua50)
endif()
+1 -1
View File
@@ -804,7 +804,7 @@ Man sollte versuchen, eine andere Priorität zu nutzen; Im folgenden Beispiel
muss "xxx" durch den betroffenen Servernamen ersetzt werden:
----
/set irc.server.xxx.tls_priorities "NORMAL:-VERS-TLS-ALL:+VERS-TLS1.0:+VERS-SSL3.0:%COMPAT"
/set irc.server.xxx.tls_priorities "NORMAL:%COMPAT"
----
[[irc_tls_libera]]
+4
View File
@@ -198,6 +198,10 @@ mark {
/* syntax highlighting tuning */
pre.pygments {
color: #ddd !important;
}
pre.pygments .tok-cp {
color: #44cfaf;
}
+1 -1
View File
@@ -758,7 +758,7 @@ should be, you can specify the fingerprint (SHA-512, SHA-256 or SHA-1):
You can try a different priority string, replace "xxx" by your server name:
----
/set irc.server.xxx.tls_priorities "NORMAL:-VERS-TLS-ALL:+VERS-TLS1.0:+VERS-SSL3.0:%COMPAT"
/set irc.server.xxx.tls_priorities "NORMAL:%COMPAT"
----
[[irc_tls_libera]]
+1 -1
View File
@@ -780,7 +780,7 @@ Puede intentar una cadena de prioridad diferente, reemplace "xxx" por el nombre
de su servidor:
----
/set irc.server.xxx.tls_priorities "NORMAL:-VERS-TLS-ALL:+VERS-TLS1.0:+VERS-SSL3.0:%COMPAT"
/set irc.server.xxx.tls_priorities "NORMAL:%COMPAT"
----
[[irc_tls_libera]]
+1 -1
View File
@@ -785,7 +785,7 @@ Vous pouvez essayer une chaîne de priorité différente, remplacez "xxx" par
le nom de votre serveur :
----
/set irc.server.xxx.tls_priorities "NORMAL:-VERS-TLS-ALL:+VERS-TLS1.0:+VERS-SSL3.0:%COMPAT"
/set irc.server.xxx.tls_priorities "NORMAL:%COMPAT"
----
[[irc_tls_libera]]
+1 -1
View File
@@ -832,7 +832,7 @@ should be, you can specify the fingerprint (SHA-512, SHA-256 or SHA-1):
Provare una stringa di priorità diversa, sostituendo "xxx" con il nome del server:
----
/set irc.server.xxx.tls_priorities "NORMAL:-VERS-TLS-ALL:+VERS-TLS1.0:+VERS-SSL3.0:%COMPAT"
/set irc.server.xxx.tls_priorities "NORMAL:%COMPAT"
----
[[irc_tls_libera]]
+1 -1
View File
@@ -779,7 +779,7 @@ gnutls ハンドシェイクに関するエラーの場合、Diffie-Hellman キ
You can try a different priority string, replace "xxx" by your server name:
----
/set irc.server.xxx.tls_priorities "NORMAL:-VERS-TLS-ALL:+VERS-TLS1.0:+VERS-SSL3.0:%COMPAT"
/set irc.server.xxx.tls_priorities "NORMAL:%COMPAT"
----
[[irc_tls_libera]]
+1 -1
View File
@@ -761,7 +761,7 @@ możesz podać sumę kontrolną (SHA-512, SHA-256 lub SHA-1):
Możesz spróbować innego ciągu priorytetu, zamień "xxx" nazwą serwera:
----
/set irc.server.xxx.tls_priorities "NORMAL:-VERS-TLS-ALL:+VERS-TLS1.0:+VERS-SSL3.0:%COMPAT"
/set irc.server.xxx.tls_priorities "NORMAL:%COMPAT"
----
[[irc_tls_libera]]
+1 -1
View File
@@ -680,7 +680,7 @@ printf '\033[?1002l'
Можете да покушате са другачијим стрингом приоритета, замените „xxx” са именом вашег сервера:
----
/set irc.server.xxx.tls_priorities "NORMAL:-VERS-TLS-ALL:+VERS-TLS1.0:+VERS-SSL3.0:%COMPAT"
/set irc.server.xxx.tls_priorities "NORMAL:%COMPAT"
----
[[irc_tls_libera]]
+3 -3
View File
@@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2024-08-12 21:29+0200\n"
"PO-Revision-Date: 2024-08-12 21:35+0200\n"
"POT-Creation-Date: 2024-08-24 11:22+0200\n"
"PO-Revision-Date: 2024-09-02 18:47+0200\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: fr\n"
@@ -12145,7 +12145,7 @@ msgstr ""
"liste des pseudos (séparés par des virgules) pour lesquels les mots de passe "
"seront masqués quand un message est envoyé, par exemple pour cacher le mot "
"de passe dans le message affiché par \"/msg nickserv identify motdepasse\", "
"exemple : \"nickserv|nickbot\""
"exemple : \"nickserv,nickbot\""
msgid ""
"display notices as private messages (if auto, use private buffer if found)"
+25 -24
View File
@@ -334,8 +334,9 @@ char *
calc_expression (const char *expr)
{
struct t_arraylist *list_values, *list_ops;
const char *ptr_expr, *ptr_expr2;
char str_result[64], *ptr_operator, *operator;
int i, i2, index_op, decimals;
int index_op, decimals;
enum t_calc_symbol last_symbol;
double value, factor, *ptr_value;
@@ -363,21 +364,21 @@ calc_expression (const char *expr)
goto end;
last_symbol = CALC_SYMBOL_NONE;
for (i = 0; expr[i]; i++)
for (ptr_expr = expr; ptr_expr[0]; ptr_expr++)
{
if (expr[i] == ' ')
if (ptr_expr[0] == ' ')
{
/* ignore spaces */
continue;
}
else if (expr[i] == '(')
else if (ptr_expr[0] == '(')
{
ptr_operator = string_strndup (expr + i, 1);
ptr_operator = string_strndup (ptr_expr, 1);
arraylist_add (list_ops, ptr_operator);
last_symbol = CALC_SYMBOL_PARENTHESIS_OPEN;
}
else if (isdigit ((unsigned char)expr[i]) || (expr[i] == '.')
|| ((expr[i] == '-')
else if (isdigit ((unsigned char)ptr_expr[0]) || (ptr_expr[0] == '.')
|| ((ptr_expr[0] == '-')
&& ((last_symbol == CALC_SYMBOL_NONE)
|| (last_symbol == CALC_SYMBOL_PARENTHESIS_OPEN)
|| (last_symbol == CALC_SYMBOL_OPERATOR))))
@@ -385,15 +386,15 @@ calc_expression (const char *expr)
value = 0;
decimals = 0;
factor = 1;
if (expr[i] == '-')
if (ptr_expr[0] == '-')
{
factor = -1;
i++;
ptr_expr++;
}
while (expr[i]
&& (isdigit ((unsigned char)expr[i]) || (expr[i] == '.')))
while (ptr_expr[0]
&& (isdigit ((unsigned char)ptr_expr[0]) || (ptr_expr[0] == '.')))
{
if (expr[i] == '.')
if (ptr_expr[0] == '.')
{
if (decimals == 0)
decimals = 10;
@@ -402,24 +403,24 @@ calc_expression (const char *expr)
{
if (decimals)
{
value = value + (((double)(expr[i] - '0')) / decimals);
value = value + (((double)(ptr_expr[0] - '0')) / decimals);
decimals *= 10;
}
else
{
value = (value * 10) + (expr[i] - '0');
value = (value * 10) + (ptr_expr[0] - '0');
}
}
i++;
ptr_expr++;
}
i--;
ptr_expr--;
value *= factor;
ptr_value = malloc (sizeof (value));
*ptr_value = value;
arraylist_add (list_values, ptr_value);
last_symbol = CALC_SYMBOL_VALUE;
}
else if (expr[i] == ')')
else if (ptr_expr[0] == ')')
{
index_op = arraylist_size (list_ops) - 1;
while (index_op >= 0)
@@ -439,15 +440,15 @@ calc_expression (const char *expr)
else
{
/* operator */
i2 = i + 1;
while (expr[i2] && (expr[i2] != ' ') && (expr[i2] != '(')
&& (expr[i2] != ')') && (expr[i2] != '.')
&& (expr[i2] != '-') && !isdigit ((unsigned char)expr[i2]))
ptr_expr2 = ptr_expr + 1;
while (ptr_expr2[0] && (ptr_expr2[0] != ' ') && (ptr_expr2[0] != '(')
&& (ptr_expr2[0] != ')') && (ptr_expr2[0] != '.')
&& (ptr_expr2[0] != '-') && !isdigit ((unsigned char)ptr_expr2[0]))
{
i2++;
ptr_expr2++;
}
operator = string_strndup (expr + i, i2 - i);
i = i2 - 1;
operator = string_strndup (ptr_expr, ptr_expr2 - ptr_expr);
ptr_expr = ptr_expr2 - 1;
if (operator)
{
index_op = arraylist_size (list_ops) - 1;
+12 -12
View File
@@ -1841,8 +1841,8 @@ COMMAND_CALLBACK(color)
COMMAND_CALLBACK(command)
{
int i, length, index_args, any_plugin;
char *command, **commands;
int length, index_args, any_plugin;
char *command, **commands, **ptr_command;
struct t_weechat_plugin *ptr_plugin;
struct t_gui_buffer *ptr_buffer;
@@ -1862,10 +1862,10 @@ COMMAND_CALLBACK(command)
commands = string_split_command (argv_eol[2], ';');
if (commands)
{
for (i = 0; commands[i]; i++)
for (ptr_command = commands; *ptr_command; ptr_command++)
{
(void) input_data (buffer,
commands[i],
*ptr_command,
NULL,
0, /* split_newline */
0); /* user_data */
@@ -2328,7 +2328,7 @@ command_eval_print_debug (const char *debug)
COMMAND_CALLBACK(eval)
{
int i, rc, print_only, split_command, condition, debug, error;
char *result, *ptr_args, **commands, str_debug[32];
char *result, *ptr_args, **commands, **ptr_command, str_debug[32];
const char *debug_output;
struct t_hashtable *pointers, *options;
@@ -2446,9 +2446,9 @@ COMMAND_CALLBACK(eval)
commands = string_split_command (ptr_args, ';');
if (commands)
{
for (i = 0; commands[i]; i++)
for (ptr_command = commands; *ptr_command; ptr_command++)
{
result = eval_expression (commands[i], pointers, NULL,
result = eval_expression (*ptr_command, pointers, NULL,
options);
if (result)
{
@@ -5059,7 +5059,7 @@ command_plugin_list_input (struct t_gui_buffer *buffer,
for (ptr_item = list->items; ptr_item;
ptr_item = ptr_item->next_item)
{
if (*buf[0])
if ((*buf)[0])
{
string_dyn_concat (buf, ", ", -1);
}
@@ -5074,7 +5074,7 @@ command_plugin_list_input (struct t_gui_buffer *buffer,
string_dyn_concat (buf, ptr_item->data, -1);
}
if (!*buf[0])
if (!(*buf)[0])
{
string_dyn_concat (
buf,
@@ -6645,7 +6645,7 @@ command_set_display_option_lists (char **argv, int arg_start, int arg_end,
COMMAND_CALLBACK(set)
{
char *value;
char *value, **ptr_environ;
const char *ptr_string;
int i, number_found, rc, display_only_changed, arg_option_start;
int arg_option_end, list_size;
@@ -6667,9 +6667,9 @@ COMMAND_CALLBACK(set)
list = weelist_new ();
if (!list)
COMMAND_ERROR;
for (i = 0; environ[i]; i++)
for (ptr_environ = environ; *ptr_environ; ptr_environ++)
{
weelist_add (list, environ[i], WEECHAT_LIST_POS_SORT, NULL);
weelist_add (list, *ptr_environ, WEECHAT_LIST_POS_SORT, NULL);
}
list_size = weelist_size (list);
for (i = 0; i < list_size; i++)
+9 -9
View File
@@ -1471,9 +1471,9 @@ completion_list_add_config_option_values_cb (const void *pointer, void *data,
struct t_gui_completion *completion)
{
char *pos_space, *option_full_name, *pos_section, *pos_option;
char *file, *section, *value_string;
char *file, *section, *value_string, **ptr_value;
const char *color_name;
int length, i;
int length;
struct t_config_file *ptr_config;
struct t_config_section *ptr_section, *section_found;
struct t_config_option *option_found;
@@ -1631,10 +1631,11 @@ completion_list_add_config_option_values_cb (const void *pointer, void *data,
}
break;
case CONFIG_OPTION_TYPE_ENUM:
for (i = 0; option_found->string_values[i]; i++)
for (ptr_value = option_found->string_values;
*ptr_value; ptr_value++)
{
gui_completion_list_add (completion,
option_found->string_values[i],
*ptr_value,
0, WEECHAT_LIST_POS_SORT);
}
gui_completion_list_add (completion, "++1",
@@ -2015,8 +2016,7 @@ completion_list_add_env_vars_cb (const void *pointer, void *data,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
int i;
char *pos, *name;
char *pos, *name, **ptr_environ;
/* make C compiler happy */
(void) pointer;
@@ -2024,12 +2024,12 @@ completion_list_add_env_vars_cb (const void *pointer, void *data,
(void) completion_item;
(void) buffer;
for (i = 0; environ[i]; i++)
for (ptr_environ = environ; *ptr_environ; ptr_environ++)
{
pos = strchr (environ[i], '=');
pos = strchr (*ptr_environ, '=');
if (pos)
{
name = string_strndup (environ[i], pos - environ[i]);
name = string_strndup (*ptr_environ, pos - *ptr_environ);
if (name)
{
gui_completion_list_add (completion, name,
+5 -6
View File
@@ -976,8 +976,7 @@ void
config_change_emphasized_attributes (const void *pointer, void *data,
struct t_config_option *option)
{
int i;
const char *ptr_attr;
const char *ptr_attributes, *ptr_attr;
/* make C compiler happy */
(void) pointer;
@@ -986,12 +985,12 @@ config_change_emphasized_attributes (const void *pointer, void *data,
config_emphasized_attributes = 0;
ptr_attr = CONFIG_STRING(config_look_emphasized_attributes);
if (ptr_attr)
ptr_attributes = CONFIG_STRING(config_look_emphasized_attributes);
if (ptr_attributes)
{
for (i = 0; ptr_attr[i]; i++)
for (ptr_attr = ptr_attributes; *ptr_attr; ptr_attr++)
{
config_emphasized_attributes |= gui_color_attr_get_flag (ptr_attr[i]);
config_emphasized_attributes |= gui_color_attr_get_flag (*ptr_attr);
}
}
+11 -11
View File
@@ -506,8 +506,8 @@ char *
eval_string_split (const char *text)
{
char *pos, *pos2, *pos3, *str_number, *separators, **items, *value, *error;
char str_value[32], *str_flags, **list_flags, *strip_items;
int i, num_items, count_items, random_item, flags;
char str_value[32], *str_flags, **list_flags, *strip_items, **ptr_flag;
int num_items, count_items, random_item, flags;
long number, max_items;
str_number = NULL;
@@ -564,25 +564,25 @@ eval_string_split (const char *text)
list_flags = string_split (str_flags, "+", NULL, 0, 0, NULL);
if (list_flags)
{
for (i = 0; list_flags[i]; i++)
for (ptr_flag = list_flags; *ptr_flag; ptr_flag++)
{
if (strcmp (list_flags[i], "strip_left") == 0)
if (strcmp (*ptr_flag, "strip_left") == 0)
flags |= WEECHAT_STRING_SPLIT_STRIP_LEFT;
else if (strcmp (list_flags[i], "strip_right") == 0)
else if (strcmp (*ptr_flag, "strip_right") == 0)
flags |= WEECHAT_STRING_SPLIT_STRIP_RIGHT;
else if (strcmp (list_flags[i], "collapse_seps") == 0)
else if (strcmp (*ptr_flag, "collapse_seps") == 0)
flags |= WEECHAT_STRING_SPLIT_COLLAPSE_SEPS;
else if (strcmp (list_flags[i], "keep_eol") == 0)
else if (strcmp (*ptr_flag, "keep_eol") == 0)
flags |= WEECHAT_STRING_SPLIT_KEEP_EOL;
else if (strncmp (list_flags[i], "strip_items=", 12) == 0)
else if (strncmp (*ptr_flag, "strip_items=", 12) == 0)
{
free (strip_items);
strip_items = strdup (list_flags[i] + 12);
strip_items = strdup (*ptr_flag + 12);
}
else if (strncmp (list_flags[i], "max_items=", 10) == 0)
else if (strncmp (*ptr_flag, "max_items=", 10) == 0)
{
error = NULL;
max_items = strtol (list_flags[i] + 10, &error, 10);
max_items = strtol (*ptr_flag + 10, &error, 10);
if (!error || error[0] || (max_items < 0))
goto end;
}
+1 -1
View File
@@ -410,7 +410,7 @@ infolist_fields (struct t_infolist *infolist)
for (ptr_var = infolist->ptr_item->vars; ptr_var; ptr_var = ptr_var->next_var)
{
if (*fields[0])
if ((*fields)[0])
string_dyn_concat (fields, ",", -1);
string_dyn_concat (fields, infolist_type_char_string[ptr_var->type], -1);
string_dyn_concat (fields, ":", -1);
+29 -46
View File
@@ -1093,20 +1093,20 @@ string_match (const char *string, const char *mask, int case_sensitive)
int
string_match_list (const char *string, const char **masks, int case_sensitive)
{
int match, i;
const char *ptr_mask;
int match;
const char **ptr_mask, *ptr_mask2;
if (!string || !masks)
return 0;
match = 0;
for (i = 0; masks[i]; i++)
for (ptr_mask = masks; *ptr_mask; ptr_mask++)
{
ptr_mask = (masks[i][0] == '!') ? masks[i] + 1 : masks[i];
if (string_match (string, ptr_mask, case_sensitive))
ptr_mask2 = ((*ptr_mask)[0] == '!') ? *ptr_mask + 1 : *ptr_mask;
if (string_match (string, ptr_mask2, case_sensitive))
{
if (masks[i][0] == '!')
if ((*ptr_mask)[0] == '!')
return 0;
else
match = 1;
@@ -2849,12 +2849,12 @@ string_split_shell (const char *string, int *num_items)
void
string_free_split (char **split_string)
{
int i;
char **ptr;
if (split_string)
{
for (i = 0; split_string[i]; i++)
free (split_string[i]);
for (ptr = split_string; *ptr; ptr++)
free (*ptr);
free (split_string);
}
}
@@ -2866,12 +2866,12 @@ string_free_split (char **split_string)
void
string_free_split_shared (char **split_string)
{
int i;
char **ptr;
if (split_string)
{
for (i = 0; split_string[i]; i++)
string_shared_free (split_string[i]);
for (ptr = split_string; *ptr; ptr++)
string_shared_free (*ptr);
free (split_string);
}
}
@@ -2891,8 +2891,9 @@ string_rebuild_split_string (const char **split_string,
const char *separator,
int index_start, int index_end)
{
int i, length, length_separator;
char *result;
const char **ptr_string;
char **result;
int i;
if (!split_string || (index_start < 0)
|| ((index_end >= 0) && (index_end < index_start)))
@@ -2900,39 +2901,23 @@ string_rebuild_split_string (const char **split_string,
return NULL;
}
length = 0;
length_separator = (separator) ? strlen (separator) : 0;
result = string_dyn_alloc (256);
for (i = 0; split_string[i]; i++)
for (ptr_string = split_string, i = 0; *ptr_string; ptr_string++, i++)
{
if ((index_end >= 0) && (i > index_end))
break;
if (i >= index_start)
length += strlen (split_string[i]) + length_separator;
}
if (length == 0)
return strdup ("");
result = malloc (length + 1);
if (!result)
return NULL;
result[0] = '\0';
for (i = index_start; split_string[i]; i++)
{
if ((index_end >= 0) && (i > index_end))
break;
strcat (result, split_string[i]);
if (separator && ((index_end < 0) || (i + 1 <= index_end))
&& split_string[i + 1])
{
strcat (result, separator);
if (i > index_start)
string_dyn_concat (result, separator, -1);
string_dyn_concat (result, *ptr_string, -1);
}
if (i == INT_MAX)
break;
}
return result;
return string_dyn_free (result, 0);
}
/*
@@ -3033,12 +3018,12 @@ string_split_command (const char *command, char separator)
void
string_free_split_command (char **split_command)
{
int i;
char **ptr;
if (split_command)
{
for (i = 0; split_command[i]; i++)
free (split_command[i]);
for (ptr = split_command; *ptr; ptr++)
free (*ptr);
free (split_command);
}
}
@@ -3102,14 +3087,12 @@ string_split_tags (const char *tags, int *num_tags)
void
string_free_split_tags (char ***split_tags)
{
int i;
char ***ptr;
if (split_tags)
{
for (i = 0; split_tags[i]; i++)
{
string_free_split_shared (split_tags[i]);
}
for (ptr = split_tags; *ptr; ptr++)
string_free_split_shared (*ptr);
free (split_tags);
}
}
+4 -5
View File
@@ -271,6 +271,7 @@ hook_line_add_to_infolist (struct t_infolist_item *item,
void
hook_line_print_log (struct t_hook *hook)
{
char **ptr_tag;
int i, j;
if (!hook || !hook->hook_data)
@@ -292,12 +293,10 @@ hook_line_print_log (struct t_hook *hook)
{
for (i = 0; i < HOOK_LINE(hook, tags_count); i++)
{
for (j = 0; HOOK_LINE(hook, tags_array)[i][j]; j++)
for (ptr_tag = HOOK_LINE(hook, tags_array)[i], j = 0; *ptr_tag;
ptr_tag++, j++)
{
log_printf (" tags_array[%03d][%03d]: '%s'",
i,
j,
HOOK_LINE(hook, tags_array)[i][j]);
log_printf (" tags_array[%03d][%03d]: '%s'", i, j, *ptr_tag);
}
}
}
+4 -5
View File
@@ -248,6 +248,7 @@ hook_print_add_to_infolist (struct t_infolist_item *item,
void
hook_print_print_log (struct t_hook *hook)
{
char **ptr_tag;
int i, j;
if (!hook || !hook->hook_data)
@@ -262,12 +263,10 @@ hook_print_print_log (struct t_hook *hook)
{
for (i = 0; i < HOOK_PRINT(hook, tags_count); i++)
{
for (j = 0; HOOK_PRINT(hook, tags_array)[i][j]; j++)
for (ptr_tag = HOOK_PRINT(hook, tags_array)[i], j = 0; *ptr_tag;
ptr_tag++, j++)
{
log_printf (" tags_array[%03d][%03d]: '%s'",
i,
j,
HOOK_PRINT(hook, tags_array)[i][j]);
log_printf (" tags_array[%03d][%03d]: '%s'", i, j, *ptr_tag);
}
}
}
+4 -3
View File
@@ -210,7 +210,7 @@ hook_process (struct t_weechat_plugin *plugin,
void
hook_process_child (struct t_hook *hook_process)
{
char **exec_args, *arg0, str_arg[64];
char **exec_args, *arg0, str_arg[64], **ptr_exec_arg;
const char *ptr_url, *ptr_arg;
int rc, i, num_args;
FILE *f;
@@ -352,9 +352,10 @@ hook_process_child (struct t_hook *hook_process)
{
log_printf ("hook_process, command='%s'",
HOOK_PROCESS(hook_process, command));
for (i = 0; exec_args[i]; i++)
for (ptr_exec_arg = exec_args, i = 0; *ptr_exec_arg;
ptr_exec_arg++, i++)
{
log_printf (" args[%02d] == '%s'", i, exec_args[i]);
log_printf (" args[%d] == '%s'", i, *ptr_exec_arg);
}
}
execvp (exec_args[0], exec_args);
+3 -3
View File
@@ -369,10 +369,10 @@ gui_color_get_pairs_arrays (short **foregrounds, short **backgrounds)
*foregrounds = NULL;
*backgrounds = NULL;
*foregrounds = malloc (sizeof (*foregrounds[0]) * (gui_color_num_pairs + 1));
*foregrounds = malloc (sizeof ((*foregrounds)[0]) * (gui_color_num_pairs + 1));
if (!*foregrounds)
goto error;
*backgrounds = malloc (sizeof (*backgrounds[0]) * (gui_color_num_pairs + 1));
*backgrounds = malloc (sizeof ((*backgrounds)[0]) * (gui_color_num_pairs + 1));
if (!*backgrounds)
goto error;
@@ -609,7 +609,7 @@ gui_color_build (int number, int foreground, int background)
/* allocate color */
if (!gui_color[number])
{
gui_color[number] = malloc (sizeof (*gui_color[number]));
gui_color[number] = malloc (sizeof ((*gui_color)[number]));
if (!gui_color[number])
return;
}
+1 -1
View File
@@ -1874,7 +1874,7 @@ gui_bar_item_buffer_nicklist_cb (const void *pointer, void *data,
&& buffer->nicklist_display_groups
&& ptr_group->visible))
{
if (*nicklist[0])
if ((*nicklist)[0])
string_dyn_concat (nicklist, "\n", -1);
if (ptr_nick)
+8 -7
View File
@@ -702,7 +702,7 @@ gui_bar_window_content_get_with_filling (struct t_gui_bar_window *bar_window,
char **content, str_reinit_color[32];
char str_reinit_color_space[32], str_reinit_color_space_start_line[32];
char str_start_item[32];
char *item_value, *item_value2, ****split_items, **linear_items;
char *item_value, *item_value2, ****split_items, **linear_items, **ptr_item;
int i, j, k, sub, index;
int at_least_one_item, first_sub_item;
int length_reinit_color, length_reinit_color_space, length_start_item;
@@ -856,15 +856,15 @@ gui_bar_window_content_get_with_filling (struct t_gui_bar_window *bar_window,
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
0,
NULL);
for (j = 0; split_items[i][sub][j]; j++)
for (ptr_item = split_items[i][sub]; *ptr_item; ptr_item++)
{
total_items++;
length = strlen (split_items[i][sub][j]);
length = strlen (*ptr_item);
if (length > max_length)
max_length = length;
length = gui_chat_strlen_screen (split_items[i][sub][j]);
length = gui_chat_strlen_screen (*ptr_item);
if (length > max_length_screen)
max_length_screen = length;
}
@@ -911,9 +911,10 @@ gui_bar_window_content_get_with_filling (struct t_gui_bar_window *bar_window,
{
if (split_items[i][sub])
{
for (j = 0; split_items[i][sub][j]; j++)
for (ptr_item = split_items[i][sub]; *ptr_item;
ptr_item++)
{
linear_items[index++] = split_items[i][sub][j];
linear_items[index++] = *ptr_item;
}
}
}
@@ -976,7 +977,7 @@ gui_bar_window_content_get_with_filling (struct t_gui_bar_window *bar_window,
break;
}
if (!*content[0])
if (!(*content)[0])
{
string_dyn_free (content, 1);
return NULL;
+1 -1
View File
@@ -1940,7 +1940,7 @@ gui_buffer_set_highlight_words_list (struct t_gui_buffer *buffer,
ptr_string = weelist_string (ptr_list_item);
if (ptr_string)
{
if (*words[0])
if ((*words)[0])
string_dyn_concat (words, ",", -1);
string_dyn_concat (words, ptr_string, -1);
}
+1 -1
View File
@@ -814,7 +814,7 @@ gui_chat_add_line_waiting_buffer (const char *message)
return;
}
if (*gui_chat_lines_waiting_buffer[0])
if ((*gui_chat_lines_waiting_buffer)[0])
string_dyn_concat (gui_chat_lines_waiting_buffer, "\n", -1);
string_dyn_concat (gui_chat_lines_waiting_buffer, message, -1);
+14 -14
View File
@@ -436,10 +436,10 @@ gui_key_expand (const char *key, char **key_name, char **key_name_alias)
meta2 = 0;
shift = 0;
if (*str_dyn_key[0])
if ((*str_dyn_key)[0])
string_dyn_concat (str_dyn_key, ",", -1);
if (*str_dyn_key_alias[0])
if ((*str_dyn_key_alias)[0])
string_dyn_concat (str_dyn_key_alias, ",", -1);
str_raw[0] = '\0';
@@ -2041,8 +2041,8 @@ gui_key_focus_command (const char *key, int context,
struct t_hashtable **hashtable_focus)
{
struct t_gui_key *ptr_key;
int i, matching, debug, rc;
char *command, **commands;
int matching, debug, rc;
char *command, **commands, **ptr_command;
const char *str_buffer;
struct t_hashtable *hashtable;
struct t_gui_buffer *ptr_buffer;
@@ -2123,25 +2123,25 @@ gui_key_focus_command (const char *key, int context,
commands = string_split_command (ptr_key->command, ';');
if (commands)
{
for (i = 0; commands[i]; i++)
for (ptr_command = commands; *ptr_command; ptr_command++)
{
if (string_strncasecmp (commands[i], "hsignal:", 8) == 0)
if (string_strncasecmp (*ptr_command, "hsignal:", 8) == 0)
{
if (commands[i][8])
if ((*ptr_command)[8])
{
if (debug)
{
gui_chat_printf (NULL,
_("Sending hsignal: \"%s\""),
commands[i] + 8);
*ptr_command + 8);
}
(void) hook_hsignal_send (commands[i] + 8,
(void) hook_hsignal_send (*ptr_command + 8,
hashtable);
}
}
else
{
command = eval_expression (commands[i], NULL,
command = eval_expression (*ptr_command, NULL,
hashtable, NULL);
if (command)
{
@@ -2340,11 +2340,11 @@ gui_key_debug_print_key (const char *combo, const char *key_name,
int
gui_key_pressed (const char *key_str)
{
int i, insert_into_input, context, length, length_key, signal_sent;
int insert_into_input, context, length, length_key, signal_sent;
int rc, rc_expand, exact_match, chunks1_count, chunks2_count, event_size;
int buffer_key;
struct t_gui_key *ptr_key;
char saved_char, signal_name[128], **commands;
char saved_char, signal_name[128], **commands, **ptr_command;
char *key_name, *key_name_alias, **chunks1, **chunks2;
signal_sent = 0;
@@ -2524,11 +2524,11 @@ gui_key_pressed (const char *key_str)
commands = string_split_command (ptr_key->command, ';');
if (commands)
{
for (i = 0; commands[i]; i++)
for (ptr_command = commands; *ptr_command; ptr_command++)
{
(void) input_data (
gui_current_window->buffer,
commands[i],
*ptr_command,
NULL,
0,
(buffer_key) ? 1 : 0);
+6 -5
View File
@@ -813,8 +813,9 @@ int
gui_line_match_tags (struct t_gui_line_data *line_data,
int tags_count, char ***tags_array)
{
int i, j, k, match, tag_found, tag_negated;
int i, j, match, tag_found, tag_negated;
const char *ptr_tag;
char **ptr;
if (!line_data)
return 0;
@@ -822,9 +823,9 @@ gui_line_match_tags (struct t_gui_line_data *line_data,
for (i = 0; i < tags_count; i++)
{
match = 1;
for (j = 0; tags_array[i][j]; j++)
for (ptr = tags_array[i]; *ptr; ptr++)
{
ptr_tag = tags_array[i][j];
ptr_tag = *ptr;
tag_found = 0;
tag_negated = 0;
@@ -841,9 +842,9 @@ gui_line_match_tags (struct t_gui_line_data *line_data,
}
else
{
for (k = 0; k < line_data->tags_count; k++)
for (j = 0; j < line_data->tags_count; j++)
{
if (string_match (line_data->tags_array[k], ptr_tag, 0))
if (string_match (line_data->tags_array[j], ptr_tag, 0))
{
tag_found = 1;
break;
+2 -2
View File
@@ -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;
+1 -1
View File
@@ -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 */
+1 -1
View File
@@ -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,
+19 -19
View File
@@ -1291,14 +1291,14 @@ void
irc_channel_join_smart_filtered_unmask (struct t_irc_channel *channel,
const char *nick)
{
int i, unmask_delay, length_tags, nick_found, join, account;
int unmask_delay, length_tags, nick_found, join, account;
int chghost, setname, nick_changed, smart_filtered, remove_smart_filter;
time_t *ptr_time, date_min;
struct t_hdata *hdata_line, *hdata_line_data;
struct t_gui_line *own_lines;
struct t_gui_line *line;
struct t_gui_line_data *line_data;
const char **tags, *irc_nick1, *irc_nick2;
const char **tags, *irc_nick1, *irc_nick2, **ptr_tag;
char *new_tags, *nick_to_search;
struct t_hashtable *hashtable;
@@ -1375,30 +1375,30 @@ irc_channel_join_smart_filtered_unmask (struct t_irc_channel *channel,
irc_nick1 = NULL;
irc_nick2 = NULL;
smart_filtered = 0;
for (i = 0; tags[i]; i++)
for (ptr_tag = tags; *ptr_tag; ptr_tag++)
{
if (strncmp (tags[i], "nick_", 5) == 0)
if (strncmp (*ptr_tag, "nick_", 5) == 0)
{
if (strcmp (tags[i] + 5, nick_to_search) == 0)
if (strcmp (*ptr_tag + 5, nick_to_search) == 0)
nick_found = 1;
}
else if (strcmp (tags[i], "irc_join") == 0)
else if (strcmp (*ptr_tag, "irc_join") == 0)
join = 1;
else if (strcmp (tags[i], "irc_account") == 0)
else if (strcmp (*ptr_tag, "irc_account") == 0)
account = 1;
else if (strcmp (tags[i], "irc_chghost") == 0)
else if (strcmp (*ptr_tag, "irc_chghost") == 0)
chghost = 1;
else if (strcmp (tags[i], "irc_setname") == 0)
else if (strcmp (*ptr_tag, "irc_setname") == 0)
setname = 1;
else if (strcmp (tags[i], "irc_nick") == 0)
else if (strcmp (*ptr_tag, "irc_nick") == 0)
nick_changed = 1;
else if (strncmp (tags[i], "irc_nick1_", 10) == 0)
irc_nick1 = tags[i] + 10;
else if (strncmp (tags[i], "irc_nick2_", 10) == 0)
irc_nick2 = tags[i] + 10;
else if (strcmp (tags[i], "irc_smart_filter") == 0)
else if (strncmp (*ptr_tag, "irc_nick1_", 10) == 0)
irc_nick1 = *ptr_tag + 10;
else if (strncmp (*ptr_tag, "irc_nick2_", 10) == 0)
irc_nick2 = *ptr_tag + 10;
else if (strcmp (*ptr_tag, "irc_smart_filter") == 0)
smart_filtered = 1;
length_tags += strlen (tags[i]) + 1;
length_tags += strlen (*ptr_tag) + 1;
}
/* check if we must remove tag "irc_smart_filter" in line */
@@ -1430,13 +1430,13 @@ irc_channel_join_smart_filtered_unmask (struct t_irc_channel *channel,
{
/* build a string with all tags, except "irc_smart_filter" */
new_tags[0] = '\0';
for (i = 0; tags[i]; i++)
for (ptr_tag = tags; *ptr_tag; ptr_tag++)
{
if (strcmp (tags[i], "irc_smart_filter") != 0)
if (strcmp (*ptr_tag, "irc_smart_filter") != 0)
{
if (new_tags[0])
strcat (new_tags, ",");
strcat (new_tags, tags[i]);
strcat (new_tags, *ptr_tag);
}
}
hashtable = weechat_hashtable_new (4,
+5 -5
View File
@@ -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",
+1 -1
View File
@@ -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);
+3 -3
View File
@@ -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);
+1 -1
View File
@@ -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;
+17 -17
View File
@@ -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);
+16 -16
View File
@@ -422,8 +422,8 @@ char *
irc_server_eval_fingerprint (struct t_irc_server *server)
{
const char *ptr_fingerprint;
char *fingerprint_eval, **fingerprints, *str_sizes;
int i, j, rc, algo, length;
char *fingerprint_eval, **fingerprints, *str_sizes, **ptr;
int i, rc, algo, length;
if (!server)
return NULL;
@@ -460,18 +460,18 @@ irc_server_eval_fingerprint (struct t_irc_server *server)
return fingerprint_eval;
rc = 0;
for (i = 0; fingerprints[i]; i++)
for (ptr = fingerprints; *ptr; ptr++)
{
length = strlen (fingerprints[i]);
length = strlen (*ptr);
algo = irc_server_fingerprint_search_algo_with_size (length * 4);
if (algo < 0)
{
rc = -1;
break;
}
for (j = 0; j < length; j++)
for (i = 0; i < length; i++)
{
if (!isxdigit ((unsigned char)fingerprints[i][j]))
if (!isxdigit ((unsigned char)((*ptr)[i])))
{
rc = -2;
break;
@@ -4954,7 +4954,7 @@ irc_server_check_certificate_fingerprint (struct t_irc_server *server,
const char *good_fingerprints)
{
unsigned char *fingerprint_server[IRC_FINGERPRINT_NUM_ALGOS];
char **fingerprints;
char **fingerprints, **ptr_fingerprint;
int i, rc, algo;
size_t size_bits, size_bytes;
@@ -4974,9 +4974,9 @@ irc_server_check_certificate_fingerprint (struct t_irc_server *server,
rc = 0;
for (i = 0; fingerprints[i]; i++)
for (ptr_fingerprint = fingerprints; *ptr_fingerprint; ptr_fingerprint++)
{
size_bits = strlen (fingerprints[i]) * 4;
size_bits = strlen (*ptr_fingerprint) * 4;
size_bytes = size_bits / 8;
algo = irc_server_fingerprint_search_algo_with_size (size_bits);
@@ -5018,7 +5018,7 @@ irc_server_check_certificate_fingerprint (struct t_irc_server *server,
if (fingerprint_server[algo])
{
/* check if the fingerprint matches */
if (irc_server_compare_fingerprints (fingerprints[i],
if (irc_server_compare_fingerprints (*ptr_fingerprint,
fingerprint_server[algo],
size_bytes) == 0)
{
@@ -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);
+1 -1
View File
@@ -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);
+2 -2
View File
@@ -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 */
@@ -1272,7 +1272,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
#if defined(LUA_VERSION_MAJOR) && defined(LUA_VERSION_MINOR)
weechat_hashtable_set (plugin->variables, "interpreter_version",
LUA_VERSION_MAJOR "." LUA_VERSION_MINOR);
#elif LUA_VERSION
#elif defined(LUA_VERSION)
weechat_hashtable_set (plugin->variables, "interpreter_version",
LUA_VERSION);
#else
+1 -1
View File
@@ -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 */
+1 -1
View File
@@ -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);
@@ -267,9 +267,8 @@ relay_remote_event_search_line_by_id (struct t_gui_buffer *buffer, int id)
struct t_gui_lines *ptr_lines;
struct t_gui_line *ptr_line;
struct t_gui_line_data *ptr_line_data;
const char **tags;
const char **tags, **ptr_tag;
char str_tag_id[512];
int i;
if (!buffer)
return NULL;
@@ -292,9 +291,9 @@ relay_remote_event_search_line_by_id (struct t_gui_buffer *buffer, int id)
tags = weechat_hdata_pointer (relay_hdata_line_data, ptr_line_data, "tags_array");
if (tags)
{
for (i = 0; tags[i]; i++)
for (ptr_tag = tags; *ptr_tag; ptr_tag++)
{
if (weechat_strcmp (tags[i], str_tag_id) == 0)
if (weechat_strcmp (*ptr_tag, str_tag_id) == 0)
return ptr_line;
}
}
@@ -219,8 +219,9 @@ relay_weechat_protocol_handshake_reply (struct t_relay_client *client,
RELAY_WEECHAT_PROTOCOL_CALLBACK(handshake)
{
char **options, **auths, **compressions, *pos;
int i, j, index_hash_algo, hash_algo_found, auth_allowed, compression;
char **options, **auths, **compressions, *pos, **ptr_option, **ptr_auth;
char **ptr_comp;
int index_hash_algo, hash_algo_found, auth_allowed, compression;
int password_received, plain_text_password;
RELAY_WEECHAT_PROTOCOL_MIN_ARGS(0);
@@ -242,14 +243,14 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(handshake)
weechat_string_split_command (argv_eol[0], ',') : NULL;
if (options)
{
for (i = 0; options[i]; i++)
for (ptr_option = options; *ptr_option; ptr_option++)
{
pos = strchr (options[i], '=');
pos = strchr (*ptr_option, '=');
if (pos)
{
pos[0] = '\0';
pos++;
if (strcmp (options[i], "password_hash_algo") == 0)
if (strcmp (*ptr_option, "password_hash_algo") == 0)
{
password_received = 1;
auths = weechat_string_split (
@@ -263,10 +264,9 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(handshake)
NULL);
if (auths)
{
for (j = 0; auths[j]; j++)
for (ptr_auth = auths; *ptr_auth; ptr_auth++)
{
index_hash_algo = relay_auth_password_hash_algo_search (
auths[j]);
index_hash_algo = relay_auth_password_hash_algo_search (*ptr_auth);
if ((index_hash_algo >= 0) && (index_hash_algo > hash_algo_found))
{
auth_allowed = weechat_string_match_list (
@@ -280,7 +280,7 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(handshake)
weechat_string_free_split (auths);
}
}
else if (strcmp (options[i], "compression") == 0)
else if (strcmp (*ptr_option, "compression") == 0)
{
compressions = weechat_string_split (
pos,
@@ -293,9 +293,9 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(handshake)
NULL);
if (compressions)
{
for (j = 0; compressions[j]; j++)
for (ptr_comp = compressions; *ptr_comp; ptr_comp++)
{
compression = relay_weechat_compression_search (compressions[j]);
compression = relay_weechat_compression_search (*ptr_comp);
if (compression >= 0)
{
RELAY_WEECHAT_DATA(client, compression) = compression;
@@ -305,7 +305,7 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(handshake)
weechat_string_free_split (compressions);
}
}
else if (strcmp (options[i], "escape_commands") == 0)
else if (strcmp (*ptr_option, "escape_commands") == 0)
{
RELAY_WEECHAT_DATA(client, escape_commands) =
(weechat_strcmp (pos, "on") == 0) ?
@@ -361,8 +361,9 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(handshake)
RELAY_WEECHAT_PROTOCOL_CALLBACK(init)
{
char **options, *pos, *relay_password, *totp_secret, *info_totp_args, *info_totp;
int i, length, password_received, totp_received;
char **options, *pos, *relay_password, *totp_secret;
char *info_totp_args, *info_totp, **ptr_option;
int length, password_received, totp_received;
RELAY_WEECHAT_PROTOCOL_MIN_ARGS(0);
@@ -380,14 +381,14 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(init)
weechat_string_split_command (argv_eol[0], ',') : NULL;
if (options)
{
for (i = 0; options[i]; i++)
for (ptr_option = options; *ptr_option; ptr_option++)
{
pos = strchr (options[i], '=');
pos = strchr (*ptr_option, '=');
if (pos)
{
pos[0] = '\0';
pos++;
if (strcmp (options[i], "password") == 0)
if (strcmp (*ptr_option, "password") == 0)
{
password_received = 1;
if ((client->password_hash_algo == RELAY_AUTH_PASSWORD_HASH_PLAIN)
@@ -396,13 +397,13 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(init)
RELAY_WEECHAT_DATA(client, password_ok) = 1;
}
}
else if (strcmp (options[i], "password_hash") == 0)
else if (strcmp (*ptr_option, "password_hash") == 0)
{
password_received = 1;
if (relay_auth_password_hash (client, pos, relay_password) == 0)
RELAY_WEECHAT_DATA(client, password_ok) = 1;
}
else if (strcmp (options[i], "totp") == 0)
else if (strcmp (*ptr_option, "totp") == 0)
{
totp_received = 1;
if (totp_secret)
+1 -1
View File
@@ -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 */
+3 -3
View File
@@ -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 (
+3 -3
View File
@@ -64,7 +64,7 @@ trigger_command_display_trigger_internal (const char *name,
int verbose)
{
char str_conditions[64], str_regex[64], str_command[64], str_rc[64];
char str_post_action[64], spaces[256];
char str_post_action[64], spaces[256], **ptr_command;
int i, length;
if (verbose >= 1)
@@ -133,7 +133,7 @@ trigger_command_display_trigger_internal (const char *name,
}
if (commands)
{
for (i = 0; commands[i]; i++)
for (ptr_command = commands, i = 0; *ptr_command; ptr_command++, i++)
{
weechat_printf_date_tags (
NULL, 0, "no_trigger",
@@ -143,7 +143,7 @@ trigger_command_display_trigger_internal (const char *name,
i + 1,
weechat_color ("chat_delimiters"),
weechat_color ("reset"),
commands[i],
*ptr_command,
weechat_color ("chat_delimiters"));
}
}
+1 -1
View File
@@ -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);
+43
View File
@@ -2126,6 +2126,7 @@ TEST(CoreString, RebuildSplitString)
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS;
argv = string_split (" abc de fghi ", " ", NULL, flags, 0, &argc);
/* => ["abc", "de", "fghi"] */
/* invalid index_end, which is < index_start */
str = string_rebuild_split_string ((const char **)argv, NULL, 1, 0);
@@ -2218,6 +2219,48 @@ TEST(CoreString, RebuildSplitString)
free (str);
string_free_split (argv);
/* test with empty items */
argv = string_split (",abc,de,,fghi,", ",", NULL, 0, 0, &argc);
/* => ["", "abc", "de", "", "fghi", ""] */
str = string_rebuild_split_string ((const char **)argv, "/", 0, -1);
STRCMP_EQUAL("/abc/de//fghi/", str);
free (str);
str = string_rebuild_split_string ((const char **)argv, "/", 0, 0);
STRCMP_EQUAL("", str);
free (str);
str = string_rebuild_split_string ((const char **)argv, "/", 0, 1);
STRCMP_EQUAL("/abc", str);
free (str);
str = string_rebuild_split_string ((const char **)argv, "/", 0, 2);
STRCMP_EQUAL("/abc/de", str);
free (str);
str = string_rebuild_split_string ((const char **)argv, "/", 0, 3);
STRCMP_EQUAL("/abc/de/", str);
free (str);
str = string_rebuild_split_string ((const char **)argv, "/", 0, 4);
STRCMP_EQUAL("/abc/de//fghi", str);
free (str);
str = string_rebuild_split_string ((const char **)argv, "/", 0, 5);
STRCMP_EQUAL("/abc/de//fghi/", str);
free (str);
str = string_rebuild_split_string ((const char **)argv, "/", 0, 6);
STRCMP_EQUAL("/abc/de//fghi/", str);
free (str);
str = string_rebuild_split_string ((const char **)argv, "/", 2, 4);
STRCMP_EQUAL("de//fghi", str);
free (str);
string_free_split (argv);
}
/*
+2 -2
View File
@@ -39,8 +39,8 @@
# devel-number the devel version as hex number ("0x04010000" for "4.1.0-dev")
#
weechat_stable="4.4.0"
weechat_devel="4.4.0"
weechat_stable="4.4.2"
weechat_devel="4.4.2"
stable_major=$(echo "${weechat_stable}" | cut -d"." -f1)
stable_minor=$(echo "${weechat_stable}" | cut -d"." -f2)
+2 -1
View File
@@ -48,10 +48,11 @@ RELEASE=1
CATEGORY="Net"
HOMEPAGE="https://weechat.org/"
LICENSE="GPL-3.0-or-later"
SRC_URI="weechat-${VERSION}.tar.xz"
# Build dependencies only
DEPEND="cmake gettext gettext-devel libgnutls-devel libaspell-devel \
BUILD_REQUIRES="cmake gettext gettext-devel libgnutls-devel libaspell-devel \
libcurl-devel libgcrypt-devel libncurses-devel lua perl pkg-config \
python3-devel ruby tcl-devel libguile3.0-devel php-devel libzstd-devel \
zlib-devel"