mirror of
https://github.com/weechat/weechat.git
synced 2026-07-05 01:03:14 +02:00
core: replace calls to sprintf() with snprintf()
This commit is contained in:
@@ -218,8 +218,8 @@ gui_key_default_bindings (int context)
|
||||
/* bind meta-j + {01..99} to switch to buffers # > 10 */
|
||||
for (i = 1; i < 100; i++)
|
||||
{
|
||||
sprintf (key_str, "meta-j%02d", i);
|
||||
sprintf (command, "/buffer %d", i);
|
||||
snprintf (key_str, sizeof (key_str), "meta-j%02d", i);
|
||||
snprintf (command, sizeof (command), "/buffer %d", i);
|
||||
BIND(key_str, command);
|
||||
}
|
||||
}
|
||||
|
||||
+11
-7
@@ -1313,8 +1313,8 @@ gui_bar_item_default_hotlist (void *data, struct t_gui_bar_item *item,
|
||||
*/
|
||||
break;
|
||||
}
|
||||
sprintf (str_hotlist + strlen (str_hotlist),
|
||||
"%d", ptr_hotlist->buffer->number);
|
||||
snprintf (str_hotlist + strlen (str_hotlist), 16,
|
||||
"%d", ptr_hotlist->buffer->number);
|
||||
numbers_count++;
|
||||
|
||||
if (display_name)
|
||||
@@ -1325,14 +1325,18 @@ gui_bar_item_default_hotlist (void *data, struct t_gui_bar_item *item,
|
||||
strcat (str_hotlist, ":");
|
||||
strcat (str_hotlist, GUI_COLOR_CUSTOM_BAR_FG);
|
||||
if (CONFIG_INTEGER(config_look_hotlist_names_length) == 0)
|
||||
{
|
||||
snprintf (format, sizeof (format) - 1, "%%s");
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf (format, sizeof (format) - 1,
|
||||
"%%.%ds",
|
||||
CONFIG_INTEGER(config_look_hotlist_names_length));
|
||||
sprintf (str_hotlist + strlen (str_hotlist), format,
|
||||
(CONFIG_BOOLEAN(config_look_hotlist_short_names)) ?
|
||||
gui_buffer_get_short_name (ptr_hotlist->buffer) : ptr_hotlist->buffer->name);
|
||||
}
|
||||
snprintf (str_hotlist + strlen (str_hotlist), 128, format,
|
||||
(CONFIG_BOOLEAN(config_look_hotlist_short_names)) ?
|
||||
gui_buffer_get_short_name (ptr_hotlist->buffer) : ptr_hotlist->buffer->name);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1407,8 +1411,8 @@ gui_bar_item_default_hotlist (void *data, struct t_gui_bar_item *item,
|
||||
*/
|
||||
break;
|
||||
}
|
||||
sprintf (str_hotlist + strlen (str_hotlist),
|
||||
"%d", ptr_hotlist->count[priority]);
|
||||
snprintf (str_hotlist + strlen (str_hotlist), 16,
|
||||
"%d", ptr_hotlist->count[priority]);
|
||||
}
|
||||
strcat (str_hotlist, GUI_COLOR_CUSTOM_BAR_DELIM);
|
||||
strcat (str_hotlist, ")");
|
||||
|
||||
Reference in New Issue
Block a user