From cfd221014c1e5337ec14503430c98ca620024f81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Sun, 23 Aug 2020 23:27:57 +0200 Subject: api: add argument "bytes" in function string_dyn_concat --- src/plugins/buflist/buflist-bar-item.c | 14 ++++--- src/plugins/buflist/buflist-config.c | 11 +++--- src/plugins/fset/fset-bar-item.c | 67 ++++++++++++++++++++++------------ src/plugins/guile/weechat-guile.c | 16 ++++---- src/plugins/irc/irc-color.c | 51 ++++++++++++++------------ src/plugins/irc/irc-protocol.c | 18 +++++---- src/plugins/irc/irc-server.c | 24 +++++++----- src/plugins/lua/weechat-lua.c | 10 ++--- src/plugins/perl/weechat-perl.c | 11 +++--- src/plugins/python/weechat-python.c | 8 ++-- src/plugins/ruby/weechat-ruby.c | 17 ++++----- src/plugins/script/script-action.c | 27 ++++++++------ src/plugins/spell/spell-bar-item.c | 17 ++++++--- src/plugins/weechat-plugin.h | 8 ++-- 14 files changed, 169 insertions(+), 130 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/buflist/buflist-bar-item.c b/src/plugins/buflist/buflist-bar-item.c index e82fc18bc..01efdda8a 100644 --- a/src/plugins/buflist/buflist-bar-item.c +++ b/src/plugins/buflist/buflist-bar-item.c @@ -542,15 +542,19 @@ buflist_bar_item_buflist_cb (const void *pointer, void *data, weechat_string_dyn_concat ( hotlist, weechat_config_string ( - buflist_config_format_hotlist_separator)); + buflist_config_format_hotlist_separator), + -1); } weechat_string_dyn_concat ( hotlist, weechat_config_string ( - buflist_config_format_hotlist_level[j])); + buflist_config_format_hotlist_level[j]), + -1); snprintf (str_hotlist_count, sizeof (str_hotlist_count), "%d", count); - weechat_string_dyn_concat (hotlist, str_hotlist_count); + weechat_string_dyn_concat (hotlist, + str_hotlist_count, + -1); } } str_hotlist = *hotlist; @@ -606,7 +610,7 @@ buflist_bar_item_buflist_cb (const void *pointer, void *data, if (weechat_config_boolean (buflist_config_look_add_newline) && *buflist[0]) { - if (!weechat_string_dyn_concat (buflist, "\n")) + if (!weechat_string_dyn_concat (buflist, "\n", -1)) goto error; } @@ -618,7 +622,7 @@ buflist_bar_item_buflist_cb (const void *pointer, void *data, NULL); /* concatenate string */ - rc = weechat_string_dyn_concat (buflist, line); + rc = weechat_string_dyn_concat (buflist, line, -1); free (line); if (!rc) goto error; diff --git a/src/plugins/buflist/buflist-config.c b/src/plugins/buflist/buflist-config.c index 111cf996a..5c60f2f44 100644 --- a/src/plugins/buflist/buflist-config.c +++ b/src/plugins/buflist/buflist-config.c @@ -151,18 +151,19 @@ buflist_config_hook_signals_refresh () ptr_signals_refresh = weechat_config_string ( buflist_config_look_signals_refresh); - weechat_string_dyn_concat (all_signals, BUFLIST_CONFIG_SIGNALS_REFRESH); + weechat_string_dyn_concat (all_signals, BUFLIST_CONFIG_SIGNALS_REFRESH, -1); if (ptr_signals_refresh && ptr_signals_refresh[0]) { - weechat_string_dyn_concat (all_signals, ","); - weechat_string_dyn_concat (all_signals, ptr_signals_refresh); + weechat_string_dyn_concat (all_signals, ",", -1); + weechat_string_dyn_concat (all_signals, ptr_signals_refresh, -1); } if (weechat_config_boolean (buflist_config_look_nick_prefix)) { - weechat_string_dyn_concat (all_signals, ","); + weechat_string_dyn_concat (all_signals, ",", -1); weechat_string_dyn_concat ( all_signals, - BUFLIST_CONFIG_SIGNALS_REFRESH_NICK_PREFIX); + BUFLIST_CONFIG_SIGNALS_REFRESH_NICK_PREFIX, + -1); } signals = weechat_string_split (*all_signals, ",", NULL, diff --git a/src/plugins/fset/fset-bar-item.c b/src/plugins/fset/fset-bar-item.c index bef62d773..60d04c1a1 100644 --- a/src/plugins/fset/fset-bar-item.c +++ b/src/plugins/fset/fset-bar-item.c @@ -81,8 +81,8 @@ fset_bar_item_fset_cb (const void *pointer, void *data, if (!default_and_values) return NULL; - weechat_string_dyn_concat (default_and_values, weechat_color ("bar_fg")); - weechat_string_dyn_concat (default_and_values, _("default: ")); + weechat_string_dyn_concat (default_and_values, weechat_color ("bar_fg"), -1); + weechat_string_dyn_concat (default_and_values, _("default: "), -1); if (ptr_fset_option->default_value) { if (ptr_fset_option->type == FSET_OPTION_TYPE_STRING) @@ -90,29 +90,37 @@ fset_bar_item_fset_cb (const void *pointer, void *data, weechat_string_dyn_concat (default_and_values, weechat_color ( weechat_config_string ( - fset_config_color_help_quotes))); - weechat_string_dyn_concat (default_and_values, "\""); + fset_config_color_help_quotes)), + -1); + weechat_string_dyn_concat (default_and_values, "\"", -1); } weechat_string_dyn_concat ( default_and_values, - weechat_color (weechat_config_string (fset_config_color_help_default_value))); + weechat_color (weechat_config_string (fset_config_color_help_default_value)), + -1); weechat_string_dyn_concat (default_and_values, - ptr_fset_option->default_value); + ptr_fset_option->default_value, + -1); if (ptr_fset_option->type == FSET_OPTION_TYPE_STRING) { weechat_string_dyn_concat (default_and_values, weechat_color ( weechat_config_string ( - fset_config_color_help_quotes))); - weechat_string_dyn_concat (default_and_values, "\""); + fset_config_color_help_quotes)), + -1); + weechat_string_dyn_concat (default_and_values, "\"", -1); } } else { weechat_string_dyn_concat ( default_and_values, - weechat_color (weechat_config_string (fset_config_color_help_default_value))); - weechat_string_dyn_concat (default_and_values, FSET_OPTION_VALUE_NULL); + weechat_color (weechat_config_string (fset_config_color_help_default_value)), + -1); + weechat_string_dyn_concat ( + default_and_values, + FSET_OPTION_VALUE_NULL, + -1); } if ((ptr_fset_option->string_values && ptr_fset_option->string_values[0]) @@ -131,10 +139,11 @@ fset_bar_item_fset_cb (const void *pointer, void *data, || (ptr_fset_option->type == FSET_OPTION_TYPE_INTEGER)) { weechat_string_dyn_concat (default_and_values, - weechat_color ("bar_fg")); - weechat_string_dyn_concat (default_and_values, ", "); - weechat_string_dyn_concat (default_and_values, _("values:")); - weechat_string_dyn_concat (default_and_values, " "); + weechat_color ("bar_fg"), + -1); + weechat_string_dyn_concat (default_and_values, ", ", -1); + weechat_string_dyn_concat (default_and_values, _("values:"), -1); + weechat_string_dyn_concat (default_and_values, " ", -1); if (ptr_string_values) { for (i = 0; ptr_string_values[i]; i++) @@ -142,16 +151,21 @@ fset_bar_item_fset_cb (const void *pointer, void *data, if (i > 0) { weechat_string_dyn_concat (default_and_values, - weechat_color ("bar_fg")); - weechat_string_dyn_concat (default_and_values, ", "); + weechat_color ("bar_fg"), + -1); + weechat_string_dyn_concat (default_and_values, + ", ", + -1); } weechat_string_dyn_concat ( default_and_values, weechat_color ( weechat_config_string ( - fset_config_color_help_values))); + fset_config_color_help_values)), + -1); weechat_string_dyn_concat (default_and_values, - ptr_string_values[i]); + ptr_string_values[i], + -1); } } else @@ -160,19 +174,24 @@ fset_bar_item_fset_cb (const void *pointer, void *data, default_and_values, weechat_color ( weechat_config_string ( - fset_config_color_help_values))); + fset_config_color_help_values)), + -1); weechat_string_dyn_concat (default_and_values, - ptr_fset_option->min); + ptr_fset_option->min, + -1); weechat_string_dyn_concat (default_and_values, - weechat_color ("bar_fg")); - weechat_string_dyn_concat (default_and_values, " ... "); + weechat_color ("bar_fg"), + -1); + weechat_string_dyn_concat (default_and_values, " ... ", -1); weechat_string_dyn_concat ( default_and_values, weechat_color ( weechat_config_string ( - fset_config_color_help_values))); + fset_config_color_help_values)), + -1); weechat_string_dyn_concat (default_and_values, - ptr_fset_option->max); + ptr_fset_option->max, + -1); } } } diff --git a/src/plugins/guile/weechat-guile.c b/src/plugins/guile/weechat-guile.c index 4b6406e48..e1a6484c7 100644 --- a/src/plugins/guile/weechat-guile.c +++ b/src/plugins/guile/weechat-guile.c @@ -1180,13 +1180,13 @@ weechat_guile_port_write (SCM port, SCM src, size_t start, size_t count) ptr_data = data2; while ((ptr_newline = strchr (ptr_data, '\n')) != NULL) { - ptr_newline[0] = '\0'; - weechat_string_dyn_concat (guile_buffer_output, ptr_data); + weechat_string_dyn_concat (guile_buffer_output, + ptr_data, + ptr_newline - ptr_data); weechat_guile_output_flush (); - ptr_newline[0] = '\n'; ptr_data = ++ptr_newline; } - weechat_string_dyn_concat (guile_buffer_output, ptr_data); + weechat_string_dyn_concat (guile_buffer_output, ptr_data, -1); free (data2); @@ -1212,13 +1212,13 @@ weechat_guile_port_write (SCM port, const void *data, size_t size) ptr_data = data2; while ((ptr_newline = strchr (ptr_data, '\n')) != NULL) { - ptr_newline[0] = '\0'; - weechat_string_dyn_concat (guile_buffer_output, ptr_data); + weechat_string_dyn_concat (guile_buffer_output, + ptr_data, + ptr_newline - ptr_data); weechat_guile_output_flush (); - ptr_newline[0] = '\n'; ptr_data = ++ptr_newline; } - weechat_string_dyn_concat (guile_buffer_output, ptr_data); + weechat_string_dyn_concat (guile_buffer_output, ptr_data, -1); free (data2); } diff --git a/src/plugins/irc/irc-color.c b/src/plugins/irc/irc-color.c index 4ec0c9e30..3919c0466 100644 --- a/src/plugins/irc/irc-color.c +++ b/src/plugins/irc/irc-color.c @@ -266,7 +266,7 @@ irc_color_decode (const char *string, int keep_colors) } /* add "str_to_add" (if not empty) to "out" */ if (str_to_add[0]) - weechat_string_dyn_concat (out, str_to_add); + weechat_string_dyn_concat (out, str_to_add, -1); } result = *out; @@ -287,7 +287,7 @@ irc_color_decode (const char *string, int keep_colors) char * irc_color_encode (const char *string, int keep_colors) { - char **out, *result, str_to_add[2], utf_char[16]; + char **out, *result; unsigned char *ptr_string; int length; @@ -306,29 +306,30 @@ irc_color_encode (const char *string, int keep_colors) { case 0x02: /* ^B */ if (keep_colors) - weechat_string_dyn_concat (out, IRC_COLOR_BOLD_STR); + weechat_string_dyn_concat (out, IRC_COLOR_BOLD_STR, -1); ptr_string++; break; case 0x03: /* ^C */ if (keep_colors) - weechat_string_dyn_concat (out, IRC_COLOR_COLOR_STR); + weechat_string_dyn_concat (out, IRC_COLOR_COLOR_STR, -1); ptr_string++; if (isdigit (ptr_string[0])) { if (keep_colors) { - str_to_add[0] = ptr_string[0]; - str_to_add[1] = '\0'; - weechat_string_dyn_concat (out, str_to_add); + weechat_string_dyn_concat (out, + (const char *)ptr_string, + 1); } ptr_string++; if (isdigit (ptr_string[0])) { if (keep_colors) { - str_to_add[0] = ptr_string[0]; - str_to_add[1] = '\0'; - weechat_string_dyn_concat (out, str_to_add); + weechat_string_dyn_concat ( + out, + (const char *)ptr_string, + 1); } ptr_string++; } @@ -336,24 +337,26 @@ irc_color_encode (const char *string, int keep_colors) if (ptr_string[0] == ',') { if (keep_colors) - weechat_string_dyn_concat (out, ","); + weechat_string_dyn_concat (out, ",", -1); ptr_string++; if (isdigit (ptr_string[0])) { if (keep_colors) { - str_to_add[0] = ptr_string[0]; - str_to_add[1] = '\0'; - weechat_string_dyn_concat (out, str_to_add); + weechat_string_dyn_concat ( + out, + (const char *)ptr_string, + 1); } ptr_string++; if (isdigit (ptr_string[0])) { if (keep_colors) { - str_to_add[0] = ptr_string[0]; - str_to_add[1] = '\0'; - weechat_string_dyn_concat (out, str_to_add); + weechat_string_dyn_concat ( + out, + (const char *)ptr_string, + 1); } ptr_string++; } @@ -362,31 +365,31 @@ irc_color_encode (const char *string, int keep_colors) break; case 0x0F: /* ^O */ if (keep_colors) - weechat_string_dyn_concat (out, IRC_COLOR_RESET_STR); + weechat_string_dyn_concat (out, IRC_COLOR_RESET_STR, -1); ptr_string++; break; case 0x16: /* ^V */ if (keep_colors) - weechat_string_dyn_concat (out, IRC_COLOR_REVERSE_STR); + weechat_string_dyn_concat (out, IRC_COLOR_REVERSE_STR, -1); ptr_string++; break; case 0x1D: /* ^] */ if (keep_colors) - weechat_string_dyn_concat (out, IRC_COLOR_ITALIC_STR); + weechat_string_dyn_concat (out, IRC_COLOR_ITALIC_STR, -1); ptr_string++; break; case 0x1F: /* ^_ */ if (keep_colors) - weechat_string_dyn_concat (out, IRC_COLOR_UNDERLINE_STR); + weechat_string_dyn_concat (out, IRC_COLOR_UNDERLINE_STR, -1); ptr_string++; break; default: length = weechat_utf8_char_size ((char *)ptr_string); if (length == 0) length = 1; - memcpy (utf_char, ptr_string, length); - utf_char[length] = '\0'; - weechat_string_dyn_concat (out, utf_char); + weechat_string_dyn_concat (out, + (const char *)ptr_string, + length); ptr_string += length; } } diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index d20860898..dc3fad004 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -515,12 +515,12 @@ irc_protocol_cap_print_cb (void *data, str_caps = (char **)data; if (*str_caps[0]) - weechat_string_dyn_concat (str_caps, " "); - weechat_string_dyn_concat (str_caps, key); + weechat_string_dyn_concat (str_caps, " ", -1); + weechat_string_dyn_concat (str_caps, key, -1); if (value) { - weechat_string_dyn_concat (str_caps, "="); - weechat_string_dyn_concat (str_caps, value); + weechat_string_dyn_concat (str_caps, "=", -1); + weechat_string_dyn_concat (str_caps, value, -1); } } @@ -837,9 +837,10 @@ IRC_PROTOCOL_CALLBACK(cap) if (caps_supported[i][0] == '-') { if (*str_caps_disabled[0]) - weechat_string_dyn_concat (str_caps_disabled, " "); + weechat_string_dyn_concat (str_caps_disabled, " ", -1); weechat_string_dyn_concat (str_caps_disabled, - caps_supported[i] + 1); + caps_supported[i] + 1, + -1); weechat_hashtable_remove (server->cap_list, caps_supported[i] + 1); @@ -847,9 +848,10 @@ IRC_PROTOCOL_CALLBACK(cap) else { if (*str_caps_enabled[0]) - weechat_string_dyn_concat (str_caps_enabled, " "); + weechat_string_dyn_concat (str_caps_enabled, " ", -1); weechat_string_dyn_concat (str_caps_enabled, - caps_supported[i]); + caps_supported[i], + -1); weechat_hashtable_set (server->cap_list, caps_supported[i], NULL); diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c index e98749518..4e0dbe6c4 100644 --- a/src/plugins/irc/irc-server.c +++ b/src/plugins/irc/irc-server.c @@ -5352,18 +5352,22 @@ irc_server_build_autojoin (struct t_irc_server *server) { /* add channel with key and the key */ if (*channels_with_key[0]) - weechat_string_dyn_concat (channels_with_key, ","); - weechat_string_dyn_concat (channels_with_key, ptr_channel->name); + weechat_string_dyn_concat (channels_with_key, ",", -1); + weechat_string_dyn_concat (channels_with_key, + ptr_channel->name, + -1); if (*keys[0]) - weechat_string_dyn_concat (keys, ","); - weechat_string_dyn_concat (keys, ptr_channel->key); + weechat_string_dyn_concat (keys, ",", -1); + weechat_string_dyn_concat (keys, ptr_channel->key, -1); } else { /* add channel without key */ if (*channels_others[0]) - weechat_string_dyn_concat (channels_others, ","); - weechat_string_dyn_concat (channels_others, ptr_channel->name); + weechat_string_dyn_concat (channels_others, ",", -1); + weechat_string_dyn_concat (channels_others, + ptr_channel->name, + -1); } } } @@ -5375,13 +5379,13 @@ irc_server_build_autojoin (struct t_irc_server *server) if (*channels_others[0]) { if (*channels_with_key[0]) - weechat_string_dyn_concat (channels_with_key, ","); - weechat_string_dyn_concat (channels_with_key, *channels_others); + weechat_string_dyn_concat (channels_with_key, ",", -1); + weechat_string_dyn_concat (channels_with_key, *channels_others, -1); } if (*keys[0]) { - weechat_string_dyn_concat (channels_with_key, " "); - weechat_string_dyn_concat (channels_with_key, *keys); + weechat_string_dyn_concat (channels_with_key, " ", -1); + weechat_string_dyn_concat (channels_with_key, *keys, -1); } weechat_string_dyn_free (channels_others, 1); diff --git a/src/plugins/lua/weechat-lua.c b/src/plugins/lua/weechat-lua.c index df03dc4e5..30c042ac8 100644 --- a/src/plugins/lua/weechat-lua.c +++ b/src/plugins/lua/weechat-lua.c @@ -258,7 +258,6 @@ int weechat_lua_output (lua_State *L) { const char *msg, *ptr_msg, *ptr_newline; - char *message; if (lua_gettop (L) < 1) return 0; @@ -267,14 +266,13 @@ weechat_lua_output (lua_State *L) ptr_msg = msg; while ((ptr_newline = strchr (ptr_msg, '\n')) != NULL) { - message = weechat_strndup (ptr_msg, ptr_newline - ptr_msg); - weechat_string_dyn_concat (lua_buffer_output, message); - if (message) - free (message); + weechat_string_dyn_concat (lua_buffer_output, + ptr_msg, + ptr_newline - ptr_msg); weechat_lua_output_flush (); ptr_msg = ++ptr_newline; } - weechat_string_dyn_concat (lua_buffer_output, ptr_msg); + weechat_string_dyn_concat (lua_buffer_output, ptr_msg, -1); return 0; } diff --git a/src/plugins/perl/weechat-perl.c b/src/plugins/perl/weechat-perl.c index 264921d1c..996a51398 100644 --- a/src/plugins/perl/weechat-perl.c +++ b/src/plugins/perl/weechat-perl.c @@ -292,7 +292,7 @@ weechat_perl_output_flush () XS (weechat_perl_output) { - char *msg, *ptr_msg, *ptr_newline, *message; + char *msg, *ptr_msg, *ptr_newline; dXSARGS; if (items < 1) @@ -302,14 +302,13 @@ XS (weechat_perl_output) ptr_msg = msg; while ((ptr_newline = strchr (ptr_msg, '\n')) != NULL) { - message = weechat_strndup (ptr_msg, ptr_newline - ptr_msg); - weechat_string_dyn_concat (perl_buffer_output, message); - if (message) - free (message); + weechat_string_dyn_concat (perl_buffer_output, + ptr_msg, + ptr_newline - ptr_msg); weechat_perl_output_flush (); ptr_msg = ++ptr_newline; } - weechat_string_dyn_concat (perl_buffer_output, ptr_msg); + weechat_string_dyn_concat (perl_buffer_output, ptr_msg, -1); } /* diff --git a/src/plugins/python/weechat-python.c b/src/plugins/python/weechat-python.c index 2515f6f08..d9731784d 100644 --- a/src/plugins/python/weechat-python.c +++ b/src/plugins/python/weechat-python.c @@ -444,13 +444,13 @@ weechat_python_output (PyObject *self, PyObject *args) ptr_msg = msg; while ((ptr_newline = strchr (ptr_msg, '\n')) != NULL) { - ptr_newline[0] = '\0'; - weechat_string_dyn_concat (python_buffer_output, ptr_msg); + weechat_string_dyn_concat (python_buffer_output, + ptr_msg, + ptr_newline - ptr_msg); weechat_python_output_flush (); - ptr_newline[0] = '\n'; ptr_msg = ++ptr_newline; } - weechat_string_dyn_concat (python_buffer_output, ptr_msg); + weechat_string_dyn_concat (python_buffer_output, ptr_msg, -1); } Py_INCREF(Py_None); diff --git a/src/plugins/ruby/weechat-ruby.c b/src/plugins/ruby/weechat-ruby.c index faa2e354c..160361063 100644 --- a/src/plugins/ruby/weechat-ruby.c +++ b/src/plugins/ruby/weechat-ruby.c @@ -428,24 +428,23 @@ weechat_ruby_output_flush () static VALUE weechat_ruby_output (VALUE self, VALUE str) { - char *msg, *m, *p; + char *msg, *ptr_msg, *ptr_newline; /* make C compiler happy */ (void) self; msg = strdup (StringValuePtr (str)); - m = msg; - while ((p = strchr (m, '\n')) != NULL) + ptr_msg = msg; + while ((ptr_newline = strchr (ptr_msg, '\n')) != NULL) { - *p = '\0'; - weechat_string_dyn_concat (ruby_buffer_output, m); + weechat_string_dyn_concat (ruby_buffer_output, + ptr_msg, + ptr_newline - ptr_msg); weechat_ruby_output_flush (); - *p = '\n'; - m = ++p; + ptr_msg = ++ptr_newline; } - - weechat_string_dyn_concat (ruby_buffer_output, m); + weechat_string_dyn_concat (ruby_buffer_output, ptr_msg, -1); if (msg) free (msg); diff --git a/src/plugins/script/script-action.c b/src/plugins/script/script-action.c index bb79f4534..faedbfb84 100644 --- a/src/plugins/script/script-action.c +++ b/src/plugins/script/script-action.c @@ -121,25 +121,29 @@ script_action_list_input (int send_to_buffer, int translated) { if (*buf[0]) { - weechat_string_dyn_concat (buf, ", "); + weechat_string_dyn_concat (buf, ", ", -1); } else { weechat_string_dyn_concat ( buf, - (translated) ? _("Scripts loaded:") : "Scripts loaded:"); - weechat_string_dyn_concat (buf, " "); + (translated) ? _("Scripts loaded:") : "Scripts loaded:", + -1); + weechat_string_dyn_concat (buf, " ", -1); } weechat_string_dyn_concat (buf, weechat_hdata_string (hdata, ptr_script, - "name")); - weechat_string_dyn_concat (buf, "."); - weechat_string_dyn_concat (buf, script_extension[i]); - weechat_string_dyn_concat (buf, " "); - weechat_string_dyn_concat (buf, weechat_hdata_string (hdata, - ptr_script, - "version")); + "name"), + -1); + weechat_string_dyn_concat (buf, ".", -1); + weechat_string_dyn_concat (buf, script_extension[i], -1); + weechat_string_dyn_concat (buf, " ", -1); + weechat_string_dyn_concat (buf, + weechat_hdata_string (hdata, + ptr_script, + "version"), + -1); ptr_script = weechat_hdata_move (hdata, ptr_script, 1); } } @@ -148,7 +152,8 @@ script_action_list_input (int send_to_buffer, int translated) { weechat_string_dyn_concat ( buf, - (translated) ? _("No scripts loaded") : "No scripts loaded"); + (translated) ? _("No scripts loaded") : "No scripts loaded", + -1); } if (send_to_buffer) diff --git a/src/plugins/spell/spell-bar-item.c b/src/plugins/spell/spell-bar-item.c index b0b6e7ed3..473e957ba 100644 --- a/src/plugins/spell/spell-bar-item.c +++ b/src/plugins/spell/spell-bar-item.c @@ -117,11 +117,13 @@ spell_bar_item_suggest (const void *pointer, void *data, str_suggest, weechat_color ( weechat_config_string ( - spell_config_color_suggestion_delimiter_dict))); + spell_config_color_suggestion_delimiter_dict)), + -1); weechat_string_dyn_concat ( str_suggest, weechat_config_string ( - spell_config_look_suggestion_delimiter_dict)); + spell_config_look_suggestion_delimiter_dict), + -1); } suggestions2 = weechat_string_split ( suggestions[i], @@ -142,18 +144,21 @@ spell_bar_item_suggest (const void *pointer, void *data, str_suggest, weechat_color ( weechat_config_string ( - spell_config_color_suggestion_delimiter_word))); + spell_config_color_suggestion_delimiter_word)), + -1); weechat_string_dyn_concat ( str_suggest, weechat_config_string ( - spell_config_look_suggestion_delimiter_word)); + spell_config_look_suggestion_delimiter_word), + -1); } weechat_string_dyn_concat ( str_suggest, weechat_color ( weechat_config_string ( - spell_config_color_suggestion))); - weechat_string_dyn_concat (str_suggest, suggestions2[j]); + spell_config_color_suggestion)), + -1); + weechat_string_dyn_concat (str_suggest, suggestions2[j], -1); } weechat_string_free_split (suggestions2); } diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h index b8cf10456..e2ba4cec2 100644 --- a/src/plugins/weechat-plugin.h +++ b/src/plugins/weechat-plugin.h @@ -67,7 +67,7 @@ struct timeval; * please change the date with current one; for a second change at same * date, increment the 01, otherwise please keep 01. */ -#define WEECHAT_PLUGIN_API_VERSION "20200822-01" +#define WEECHAT_PLUGIN_API_VERSION "20200823-01" /* macros for defining plugin infos */ #define WEECHAT_PLUGIN_NAME(__name) \ @@ -350,7 +350,7 @@ struct t_weechat_plugin struct t_hashtable *options); char **(*string_dyn_alloc) (int size_alloc); int (*string_dyn_copy) (char **string, const char *new_string); - int (*string_dyn_concat) (char **string, const char *add); + int (*string_dyn_concat) (char **string, const char *add, int bytes); char *(*string_dyn_free) (char **string, int free_string); /* UTF-8 strings */ @@ -1292,8 +1292,8 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin); (weechat_plugin->string_dyn_alloc)(__size_alloc) #define weechat_string_dyn_copy(__string, __new_string) \ (weechat_plugin->string_dyn_copy)(__string, __new_string) -#define weechat_string_dyn_concat(__string, __add) \ - (weechat_plugin->string_dyn_concat)(__string, __add) +#define weechat_string_dyn_concat(__string, __add, __bytes) \ + (weechat_plugin->string_dyn_concat)(__string, __add, __bytes) #define weechat_string_dyn_free(__string, __free_string) \ (weechat_plugin->string_dyn_free)(__string, __free_string) -- cgit v1.2.3