summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--po/es.po19
-rw-r--r--src/core/wee-backtrace.c4
-rw-r--r--src/core/wee-command.c6
-rw-r--r--src/core/wee-config-file.c56
-rw-r--r--src/core/wee-config-file.h63
-rw-r--r--src/core/wee-config.c10
-rw-r--r--src/core/wee-debug.c9
-rw-r--r--src/core/wee-hook.c36
-rw-r--r--src/core/wee-hook.h55
-rw-r--r--src/core/wee-input.c9
-rw-r--r--src/core/wee-input.h4
-rw-r--r--src/core/wee-list.c14
-rw-r--r--src/core/wee-list.h10
-rw-r--r--src/core/wee-log.c4
-rw-r--r--src/core/wee-log.h2
-rw-r--r--src/core/wee-network.c18
-rw-r--r--src/core/wee-network.h2
-rw-r--r--src/core/wee-string.c60
-rw-r--r--src/core/wee-string.h50
-rw-r--r--src/core/wee-upgrade.c8
-rw-r--r--src/core/wee-upgrade.h4
-rw-r--r--src/core/wee-utf8.c78
-rw-r--r--src/core/wee-utf8.h28
-rw-r--r--src/core/wee-util.c12
-rw-r--r--src/core/wee-util.h15
-rw-r--r--src/gui/curses/gui-curses-bar.c2
-rw-r--r--src/gui/curses/gui-curses-chat.c6
-rw-r--r--src/gui/curses/gui-curses-color.c8
-rw-r--r--src/gui/curses/gui-curses-window.c4
-rw-r--r--src/gui/curses/gui-curses.h4
-rw-r--r--src/gui/gtk/gui-gtk-bar.c2
-rw-r--r--src/gui/gtk/gui-gtk-chat.c10
-rw-r--r--src/gui/gtk/gui-gtk-color.c4
-rw-r--r--src/gui/gtk/gui-gtk-input.c2
-rw-r--r--src/gui/gui-bar-item.c19
-rw-r--r--src/gui/gui-bar-item.h6
-rw-r--r--src/gui/gui-bar.c45
-rw-r--r--src/gui/gui-bar.h31
-rw-r--r--src/gui/gui-buffer.c31
-rw-r--r--src/gui/gui-buffer.h29
-rw-r--r--src/gui/gui-chat.c24
-rw-r--r--src/gui/gui-chat.h16
-rw-r--r--src/gui/gui-color.c4
-rw-r--r--src/gui/gui-color.h8
-rw-r--r--src/gui/gui-completion.c21
-rw-r--r--src/gui/gui-completion.h2
-rw-r--r--src/gui/gui-filter.c7
-rw-r--r--src/gui/gui-filter.h10
-rw-r--r--src/gui/gui-history.c4
-rw-r--r--src/gui/gui-history.h4
-rw-r--r--src/gui/gui-infobar.c2
-rw-r--r--src/gui/gui-infobar.h3
-rw-r--r--src/gui/gui-input.c11
-rw-r--r--src/gui/gui-input.h6
-rw-r--r--src/gui/gui-keyboard.c19
-rw-r--r--src/gui/gui-keyboard.h13
-rw-r--r--src/gui/gui-nicklist.c20
-rw-r--r--src/gui/gui-nicklist.h12
-rw-r--r--src/gui/gui-window.c4
-rw-r--r--src/plugins/alias/alias.c48
-rw-r--r--src/plugins/charset/charset.c29
-rw-r--r--src/plugins/demo/demo.c11
-rw-r--r--src/plugins/fifo/fifo.c30
-rw-r--r--src/plugins/irc/irc-channel.c14
-rw-r--r--src/plugins/irc/irc-channel.h14
-rw-r--r--src/plugins/irc/irc-color.c6
-rw-r--r--src/plugins/irc/irc-color.h6
-rw-r--r--src/plugins/irc/irc-command.c28
-rw-r--r--src/plugins/irc/irc-command.h12
-rw-r--r--src/plugins/irc/irc-completion.c18
-rw-r--r--src/plugins/irc/irc-config.c10
-rw-r--r--src/plugins/irc/irc-debug.c10
-rw-r--r--src/plugins/irc/irc-debug.h2
-rw-r--r--src/plugins/irc/irc-display.c7
-rw-r--r--src/plugins/irc/irc-display.h18
-rw-r--r--src/plugins/irc/irc-input.c21
-rw-r--r--src/plugins/irc/irc-input.h2
-rw-r--r--src/plugins/irc/irc-mode.c10
-rw-r--r--src/plugins/irc/irc-mode.h5
-rw-r--r--src/plugins/irc/irc-nick.c9
-rw-r--r--src/plugins/irc/irc-nick.h10
-rw-r--r--src/plugins/irc/irc-protocol.c132
-rw-r--r--src/plugins/irc/irc-protocol.h7
-rw-r--r--src/plugins/irc/irc-server.c96
-rw-r--r--src/plugins/irc/irc-server.h46
-rw-r--r--src/plugins/irc/irc.c2
-rw-r--r--src/plugins/logger/logger-buffer.c2
-rw-r--r--src/plugins/logger/logger-buffer.h2
-rw-r--r--src/plugins/logger/logger-tail.c6
-rw-r--r--src/plugins/logger/logger-tail.h3
-rw-r--r--src/plugins/logger/logger.c25
-rw-r--r--src/plugins/plugin-api.c38
-rw-r--r--src/plugins/plugin-api.h41
-rw-r--r--src/plugins/plugin-config.c9
-rw-r--r--src/plugins/plugin-config.h12
-rw-r--r--src/plugins/plugin-infolist.c16
-rw-r--r--src/plugins/plugin-infolist.h18
-rw-r--r--src/plugins/plugin.c10
-rw-r--r--src/plugins/plugin.h8
-rw-r--r--src/plugins/scripts/lua/weechat-lua-api.c440
-rw-r--r--src/plugins/scripts/lua/weechat-lua.c16
-rw-r--r--src/plugins/scripts/lua/weechat-lua.h7
-rw-r--r--src/plugins/scripts/perl/weechat-perl-api.c56
-rw-r--r--src/plugins/scripts/perl/weechat-perl.c22
-rw-r--r--src/plugins/scripts/perl/weechat-perl.h7
-rw-r--r--src/plugins/scripts/python/weechat-python-api.c56
-rw-r--r--src/plugins/scripts/python/weechat-python.c16
-rw-r--r--src/plugins/scripts/python/weechat-python.h7
-rw-r--r--src/plugins/scripts/ruby/weechat-ruby-api.c56
-rw-r--r--src/plugins/scripts/ruby/weechat-ruby.c16
-rw-r--r--src/plugins/scripts/ruby/weechat-ruby.h7
-rw-r--r--src/plugins/scripts/script-api.c117
-rw-r--r--src/plugins/scripts/script-api.h126
-rw-r--r--src/plugins/scripts/script.c30
-rw-r--r--src/plugins/scripts/script.h30
-rw-r--r--src/plugins/weechat-plugin.h272
-rw-r--r--src/plugins/xfer/xfer-buffer.c4
-rw-r--r--src/plugins/xfer/xfer-buffer.h2
-rw-r--r--src/plugins/xfer/xfer-chat.c6
-rw-r--r--src/plugins/xfer/xfer-file.c2
-rw-r--r--src/plugins/xfer/xfer-file.h2
-rw-r--r--src/plugins/xfer/xfer.c24
-rw-r--r--src/plugins/xfer/xfer.h2
123 files changed, 1598 insertions, 1487 deletions
diff --git a/po/es.po b/po/es.po
index 501f85db1..1f2078992 100644
--- a/po/es.po
+++ b/po/es.po
@@ -1103,8 +1103,8 @@ msgstr "la cadena mostrada tras la finalización de los nombres de usuario"
#, fuzzy
msgid "use a marker (line or char) on buffers to show first unread line"
msgstr ""
-"usar un marcador en los servidores/canales para mostrar la primera línea sin "
-"leer"
+"usar un marcador en los servidores/canales para mostrar la primera línea "
+"sin leer"
#, fuzzy
msgid "save configuration file on exit"
@@ -1599,8 +1599,8 @@ msgid ""
"support.\n"
"Be careful, private info may be in these files.\n"
msgstr ""
-"Por favor, envía %s/%s, %s/%s y los mensajes de arriba a los desarrolladores "
-"de Weechat para el soporte.\n"
+"Por favor, envía %s/%s, %s/%s y los mensajes de arriba a los "
+"desarrolladores de Weechat para el soporte.\n"
"Sé cuidadoso, puede que haya información privada en estos ficheros.\n"
#, c-format
@@ -5374,8 +5374,8 @@ msgstr "%s falta un argumento para la opción --dir\n"
#~ "maximum number of lines in history for one server/channel/private window "
#~ "(0 = unlimited)"
#~ msgstr ""
-#~ "número máximo de líneas en el histórico para un servidor/canal/privado "
-#~ "(0 = ilimitado)"
+#~ "número máximo de líneas en el histórico para un servidor/canal/"
+#~ "privado (0 = ilimitado)"
#, fuzzy
#~ msgid "log messages from plugins"
@@ -5569,8 +5569,8 @@ msgstr "%s falta un argumento para la opción --dir\n"
#~ "max size for aligning nick and other messages (should be >= to "
#~ "look_align_size)"
#~ msgstr ""
-#~ "tamaño máximo para la alineación de nick y otros mensajes (debería ser "
-#~ ">= a look_align_size)"
+#~ "tamaño máximo para la alineación de nick y otros mensajes (debería "
+#~ "ser >= a look_align_size)"
#~ msgid "server name not found"
#~ msgstr "nombre de servidor no encontrado"
@@ -6357,7 +6357,8 @@ msgstr "%s falta un argumento para la opción --dir\n"
#~ msgid "color for chan owner symbol (specific to unrealircd)"
#~ msgstr ""
-#~ "color para el símbolo de propietario de canal (especificado en unrealircd)"
+#~ "color para el símbolo de propietario de canal (especificado en "
+#~ "unrealircd)"
#~ msgid "color for chan admin symbol"
#~ msgstr "color para el símbolo de administrador de canal"
diff --git a/src/core/wee-backtrace.c b/src/core/wee-backtrace.c
index 6fff9d7c6..deb85befe 100644
--- a/src/core/wee-backtrace.c
+++ b/src/core/wee-backtrace.c
@@ -50,7 +50,7 @@
*/
void
-weechat_backtrace_printf (char *message, ...)
+weechat_backtrace_printf (const char *message, ...)
{
static char buffer[4096];
va_list argptr;
@@ -69,7 +69,7 @@ weechat_backtrace_printf (char *message, ...)
*/
void
-weechat_backtrace_addr2line (int number, void *address, char *symbol)
+weechat_backtrace_addr2line (int number, void *address, const char *symbol)
{
#ifdef HAVE_BACKTRACE
int rc;
diff --git a/src/core/wee-command.c b/src/core/wee-command.c
index 7b0ec0576..81b27125d 100644
--- a/src/core/wee-command.c
+++ b/src/core/wee-command.c
@@ -1362,7 +1362,7 @@ command_key (void *data, struct t_gui_buffer *buffer,
*/
void
-command_plugin_list (char *name, int full)
+command_plugin_list (const char *name, int full)
{
struct t_weechat_plugin *ptr_plugin;
struct t_hook *ptr_hook;
@@ -1851,7 +1851,7 @@ command_set_display_section (struct t_config_file *config_file,
void
command_set_display_option (struct t_config_option *option,
- char *message)
+ const char *message)
{
char *color_name;
@@ -1926,7 +1926,7 @@ command_set_display_option (struct t_config_option *option,
*/
int
-command_set_display_option_list (char *message, char *search)
+command_set_display_option_list (const char *message, const char *search)
{
int number_found, section_displayed, length;
struct t_config_file *ptr_config;
diff --git a/src/core/wee-config-file.c b/src/core/wee-config-file.c
index 39604f506..2c7cd8dfa 100644
--- a/src/core/wee-config-file.c
+++ b/src/core/wee-config-file.c
@@ -54,7 +54,7 @@ char *config_boolean_false[] = { "off", "no", "n", "false", "f", "0", NULL };
*/
struct t_config_file *
-config_file_search (char *name)
+config_file_search (const char *name)
{
struct t_config_file *ptr_config;
@@ -77,7 +77,7 @@ config_file_search (char *name)
*/
struct t_config_file *
-config_file_new (struct t_weechat_plugin *plugin, char *name,
+config_file_new (struct t_weechat_plugin *plugin, const char *name,
int (*callback_reload)(void *data,
struct t_config_file *config_file),
void *callback_reload_data)
@@ -149,27 +149,27 @@ config_file_valid_for_plugin (struct t_weechat_plugin *plugin,
*/
struct t_config_section *
-config_file_new_section (struct t_config_file *config_file, char *name,
+config_file_new_section (struct t_config_file *config_file, const char *name,
int user_can_add_options, int user_can_delete_options,
int (*callback_read)(void *data,
struct t_config_file *config_file,
struct t_config_section *section,
- char *option_name,
- char *value),
+ const char *option_name,
+ const char *value),
void *callback_read_data,
void (*callback_write)(void *data,
struct t_config_file *config_file,
- char *section_name),
+ const char *section_name),
void *callback_write_data,
void (*callback_write_default)(void *data,
struct t_config_file *config_file,
- char *section_name),
+ const char *section_name),
void *callback_write_default_data,
int (*callback_create_option)(void *data,
struct t_config_file *config_file,
struct t_config_section *section,
- char *option_name,
- char *value),
+ const char *option_name,
+ const char *value),
void *callback_create_option_data)
{
struct t_config_section *new_section;
@@ -215,7 +215,7 @@ config_file_new_section (struct t_config_file *config_file, char *name,
struct t_config_section *
config_file_search_section (struct t_config_file *config_file,
- char *section_name)
+ const char *section_name)
{
struct t_config_section *ptr_section;
@@ -270,7 +270,7 @@ config_file_section_valid_for_plugin (struct t_weechat_plugin *plugin,
*/
struct t_config_option *
-config_file_option_find_pos (struct t_config_section *section, char *name)
+config_file_option_find_pos (struct t_config_section *section, const char *name)
{
struct t_config_option *ptr_option;
@@ -338,13 +338,13 @@ config_file_option_insert_in_section (struct t_config_option *option)
struct t_config_option *
config_file_new_option (struct t_config_file *config_file,
- struct t_config_section *section, char *name,
- char *type, char *description,
- char *string_values, int min, int max,
- char *default_value,
+ struct t_config_section *section, const char *name,
+ const char *type, const char *description,
+ const char *string_values, int min, int max,
+ const char *default_value,
int (*callback_check_value)(void *data,
struct t_config_option *option,
- char *value),
+ const char *value),
void *callback_check_value_data,
void (*callback_change)(void *data,
struct t_config_option *option),
@@ -491,7 +491,7 @@ config_file_new_option (struct t_config_file *config_file,
struct t_config_option *
config_file_search_option (struct t_config_file *config_file,
struct t_config_section *section,
- char *option_name)
+ const char *option_name)
{
struct t_config_section *ptr_section;
struct t_config_option *ptr_option;
@@ -531,7 +531,7 @@ config_file_search_option (struct t_config_file *config_file,
void
config_file_search_section_option (struct t_config_file *config_file,
struct t_config_section *section,
- char *option_name,
+ const char *option_name,
struct t_config_section **section_found,
struct t_config_option **option_found)
{
@@ -579,7 +579,7 @@ config_file_search_section_option (struct t_config_file *config_file,
*/
void
-config_file_search_with_string (char *option_name,
+config_file_search_with_string (const char *option_name,
struct t_config_file **config_file,
struct t_config_section **section,
struct t_config_option **option,
@@ -688,7 +688,7 @@ config_file_option_valid_for_plugin (struct t_weechat_plugin *plugin,
*/
int
-config_file_string_boolean_is_valid (char *text)
+config_file_string_boolean_is_valid (const char *text)
{
int i;
@@ -717,7 +717,7 @@ config_file_string_boolean_is_valid (char *text)
*/
int
-config_file_string_to_boolean (char *text)
+config_file_string_to_boolean (const char *text)
{
int i;
@@ -859,7 +859,7 @@ config_file_option_reset (struct t_config_option *option, int run_callback)
*/
int
-config_file_option_set (struct t_config_option *option, char *value,
+config_file_option_set (struct t_config_option *option, const char *value,
int run_callback)
{
int value_int, i, rc, length_option, new_value_ok;
@@ -1151,7 +1151,8 @@ config_file_option_unset (struct t_config_option *option)
*/
void
-config_file_option_rename (struct t_config_option *option, char *new_name)
+config_file_option_rename (struct t_config_option *option,
+ const char *new_name)
{
if (!new_name || !new_name[0])
return;
@@ -1184,7 +1185,8 @@ config_file_option_rename (struct t_config_option *option, char *new_name)
*/
void *
-config_file_option_get_pointer (struct t_config_option *option, char *property)
+config_file_option_get_pointer (struct t_config_option *option,
+ const char *property)
{
if (string_strcasecmp (property, "config_file") == 0)
return option->config_file;
@@ -1225,7 +1227,7 @@ config_file_option_get_pointer (struct t_config_option *option, char *property)
*/
int
-config_file_option_set_with_string (char *option_name, char *value)
+config_file_option_set_with_string (const char *option_name, const char *value)
{
int rc;
struct t_config_file *ptr_config;
@@ -1275,7 +1277,7 @@ config_file_option_set_with_string (char *option_name, char *value)
*/
int
-config_file_option_unset_with_string (char *option_name)
+config_file_option_unset_with_string (const char *option_name)
{
struct t_config_option *ptr_option;
int rc;
@@ -1437,7 +1439,7 @@ config_file_write_option (struct t_config_file *config_file,
void
config_file_write_line (struct t_config_file *config_file,
- char *option_name, char *value, ...)
+ const char *option_name, const char *value, ...)
{
char buf[4096];
va_list argptr;
diff --git a/src/core/wee-config-file.h b/src/core/wee-config-file.h
index a11829caa..1b2315287 100644
--- a/src/core/wee-config-file.h
+++ b/src/core/wee-config-file.h
@@ -63,24 +63,25 @@ struct t_config_section
(void *data, /* config file (only for some */
struct t_config_file *config_file, /* special sections) */
struct t_config_section *section,
- char *option_name,
- char *value);
+ const char *option_name,
+ const char *value);
void *callback_read_data; /* data sent to read callback */
void (*callback_write) /* called to write options */
(void *data, /* in config file (only for some */
struct t_config_file *config_file, /* special sections) */
- char *section_name);
+ const char *section_name);
void *callback_write_data; /* data sent to write callback */
void (*callback_write_default) /* called to write default */
(void *data, /* options in config file */
struct t_config_file *config_file,
- char *section_name);
+ const char *section_name);
void *callback_write_default_data; /* data sent to write def. callb.*/
int (*callback_create_option) /* called to create option in */
(void *data, /* section */
struct t_config_file *config_file,
struct t_config_section *section,
- char *option_name, char *value);
+ const char *option_name,
+ const char *value);
void *callback_create_option_data; /* data sent to create callback */
struct t_config_option *options; /* options in section */
struct t_config_option *last_option; /* last option in section */
@@ -112,7 +113,7 @@ struct t_config_option
int (*callback_check_value) /* called to check value before */
(void *data, /* assiging new value */
struct t_config_option *option,
- char *value);
+ const char *value);
void *callback_check_value_data; /* data sent to check callback */
void (*callback_change) /* called when value is changed */
(void *data,
@@ -130,52 +131,52 @@ struct t_config_option
extern struct t_config_file *config_files;
extern struct t_config_file *last_config_file;
-extern struct t_config_file *config_file_search (char *name);
+extern struct t_config_file *config_file_search (const char *name);
extern struct t_config_file *config_file_new (struct t_weechat_plugin *plugin,
- char *name,
+ const char *name,
int (*callback_reload)(void *data,
struct t_config_file *config_file),
void *callback_data);
extern int config_file_valid_for_plugin (struct t_weechat_plugin *plugin,
struct t_config_file *config_file);
extern struct t_config_section *config_file_new_section (struct t_config_file *config_file,
- char *name,
+ const char *name,
int user_can_add_options,
int user_can_delete_options,
int (*callback_read)(void *data,
struct t_config_file *config_file,
struct t_config_section *section,
- char *option_name,
- char *value),
+ const char *option_name,
+ const char *value),
void *callback_read_data,
void (*callback_write)(void *data,
struct t_config_file *config_file,
- char *section_name),
+ const char *section_name),
void *callback_write_data,
void (*callback_write_default)(void *data,
struct t_config_file *config_file,
- char *section_name),
+ const char *section_name),
void *callback_write_default_data,
int (*callback_create_option)(void *data,
struct t_config_file *config_file,
struct t_config_section *section,
- char *option_name,
- char *value),
+ const char *option_name,
+ const char *value),
void *callback_create_option_data);
extern struct t_config_section *config_file_search_section (struct t_config_file *config_file,
- char *section_name);
+ const char *section_name);
extern int config_file_section_valid_for_plugin (struct t_weechat_plugin *plugin,
struct t_config_section *);
extern struct t_config_option *config_file_new_option (struct t_config_file *config_file,
struct t_config_section *section,
- char *name, char *type,
- char *description,
- char *string_values,
+ const char *name, const char *type,
+ const char *description,
+ const char *string_values,
int min, int max,
- char *default_value,
+ const char *default_value,
int (*callback_check_value)(void *data,
struct t_config_option *option,
- char *value),
+ const char *value),
void *callback_check_value_data,
void (*callback_change)(void *data,
struct t_config_option *option),
@@ -185,38 +186,38 @@ extern struct t_config_option *config_file_new_option (struct t_config_file *con
void *callback_delete_data);
extern struct t_config_option *config_file_search_option (struct t_config_file *config_file,
struct t_config_section *section,
- char *option_name);
+ const char *option_name);
extern void config_file_search_section_option (struct t_config_file *config_file,
struct t_config_section *section,
- char *option_name,
+ const char *option_name,
struct t_config_section **section_found,
struct t_config_option **option_found);
-extern void config_file_search_with_string (char *option_name,
+extern void config_file_search_with_string (const char *option_name,
struct t_config_file **config_file,
struct t_config_section **section,
struct t_config_option **option,
char **pos_option_name);
extern int config_file_option_valid_for_plugin (struct t_weechat_plugin *plugin,
struct t_config_option *option);
-extern int config_file_string_to_boolean (char *text);
+extern int config_file_string_to_boolean (const char *text);
extern int config_file_option_reset (struct t_config_option *option,
int run_callback);
extern int config_file_option_set (struct t_config_option *option,
- char *value, int run_callback);
+ const char *value, int run_callback);
extern int config_file_option_unset (struct t_config_option *option);
extern void config_file_option_rename (struct t_config_option *option,
- char *new_name);
+ const char *new_name);
extern void *config_file_option_get_pointer (struct t_config_option *option,
- char *property);
-extern int config_file_option_set_with_string (char *option_name, char *value);
-extern int config_file_option_unset_with_string (char *option_name);
+ const char *property);
+extern int config_file_option_set_with_string (const char *option_name, const char *value);
+extern int config_file_option_unset_with_string (const char *option_name);
extern int config_file_option_boolean (struct t_config_option *option);
extern int config_file_option_integer (struct t_config_option *option);
extern char *config_file_option_string (struct t_config_option *option);
extern int config_file_option_color (struct t_config_option *option);
extern void config_file_write_line (struct t_config_file *config_file,
- char *option_name, char *value, ...);
+ const char *option_name, const char *value, ...);
extern int config_file_write (struct t_config_file *config_files);
extern int config_file_read (struct t_config_file *config_file);
extern int config_file_reload (struct t_config_file *config_file);
diff --git a/src/core/wee-config.c b/src/core/wee-config.c
index 198561248..de77a7fc1 100644
--- a/src/core/wee-config.c
+++ b/src/core/wee-config.c
@@ -528,7 +528,7 @@ config_weechat_reload (void *data, struct t_config_file *config_file)
int
config_weechat_bar_read (void *data, struct t_config_file *config_file,
struct t_config_section *section,
- char *option_name, char *value)
+ const char *option_name, const char *value)
{
char *pos_option, *bar_name;
struct t_gui_bar *ptr_temp_bar;
@@ -599,7 +599,7 @@ int
config_weechat_filter_read (void *data,
struct t_config_file *config_file,
struct t_config_section *section,
- char *option_name, char *value)
+ const char *option_name, const char *value)
{
char **argv, **argv_eol;
int argc;
@@ -635,7 +635,7 @@ config_weechat_filter_read (void *data,
void
config_weechat_filter_write (void *data, struct t_config_file *config_file,
- char *section_name)
+ const char *section_name)
{
struct t_gui_filter *ptr_filter;
@@ -664,7 +664,7 @@ config_weechat_filter_write (void *data, struct t_config_file *config_file,
int
config_weechat_key_read (void *data, struct t_config_file *config_file,
struct t_config_section *section,
- char *option_name, char *value)
+ const char *option_name, const char *value)
{
/* make C compiler happy */
(void) data;
@@ -694,7 +694,7 @@ config_weechat_key_read (void *data, struct t_config_file *config_file,
void
config_weechat_key_write (void *data, struct t_config_file *config_file,
- char *section_name)
+ const char *section_name)
{
struct t_gui_key *ptr_key;
char *expanded_name;
diff --git a/src/core/wee-debug.c b/src/core/wee-debug.c
index 7e09b9a90..53477f215 100644
--- a/src/core/wee-debug.c
+++ b/src/core/wee-debug.c
@@ -99,7 +99,8 @@ debug_dump (int crash)
*/
int
-debug_dump_cb (void *data, char *signal, char *type_data, void *signal_data)
+debug_dump_cb (void *data, const char *signal, const char *type_data,
+ void *signal_data)
{
/* make C compiler happy */
(void) data;
@@ -150,7 +151,8 @@ debug_sigsegv ()
*/
int
-debug_buffer_cb (void *data, char *signal, char *type_data, void *signal_data)
+debug_buffer_cb (void *data, const char *signal, const char *type_data,
+ void *signal_data)
{
/* make C compiler happy */
(void) data;
@@ -229,7 +231,8 @@ debug_windows_tree ()
*/
int
-debug_windows_cb (void *data, char *signal, char *type_data, void *signal_data)
+debug_windows_cb (void *data, const char *signal, const char *type_data,
+ void *signal_data)
{
/* make C compiler happy */
(void) data;
diff --git a/src/core/wee-hook.c b/src/core/wee-hook.c
index 43ecb6d8f..98b853e9f 100644
--- a/src/core/wee-hook.c
+++ b/src/core/wee-hook.c
@@ -293,7 +293,7 @@ hook_exec_end ()
*/
struct t_hook *
-hook_search_command (char *command)
+hook_search_command (const char *command)
{
struct t_hook *ptr_hook;
@@ -314,8 +314,10 @@ hook_search_command (char *command)
*/
struct t_hook *
-hook_command (struct t_weechat_plugin *plugin, char *command, char *description,
- char *args, char *args_description, char *completion,
+hook_command (struct t_weechat_plugin *plugin, const char *command,
+ const char *description,
+ const char *args, const char *args_description,
+ const char *completion,
t_hook_callback_command *callback, void *callback_data)
{
struct t_hook *ptr_hook,*new_hook;
@@ -382,7 +384,7 @@ hook_command (struct t_weechat_plugin *plugin, char *command, char *description,
int
hook_command_exec (struct t_gui_buffer *buffer, int any_plugin,
- struct t_weechat_plugin *plugin, char *string)
+ struct t_weechat_plugin *plugin, const char *string)
{
struct t_hook *ptr_hook, *next_hook;
struct t_hook *hook_for_plugin, *hook_for_other_plugin;
@@ -791,8 +793,8 @@ hook_fd_exec (fd_set *read_fds, fd_set *write_fds, fd_set *exception_fds)
*/
struct t_hook *
-hook_connect (struct t_weechat_plugin *plugin, char *address, int port,
- int sock, int ipv6, void *gnutls_sess, char *local_hostname,
+hook_connect (struct t_weechat_plugin *plugin, const char *address, int port,
+ int sock, int ipv6, void *gnutls_sess, const char *local_hostname,
t_hook_callback_connect *callback, void *callback_data)
{
struct t_hook *new_hook;
@@ -847,7 +849,7 @@ hook_connect (struct t_weechat_plugin *plugin, char *address, int port,
struct t_hook *
hook_print (struct t_weechat_plugin *plugin, struct t_gui_buffer *buffer,
- char *tags, char *message, int strip_colors,
+ const char *tags, const char *message, int strip_colors,
t_hook_callback_print *callback, void *callback_data)
{
struct t_hook *new_hook;
@@ -892,7 +894,7 @@ hook_print (struct t_weechat_plugin *plugin, struct t_gui_buffer *buffer,
void
hook_print_exec (struct t_gui_buffer *buffer, time_t date, int tags_count,
- char **tags_array, char *prefix, char *message)
+ char **tags_array, const char *prefix, const char *message)
{
struct t_hook *ptr_hook, *next_hook;
char *prefix_no_color, *message_no_color;
@@ -987,7 +989,7 @@ hook_print_exec (struct t_gui_buffer *buffer, time_t date, int tags_count,
*/
struct t_hook *
-hook_signal (struct t_weechat_plugin *plugin, char *signal,
+hook_signal (struct t_weechat_plugin *plugin, const char *signal,
t_hook_callback_signal *callback, void *callback_data)
{
struct t_hook *new_hook;
@@ -1022,7 +1024,7 @@ hook_signal (struct t_weechat_plugin *plugin, char *signal,
*/
void
-hook_signal_send (char *signal, char *type_data, void *signal_data)
+hook_signal_send (const char *signal, const char *type_data, void *signal_data)
{
struct t_hook *ptr_hook, *next_hook;
@@ -1054,7 +1056,7 @@ hook_signal_send (char *signal, char *type_data, void *signal_data)
*/
struct t_hook *
-hook_config (struct t_weechat_plugin *plugin, char *option,
+hook_config (struct t_weechat_plugin *plugin, const char *option,
t_hook_callback_config *callback, void *callback_data)
{
struct t_hook *new_hook;
@@ -1086,7 +1088,7 @@ hook_config (struct t_weechat_plugin *plugin, char *option,
*/
void
-hook_config_exec (char *option, char *value)
+hook_config_exec (const char *option, const char *value)
{
struct t_hook *ptr_hook, *next_hook;
@@ -1119,7 +1121,7 @@ hook_config_exec (char *option, char *value)
*/
struct t_hook *
-hook_completion (struct t_weechat_plugin *plugin, char *completion,
+hook_completion (struct t_weechat_plugin *plugin, const char *completion,
t_hook_callback_completion *callback, void *callback_data)
{
struct t_hook *new_hook;
@@ -1154,7 +1156,7 @@ hook_completion (struct t_weechat_plugin *plugin, char *completion,
*/
void
-hook_completion_exec (struct t_weechat_plugin *plugin, char *completion,
+hook_completion_exec (struct t_weechat_plugin *plugin, const char *completion,
struct t_gui_buffer *buffer, struct t_weelist *list)
{
struct t_hook *ptr_hook, *next_hook;
@@ -1191,7 +1193,7 @@ hook_completion_exec (struct t_weechat_plugin *plugin, char *completion,
*/
struct t_hook *
-hook_modifier (struct t_weechat_plugin *plugin, char *modifier,
+hook_modifier (struct t_weechat_plugin *plugin, const char *modifier,
t_hook_callback_modifier *callback, void *callback_data)
{
struct t_hook *new_hook;
@@ -1226,8 +1228,8 @@ hook_modifier (struct t_weechat_plugin *plugin, char *modifier,
*/
char *
-hook_modifier_exec (struct t_weechat_plugin *plugin, char *modifier,
- char *modifier_data, char *string)
+hook_modifier_exec (struct t_weechat_plugin *plugin, const char *modifier,
+ const char *modifier_data, const char *string)
{
struct t_hook *ptr_hook, *next_hook;
char *new_msg, *message_modified;
diff --git a/src/core/wee-hook.h b/src/core/wee-hook.h
index 22d7cf552..ab7e7fa4c 100644
--- a/src/core/wee-hook.h
+++ b/src/core/wee-hook.h
@@ -135,8 +135,8 @@ struct t_hook_connect
typedef int (t_hook_callback_print)(void *data, struct t_gui_buffer *buffer,
time_t date, int tags_count,
- char **tags, char *prefix,
- char *message);
+ char **tags, const char *prefix,
+ const char *message);
struct t_hook_print
{
@@ -148,8 +148,8 @@ struct t_hook_print
int strip_colors; /* strip colors in msg for callback? */
};
-typedef int (t_hook_callback_signal)(void *data, char *signal,
- char *type_data, void *signal_data);
+typedef int (t_hook_callback_signal)(void *data, const char *signal,
+ const char *type_data, void *signal_data);
struct t_hook_signal
{
@@ -158,7 +158,8 @@ struct t_hook_signal
/* with "*", "*" == any signal) */
};
-typedef int (t_hook_callback_config)(void *data, char *option, char *value);
+typedef int (t_hook_callback_config)(void *data, const char *option,
+ const char *value);
struct t_hook_config
{
@@ -167,7 +168,7 @@ struct t_hook_config
/* (NULL = hook for all options) */
};
-typedef int (t_hook_callback_completion)(void *data, char *completion,
+typedef int (t_hook_callback_completion)(void *data, const char *completion,
struct t_gui_buffer *buffer,
struct t_weelist *list);
@@ -177,8 +178,9 @@ struct t_hook_completion
char *completion; /* name of completion */
};
-typedef char *(t_hook_callback_modifier)(void *data, char *modifier,
- char *modifier_data, char *string);
+typedef char *(t_hook_callback_modifier)(void *data, const char *modifier,
+ const char *modifier_data,
+ const char *string);
struct t_hook_modifier
{
@@ -198,13 +200,13 @@ extern int hook_valid (struct t_hook *hook);
extern int hook_valid_for_plugin (struct t_weechat_plugin *plugin,
struct t_hook *hook);
extern struct t_hook *hook_command (struct t_weechat_plugin *plugin,
- char *command, char *description,
- char *args, char *args_description,
- char *completion,
+ const char *command, const char *description,
+ const char *args, const char *args_description,
+ const char *completion,
t_hook_callback_command *callback,
void *callback_data);
extern int hook_command_exec (struct t_gui_buffer *buffer, int any_plugin,
- struct t_weechat_plugin *plugin, char *string);
+ struct t_weechat_plugin *plugin, const char *string);
extern struct t_hook *hook_timer (struct t_weechat_plugin *plugin,
long interval, int align_second,
int max_calls,
@@ -222,46 +224,47 @@ extern int hook_fd_set (fd_set *read_fds, fd_set *write_fds,
extern void hook_fd_exec (fd_set *read_fds, fd_set *write_fds,
fd_set *exception_fds);
extern struct t_hook *hook_connect (struct t_weechat_plugin *plugin,
- char *address, int port,
+ const char *address, int port,
int sock, int ipv6, void *gnutls_session,
- char *local_hostname,
+ const char *local_hostname,
t_hook_callback_connect * callback,
void *callback_data);
extern struct t_hook *hook_print (struct t_weechat_plugin *plugin,
struct t_gui_buffer *buffer,
- char *tags, char *message,
+ const char *tags, const char *message,
int strip_colors,
t_hook_callback_print *callback,
void *callback_data);
extern void hook_print_exec (struct t_gui_buffer *buffer,
time_t date, int tags_count,
- char **tags_array, char *prefix,
- char *message);
+ char **tags_array, const char *prefix,
+ const char *message);
extern struct t_hook *hook_signal (struct t_weechat_plugin *plugin,
- char *signal,
+ const char *signal,
t_hook_callback_signal *callback,
void *callback_data);
-extern void hook_signal_send (char *signal, char *type_data,
+extern void hook_signal_send (const char *signal, const char *type_data,
void *signal_data);
-extern struct t_hook *hook_config (struct t_weechat_plugin *, char *option,
+extern struct t_hook *hook_config (struct t_weechat_plugin *, const char *option,
t_hook_callback_config *callback,
void *callback_data);
-extern void hook_config_exec (char *option, char *value);
+extern void hook_config_exec (const char *option, const char *value);
extern struct t_hook *hook_completion (struct t_weechat_plugin *plugin,
- char *completion,
+ const char *completion,
t_hook_callback_completion *callback,
void *callback_data);
extern void hook_completion_exec (struct t_weechat_plugin *plugin,
- char *completion,
+ const char *completion,
struct t_gui_buffer *buffer,
struct t_weelist *list);
extern struct t_hook *hook_modifier (struct t_weechat_plugin *plugin,
- char *modifier,
+ const char *modifier,
t_hook_callback_modifier *callback,
void *callback_data);
extern char *hook_modifier_exec (struct t_weechat_plugin *plugin,
- char *modifier, char *modifier_data,
- char *string);
+ const char *modifier,
+ const char *modifier_data,
+ const char *string);
extern void unhook (struct t_hook *hook);
extern void unhook_all_plugin (struct t_weechat_plugin *plugin);
extern void unhook_all ();
diff --git a/src/core/wee-input.c b/src/core/wee-input.c
index f2f3adc59..c42a519e9 100644
--- a/src/core/wee-input.c
+++ b/src/core/wee-input.c
@@ -42,7 +42,7 @@
*/
int
-input_is_command (char *line)
+input_is_command (const char *line)
{
char *pos_slash, *pos_space;
@@ -69,7 +69,7 @@ int
input_exec_command (struct t_gui_buffer *buffer,
int any_plugin,
struct t_weechat_plugin *plugin,
- char *string)
+ const char *string)
{
int rc;
char *command, *pos, *ptr_args;
@@ -136,9 +136,10 @@ input_exec_command (struct t_gui_buffer *buffer,
*/
void
-input_data (struct t_gui_buffer *buffer, char *data)
+input_data (struct t_gui_buffer *buffer, const char *data)
{
- char *new_data, *ptr_data, *pos;
+ char *new_data, *pos;
+ const char *ptr_data;
if (!buffer || !data || !data[0] || (data[0] == '\r') || (data[0] == '\n'))
return;
diff --git a/src/core/wee-input.h b/src/core/wee-input.h
index 52420b9cd..0e40b95b4 100644
--- a/src/core/wee-input.h
+++ b/src/core/wee-input.h
@@ -26,7 +26,7 @@ struct t_weechat_plugin;
extern int input_exec_command (struct t_gui_buffer *buffer,
int any_plugin,
struct t_weechat_plugin *plugin,
- char *string);
-extern void input_data (struct t_gui_buffer *buffer, char *data);
+ const char *string);
+extern void input_data (struct t_gui_buffer *buffer, const char *data);
#endif /* wee-input.h */
diff --git a/src/core/wee-list.c b/src/core/wee-list.c
index fc67789f7..7d1c80c36 100644
--- a/src/core/wee-list.c
+++ b/src/core/wee-list.c
@@ -56,7 +56,7 @@ weelist_new ()
*/
struct t_weelist_item *
-weelist_find_pos (struct t_weelist *weelist, char *data)
+weelist_find_pos (struct t_weelist *weelist, const char *data)
{
struct t_weelist_item *ptr_item;
@@ -79,7 +79,7 @@ weelist_find_pos (struct t_weelist *weelist, char *data)
void
weelist_insert (struct t_weelist *weelist, struct t_weelist_item *item,
- char *where)
+ const char *where)
{
struct t_weelist_item *pos_item;
@@ -139,7 +139,7 @@ weelist_insert (struct t_weelist *weelist, struct t_weelist_item *item,
*/
struct t_weelist_item *
-weelist_add (struct t_weelist *weelist, char *data, char *where)
+weelist_add (struct t_weelist *weelist, const char *data, const char *where)
{
struct t_weelist_item *new_item;
@@ -161,7 +161,7 @@ weelist_add (struct t_weelist *weelist, char *data, char *where)
*/
struct t_weelist_item *
-weelist_search (struct t_weelist *weelist, char *data)
+weelist_search (struct t_weelist *weelist, const char *data)
{
struct t_weelist_item *ptr_item;
@@ -183,7 +183,7 @@ weelist_search (struct t_weelist *weelist, char *data)
*/
struct t_weelist_item *
-weelist_casesearch (struct t_weelist *weelist, char *data)
+weelist_casesearch (struct t_weelist *weelist, const char *data)
{
struct t_weelist_item *ptr_item;
@@ -231,7 +231,7 @@ weelist_get (struct t_weelist *weelist, int position)
*/
void
-weelist_set (struct t_weelist_item *item, char *value)
+weelist_set (struct t_weelist_item *item, const char *value)
{
if (!item || !value)
return;
@@ -363,7 +363,7 @@ weelist_free (struct t_weelist *weelist)
*/
void
-weelist_print_log (struct t_weelist *weelist, char *name)
+weelist_print_log (struct t_weelist *weelist, const char *name)
{
struct t_weelist_item *ptr_item;
diff --git a/src/core/wee-list.h b/src/core/wee-list.h
index c992b9b41..01deee6e3 100644
--- a/src/core/wee-list.h
+++ b/src/core/wee-list.h
@@ -36,14 +36,14 @@ struct t_weelist
extern struct t_weelist *weelist_new ();
extern struct t_weelist_item *weelist_add (struct t_weelist *weelist,
- char *data, char *where);
+ const char *data, const char *where);
extern struct t_weelist_item *weelist_search (struct t_weelist *weelist,
- char *data);
+ const char *data);
extern struct t_weelist_item *weelist_casesearch (struct t_weelist *weelist,
- char *data);
+ const char *data);
extern struct t_weelist_item *weelist_get (struct t_weelist *weelist,
int position);
-extern void weelist_set (struct t_weelist_item *item, char *value);
+extern void weelist_set (struct t_weelist_item *item, const char *value);
extern struct t_weelist_item *weelist_next (struct t_weelist_item *item);
extern struct t_weelist_item *weelist_prev (struct t_weelist_item *item);
extern char *weelist_string (struct t_weelist_item *item);
@@ -52,6 +52,6 @@ extern void weelist_remove (struct t_weelist *weelist,
struct t_weelist_item *item);
extern void weelist_remove_all (struct t_weelist *weelist);
extern void weelist_free (struct t_weelist *weelist);
-extern void weelist_print_log (struct t_weelist *weelist, char *name);
+extern void weelist_print_log (struct t_weelist *weelist, const char *name);
#endif /* wee-list.h */
diff --git a/src/core/wee-log.c b/src/core/wee-log.c
index e5cd098d7..0b3e7d420 100644
--- a/src/core/wee-log.c
+++ b/src/core/wee-log.c
@@ -50,7 +50,7 @@ FILE *weechat_log_file = NULL; /* WeeChat log file */
*/
int
-log_open (char *filename, char *mode)
+log_open (const char *filename, const char *mode)
{
int filename_length;
@@ -117,7 +117,7 @@ log_init ()
*/
void
-log_printf (char *message, ...)
+log_printf (const char *message, ...)
{
static char buffer[4096];
char *ptr_buffer;
diff --git a/src/core/wee-log.h b/src/core/wee-log.h
index 2b1936487..e587b0864 100644
--- a/src/core/wee-log.h
+++ b/src/core/wee-log.h
@@ -25,7 +25,7 @@ extern FILE *weechat_log_file;
extern void log_init ();
extern void log_close ();
-extern void log_printf (char *message, ...);
+extern void log_printf (const char *message, ...);
extern int log_crash_rename ();
#endif /* wee-log.h */
diff --git a/src/core/wee-network.c b/src/core/wee-network.c
index 50cc63d02..33c031cca 100644
--- a/src/core/wee-network.c
+++ b/src/core/wee-network.c
@@ -90,7 +90,7 @@ network_end ()
*/
void
-network_convbase64_8x3_to_6x4 (char *from, char *to)
+network_convbase64_8x3_to_6x4 (const char *from, char *to)
{
unsigned char base64_table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz0123456789+/";
@@ -106,9 +106,10 @@ network_convbase64_8x3_to_6x4 (char *from, char *to)
*/
void
-network_base64encode (char *from, char *to)
+network_base64encode (const char *from, char *to)
{
- char *f, *t;
+ const char *f;
+ char *t;
int from_len;
from_len = strlen (from);
@@ -153,9 +154,8 @@ network_base64encode (char *from, char *to)
*/
int
-network_pass_httpproxy (int sock, char *address, int port)
+network_pass_httpproxy (int sock, const char *address, int port)
{
-
char buffer[256], authbuf[128], authbuf_base64[196];
int n, m;
@@ -204,7 +204,7 @@ network_pass_httpproxy (int sock, char *address, int port)
*/
int
-network_resolve (char *hostname, char *ip, int *version)
+network_resolve (const char *hostname, char *ip, int *version)
{
char ipbuffer[NI_MAXHOST];
struct addrinfo *res;
@@ -248,7 +248,7 @@ network_resolve (char *hostname, char *ip, int *version)
*/
int
-network_pass_socks4proxy (int sock, char *address, int port)
+network_pass_socks4proxy (int sock, const char *address, int port)
{
/*
* socks4 protocol is explained here:
@@ -294,7 +294,7 @@ network_pass_socks4proxy (int sock, char *address, int port)
*/
int
-network_pass_socks5proxy (int sock, char *address, int port)
+network_pass_socks5proxy (int sock, const char *address, int port)
{
/*
* socks5 protocol is explained in RFC 1928
@@ -440,7 +440,7 @@ network_pass_socks5proxy (int sock, char *address, int port)
*/
int
-network_pass_proxy (int sock, char *address, int port)
+network_pass_proxy (int sock, const char *address, int port)
{
int rc;
diff --git a/src/core/wee-network.h b/src/core/wee-network.h
index 1b6e4cf5c..4f8031d57 100644
--- a/src/core/wee-network.h
+++ b/src/core/wee-network.h
@@ -24,7 +24,7 @@ struct t_hook;
extern void network_init ();
extern void network_end ();
-extern int network_pass_proxy (int sock, char *address, int port);
+extern int network_pass_proxy (int sock, const char *address, int port);
extern int network_connect_to (int sock, unsigned long address, int port);
extern void network_connect_with_fork (struct t_hook *);
diff --git a/src/core/wee-string.c b/src/core/wee-string.c
index 9c69d7f06..15607d50f 100644
--- a/src/core/wee-string.c
+++ b/src/core/wee-string.c
@@ -59,7 +59,7 @@
*/
char *
-string_strndup (char *string, int length)
+string_strndup (const char *string, int length)
{
char *result;
@@ -111,7 +111,7 @@ string_toupper (char *string)
*/
int
-string_strcasecmp (char *string1, char *string2)
+string_strcasecmp (const char *string1, const char *string2)
{
int diff;
@@ -137,7 +137,7 @@ string_strcasecmp (char *string1, char *string2)
*/
int
-string_strncasecmp (char *string1, char *string2, int max)
+string_strncasecmp (const char *string1, const char *string2, int max)
{
int count, diff;
@@ -167,8 +167,8 @@ string_strncasecmp (char *string1, char *string2, int max)
*/
int
-string_strcmp_ignore_chars (char *string1, char *string2, char *chars_ignored,
- int case_sensitive)
+string_strcmp_ignore_chars (const char *string1, const char *string2,
+ const char *chars_ignored, int case_sensitive)
{
int diff;
@@ -230,7 +230,7 @@ string_strcmp_ignore_chars (char *string1, char *string2, char *chars_ignored,
*/
char *
-string_strcasestr (char *string, char *search)
+string_strcasestr (const char *string, const char *search)
{
int length_search;
@@ -242,7 +242,7 @@ string_strcasestr (char *string, char *search)
while (string[0])
{
if (string_strncasecmp (string, search, length_search) == 0)
- return string;
+ return (char *)string;
string++;
}
@@ -257,7 +257,7 @@ string_strcasestr (char *string, char *search)
*/
int
-string_match (char *string, char *mask, int case_sensitive)
+string_match (const char *string, const char *mask, int case_sensitive)
{
char last, *mask2;
int len_string, len_mask, rc;
@@ -340,9 +340,10 @@ string_match (char *string, char *mask, int case_sensitive)
*/
char *
-string_replace (char *string, char *search, char *replace)
+string_replace (const char *string, const char *search, const char *replace)
{
- char *pos, *new_string;
+ const char *pos;
+ char *new_string;
int length1, length2, length_new, count;
if (!string || !search || !replace)
@@ -398,10 +399,10 @@ string_replace (char *string, char *search, char *replace)
*/
char *
-string_remove_quotes (char *string, char *quotes)
+string_remove_quotes (const char *string, const char *quotes)
{
int length;
- char *pos_start, *pos_end;
+ const char *pos_start, *pos_end;
if (!string || !quotes)
return NULL;
@@ -435,12 +436,13 @@ string_remove_quotes (char *string, char *quotes)
/*
* string_strip: strip chars at beginning and/or end of string
+ * note: returned value has to be free() after use
*/
char *
-string_strip (char *string, int left, int right, char *chars)
+string_strip (const char *string, int left, int right, const char *chars)
{
- char *ptr_start, *ptr_end;
+ const char *ptr_start, *ptr_end;
if (!string)
return NULL;
@@ -476,10 +478,11 @@ string_strip (char *string, int left, int right, char *chars)
/*
* string_convert_hex_chars: convert hex chars (\x??) to value
+ * note: returned value has to be free() after use
*/
char *
-string_convert_hex_chars (char *string)
+string_convert_hex_chars (const char *string)
{
char *output, hex_str[8], *error;
int pos_output;
@@ -550,7 +553,7 @@ string_convert_hex_chars (char *string)
*/
wint_t
-string_get_wide_char (char *string)
+string_get_wide_char (const char *string)
{
int char_size;
wint_t result;
@@ -590,7 +593,7 @@ string_get_wide_char (char *string)
*/
int
-string_is_word_char (char *string)
+string_is_word_char (const char *string)
{
wint_t c = string_get_wide_char (string);
@@ -619,7 +622,7 @@ string_is_word_char (char *string)
*/
int
-string_has_highlight (char *string, char *highlight_words)
+string_has_highlight (const char *string, const char *highlight_words)
{
char *msg, *highlight, *match, *match_pre, *match_post, *msg_pos, *pos, *pos_end;
int end, length, startswith, endswith, wildcard_start, wildcard_end;
@@ -728,7 +731,7 @@ string_has_highlight (char *string, char *highlight_words)
*/
char **
-string_explode (char *string, char *separators, int keep_eol,
+string_explode (const char *string, const char *separators, int keep_eol,
int num_items_max, int *num_items)
{
int i, n_items;
@@ -851,7 +854,7 @@ string_free_exploded (char **exploded_string)
*/
char *
-string_build_with_exploded (char **exploded_string, char *separator)
+string_build_with_exploded (char **exploded_string, const char *separator)
{
int i, length, length_separator;
char *result;
@@ -889,11 +892,12 @@ string_build_with_exploded (char **exploded_string, char *separator)
*/
char **
-string_split_command (char *command, char separator)
+string_split_command (const char *command, char separator)
{
int nb_substr, arr_idx, str_idx, type;
char **array;
- char *buffer, *ptr, *p;
+ char *buffer, *p;
+ const char *ptr;
if (!command || !command[0])
return NULL;
@@ -985,10 +989,12 @@ string_free_splitted_command (char **splitted_command)
/*
* string_iconv: convert string to another charset
+ * note: returned value has to be free() after use
*/
char *
-string_iconv (int from_utf8, char *from_code, char *to_code, char *string)
+string_iconv (int from_utf8, const char *from_code, const char *to_code,
+ const char *string)
{
char *outbuf;
@@ -1090,10 +1096,11 @@ string_iconv (int from_utf8, char *from_code, char *to_code, char *string)
/*
* string_iconv_to_internal: convert user string (input, script, ..) to
* WeeChat internal storage charset
+ * note: returned value has to be free() after use
*/
char *
-string_iconv_to_internal (char *charset, char *string)
+string_iconv_to_internal (const char *charset, const char *string)
{
char *input, *output;
@@ -1127,10 +1134,11 @@ string_iconv_to_internal (char *charset, char *string)
/*
* string_iconv_from_internal: convert internal string to terminal charset,
* for display
+ * note: returned value has to be free() after use
*/
char *
-string_iconv_from_internal (char *charset, char *string)
+string_iconv_from_internal (const char *charset, const char *string)
{
char *input, *output;
@@ -1163,7 +1171,7 @@ string_iconv_from_internal (char *charset, char *string)
*/
void
-string_iconv_fprintf (FILE *file, char *data, ...)
+string_iconv_fprintf (FILE *file, const char *data, ...)
{
va_list argptr;
char *buf, *buf2;
diff --git a/src/core/wee-string.h b/src/core/wee-string.h
index 648599079..62df98f7f 100644
--- a/src/core/wee-string.h
+++ b/src/core/wee-string.h
@@ -20,31 +20,39 @@
#ifndef __WEECHAT_STRING_H
#define __WEECHAT_STRING_H 1
-extern char *string_strndup (char *string, int length);
+extern char *string_strndup (const char *string, int length);
extern void string_tolower (char *string);
extern void string_toupper (char *string);
-extern int string_strcasecmp (char *string1, char *string2);
-extern int string_strncasecmp (char *string1, char *string2, int max);
-extern int string_strcmp_ignore_chars (char *string1, char *string2,
- char *chars_ignored, int case_sensitive);
-extern char *string_strcasestr (char *string, char *search);
-extern int string_match (char *string, char *mask, int case_sensitive);
-extern char *string_replace (char *string, char *search, char *replace);
-extern char *string_remove_quotes (char *string, char *quotes);
-extern char *string_strip (char *string, int left, int right, char *chars);
-extern char *string_convert_hex_chars (char *string);
-extern int string_has_highlight (char *string, char *highlight_words);
-extern char **string_explode (char *string, char *separators, int keep_eol,
- int num_items_max, int *num_items);
+extern int string_strcasecmp (const char *string1, const char *string2);
+extern int string_strncasecmp (const char *string1, const char *string2,
+ int max);
+extern int string_strcmp_ignore_chars (const char *string1,
+ const char *string2,
+ const char *chars_ignored,
+ int case_sensitive);
+extern char *string_strcasestr (const char *string, const char *search);
+extern int string_match (const char *string, const char *mask,
+ int case_sensitive);
+extern char *string_replace (const char *string, const char *search,
+ const char *replace);
+extern char *string_remove_quotes (const char *string, const char *quotes);
+extern char *string_strip (const char *string, int left, int right,
+ const char *chars);
+extern char *string_convert_hex_chars (const char *string);
+extern int string_has_highlight (const char *string,
+ const char *highlight_words);
+extern char **string_explode (const char *string, const char *separators,
+ int keep_eol, int num_items_max, int *num_items);
extern void string_free_exploded (char **exploded_string);
extern char *string_build_with_exploded (char **exploded_string,
- char *separator);
-extern char **string_split_command (char *command, char separator);
+ const char *separator);
+extern char **string_split_command (const char *command, char separator);
extern void string_free_splitted_command (char **splitted_command);
-extern char *string_iconv (int from_utf8, char *from_code, char *to_code,
- char *string);
-extern char *string_iconv_to_internal (char *charset, char *string);
-extern char *string_iconv_from_internal (char *charset, char *string);
-extern void string_iconv_fprintf (FILE *file, char *data, ...);
+extern char *string_iconv (int from_utf8, const char *from_code,
+ const char *to_code, const char *string);
+extern char *string_iconv_to_internal (const char *charset, const char *string);
+extern char *string_iconv_from_internal (const char *charset,
+ const char *string);
+extern void string_iconv_fprintf (FILE *file, const char *data, ...);
#endif /* wee-string.h */
diff --git a/src/core/wee-upgrade.c b/src/core/wee-upgrade.c
index a50619e8f..2213fb6ed 100644
--- a/src/core/wee-upgrade.c
+++ b/src/core/wee-upgrade.c
@@ -86,7 +86,7 @@ session_write_int (FILE *file, int id, int value)
*/
int
-session_write_str (FILE *file, int id, char *string)
+session_write_str (FILE *file, int id, const char *string)
{
char type;
int length;
@@ -470,7 +470,7 @@ session_save_hotlist (FILE *file)
*/
/*int
-session_save (char *filename)
+session_save (const char *filename)
{
FILE *file;
int rc;
@@ -499,7 +499,7 @@ session_save (char *filename)
*/
void
-session_crash (FILE *file, char *message, ...)
+session_crash (FILE *file, const char *message, ...)
{
char buf[4096];
va_list argptr;
@@ -1718,7 +1718,7 @@ session_load_hotlist (FILE *file)
*/
/*int
-session_load (char *filename)
+session_load (const char *filename)
{
FILE *file;
char *signature;
diff --git a/src/core/wee-upgrade.h b/src/core/wee-upgrade.h
index 23d5f0dce..3662199ac 100644
--- a/src/core/wee-upgrade.h
+++ b/src/core/wee-upgrade.h
@@ -199,7 +199,7 @@ enum t_session_hotlist
SESSION_HOTL_CREATION_TIME
};
-int session_save (char *filename);
-int session_load (char *filename);
+int session_save (const char *filename);
+int session_load (const char *filename);
#endif /* wee-upgrade.h */
diff --git a/src/core/wee-utf8.c b/src/core/wee-utf8.c
index 7dbb5ac8c..2b4108374 100644
--- a/src/core/wee-utf8.c
+++ b/src/core/wee-utf8.c
@@ -49,7 +49,7 @@ utf8_init ()
*/
int
-utf8_has_8bits (char *string)
+utf8_has_8bits (const char *string)
{
while (string && string[0])
{
@@ -67,7 +67,7 @@ utf8_has_8bits (char *string)
*/
int
-utf8_is_valid (char *string, char **error)
+utf8_is_valid (const char *string, char **error)
{
while (string && string[0])
{
@@ -77,7 +77,7 @@ utf8_is_valid (char *string, char **error)
if (!string[1] || (((unsigned char)(string[1]) & 0xC0) != 0x80))
{
if (error)
- *error = string;
+ *error = (char *)string;
return 0;
}
string += 2;
@@ -90,7 +90,7 @@ utf8_is_valid (char *string, char **error)
|| (((unsigned char)(string[2]) & 0xC0) != 0x80))
{
if (error)
- *error = string;
+ *error = (char *)string;
return 0;
}
string += 3;
@@ -104,7 +104,7 @@ utf8_is_valid (char *string, char **error)
|| (((unsigned char)(string[3]) & 0xC0) != 0x80))
{
if (error)
- *error = string;
+ *error = (char *)string;
return 0;
}
string += 4;
@@ -113,7 +113,7 @@ utf8_is_valid (char *string, char **error)
else if ((unsigned char)(string[0]) >= 0x80)
{
if (error)
- *error = string;
+ *error = (char *)string;
return 0;
}
else
@@ -130,7 +130,7 @@ utf8_is_valid (char *string, char **error)
*/
void
-utf8_normalize (char *string, char replacement)
+utf8_normalize (const char *string, char replacement)
{
char *error;
@@ -148,7 +148,7 @@ utf8_normalize (char *string, char replacement)
*/
char *
-utf8_prev_char (char *string_start, char *string)
+utf8_prev_char (const char *string_start, const char *string)
{
if (!string || (string <= string_start))
return NULL;
@@ -160,28 +160,28 @@ utf8_prev_char (char *string_start, char *string)
/* UTF-8, at least 2 bytes */
string--;
if (string < string_start)
- return string + 1;
+ return (char *)string + 1;
if (((unsigned char)(string[0]) & 0xC0) == 0x80)
{
/* UTF-8, at least 3 bytes */
string--;
if (string < string_start)
- return string + 1;
+ return (char *)string + 1;
if (((unsigned char)(string[0]) & 0xC0) == 0x80)
{
/* UTF-8, 4 bytes */
string--;
if (string < string_start)
- return string + 1;
- return string;
+ return (char *)string + 1;
+ return (char *)string;
}
else
- return string;
+ return (char *)string;
}
else
- return string;
+ return (char *)string;
}
- return string;
+ return (char *)string;
}
/*
@@ -189,7 +189,7 @@ utf8_prev_char (char *string_start, char *string)
*/
char *
-utf8_next_char (char *string)
+utf8_next_char (const char *string)
{
if (!string)
return NULL;
@@ -198,31 +198,31 @@ utf8_next_char (char *string)
if (((unsigned char)(string[0]) & 0xE0) == 0xC0)
{
if (!string[1])
- return string + 1;
- return string + 2;
+ return (char *)string + 1;
+ return (char *)string + 2;
}
/* UTF-8, 3 bytes: 1110vvvv 10vvvvvv 10vvvvvv */
else if (((unsigned char)(string[0]) & 0xF0) == 0xE0)
{
if (!string[1])
- return string + 1;
+ return (char *)string + 1;
if (!string[2])
- return string + 2;
- return string + 3;
+ return (char *)string + 2;
+ return (char *)string + 3;
}
/* UTF-8, 4 bytes: 11110vvv 10vvvvvv 10vvvvvv 10vvvvvv */
else if (((unsigned char)(string[0]) & 0xF8) == 0xF0)
{
if (!string[1])
- return string + 1;
+ return (char *)string + 1;
if (!string[2])
- return string + 2;
+ return (char *)string + 2;
if (!string[3])
- return string + 3;
- return string + 4;
+ return (char *)string + 3;
+ return (char *)string + 4;
}
/* UTF-8, 1 byte: 0vvvvvvv */
- return string + 1;
+ return (char *)string + 1;
}
/*
@@ -230,7 +230,7 @@ utf8_next_char (char *string)
*/
int
-utf8_char_size (char *string)
+utf8_char_size (const char *string)
{
if (!string)
return 0;
@@ -243,7 +243,7 @@ utf8_char_size (char *string)
*/
int
-utf8_strlen (char *string)
+utf8_strlen (const char *string)
{
int length;
@@ -264,7 +264,7 @@ utf8_strlen (char *string)
*/
int
-utf8_strnlen (char *string, int bytes)
+utf8_strnlen (const char *string, int bytes)
{
char *start;
int length;
@@ -272,7 +272,7 @@ utf8_strnlen (char *string, int bytes)
if (!string)
return 0;
- start = string;
+ start = (char *)string;
length = 0;
while (string && string[0] && (string - start < bytes))
{
@@ -288,7 +288,7 @@ utf8_strnlen (char *string, int bytes)
*/
int
-utf8_strlen_screen (char *string)
+utf8_strlen_screen (const char *string)
{
int length, num_char;
wchar_t *wstring;
@@ -320,7 +320,7 @@ utf8_strlen_screen (char *string)
*/
int
-utf8_charcasecmp (char *string1, char *string2)
+utf8_charcasecmp (const char *string1, const char *string2)
{
int length1, length2, i, char1, char2, diff;
@@ -367,7 +367,7 @@ utf8_charcasecmp (char *string1, char *string2)
*/
int
-utf8_char_size_screen (char *string)
+utf8_char_size_screen (const char *string)
{
int char_size;
char utf_char[16];
@@ -390,12 +390,12 @@ utf8_char_size_screen (char *string)
*/
char *
-utf8_add_offset (char *string, int offset)
+utf8_add_offset (const char *string, int offset)
{
int count;
if (!string)
- return string;
+ return NULL;
count = 0;
while (string && string[0] && (count < offset))
@@ -403,7 +403,7 @@ utf8_add_offset (char *string, int offset)
string = utf8_next_char (string);
count++;
}
- return string;
+ return (char *)string;
}
/*
@@ -412,7 +412,7 @@ utf8_add_offset (char *string, int offset)
*/
int
-utf8_real_pos (char *string, int pos)
+utf8_real_pos (const char *string, int pos)
{
int count, real_pos;
char *next_char;
@@ -438,7 +438,7 @@ utf8_real_pos (char *string, int pos)
*/
int
-utf8_pos (char *string, int real_pos)
+utf8_pos (const char *string, int real_pos)
{
int count;
char *limit;
@@ -447,7 +447,7 @@ utf8_pos (char *string, int real_pos)
return real_pos;
count = 0;
- limit = string + real_pos;
+ limit = (char *)string + real_pos;
while (string && string[0] && (string < limit))
{
string = utf8_next_char (string);
diff --git a/src/core/wee-utf8.h b/src/core/wee-utf8.h
index 8dc9d3d90..219a9fd82 100644
--- a/src/core/wee-utf8.h
+++ b/src/core/wee-utf8.h
@@ -33,19 +33,19 @@
extern int local_utf8;
extern void utf8_init ();
-extern int utf8_has_8bits (char *string);
-extern int utf8_is_valid (char *string, char **error);
-extern void utf8_normalize (char *string, char replacement);
-extern char *utf8_prev_char (char *string_start, char *string);
-extern char *utf8_next_char (char *string);
-extern int utf8_char_size (char *string);
-extern int utf8_strlen (char *string);
-extern int utf8_strnlen (char *string, int bytes);
-extern int utf8_strlen_screen (char *string);
-extern int utf8_charcasecmp (char *string1, char *string2);
-extern int utf8_char_size_screen (char *string);
-extern char *utf8_add_offset (char *string, int offset);
-extern int utf8_real_pos (char *string, int pos);
-extern int utf8_pos (char *string, int real_pos);
+extern int utf8_has_8bits (const char *string);
+extern int utf8_is_valid (const char *string, char **error);
+extern void utf8_normalize (const char *string, char replacement);
+extern char *utf8_prev_char (const char *string_start, const char *string);
+extern char *utf8_next_char (const char *string);
+extern int utf8_char_size (const char *string);
+extern int utf8_strlen (const char *string);
+extern int utf8_strnlen (const char *string, int bytes);
+extern int utf8_strlen_screen (const char *string);
+extern int utf8_charcasecmp (const char *string1, const char *string2);
+extern int utf8_char_size_screen (const char *string);
+extern char *utf8_add_offset (const char *string, int offset);
+extern int utf8_real_pos (const char *string, int pos);
+extern int utf8_pos (const char *string, int real_pos);
#endif /* wee-utf8.h */
diff --git a/src/core/wee-util.c b/src/core/wee-util.c
index abac472ea..6407b1ab2 100644
--- a/src/core/wee-util.c
+++ b/src/core/wee-util.c
@@ -106,7 +106,7 @@ util_timeval_add (struct timeval *tv, long interval)
*/
int
-util_get_time_length (char *time_format)
+util_get_time_length (const char *time_format)
{
time_t date;
struct tm *local_time;
@@ -144,7 +144,7 @@ util_catch_signal (int signum, void (*handler)(int))
*/
int
-util_create_dir (char *directory, int permissions)
+util_create_dir (const char *directory, int permissions)
{
if (mkdir (directory, 0755) < 0)
{
@@ -169,8 +169,8 @@ util_create_dir (char *directory, int permissions)
*/
void
-util_exec_on_files (char *directory, void *data,
- int (*callback)(void *data, char *filename))
+util_exec_on_files (const char *directory, void *data,
+ int (*callback)(void *data, const char *filename))
{
char complete_filename[1024];
DIR *dir;
@@ -209,7 +209,7 @@ util_exec_on_files (char *directory, void *data,
*/
char *
-util_search_full_lib_name (char *filename, char *sys_directory)
+util_search_full_lib_name (const char *filename, const char *sys_directory)
{
char *name_with_ext, *final_name;
int length;
@@ -279,7 +279,7 @@ util_search_full_lib_name (char *filename, char *sys_directory)
*/
int
-util_weechat_version_cmp (char *version1, char *version2)
+util_weechat_version_cmp (const char *version1, const char *version2)
{
char *v1, *v2, *ptr_v1, *ptr_v2, *pos1, *pos2, *next1, *next2;
char *error1, *error2;
diff --git a/src/core/wee-util.h b/src/core/wee-util.h
index 1e6ceed4b..c94003f05 100644
--- a/src/core/wee-util.h
+++ b/src/core/wee-util.h
@@ -23,12 +23,15 @@
extern int util_timeval_cmp (struct timeval *tv1, struct timeval *tv2);
extern long util_timeval_diff (struct timeval *tv1, struct timeval *tv2);
extern void util_timeval_add (struct timeval *tv, long interval);
-extern int util_get_time_length (char *time_format);
+extern int util_get_time_length (const char *time_format);
extern void util_catch_signal (int signum, void (*handler)(int));
-extern int util_create_dir (char *directory, int permissions);
-extern void util_exec_on_files (char *directory, void *data,
- int (*callback)(void *data, char *filename));
-extern char *util_search_full_lib_name (char *filename, char *sys_directory);
-extern int util_weechat_version_cmp (char *version1, char *version2);
+extern int util_create_dir (const char *directory, int permissions);
+extern void util_exec_on_files (const char *directory, void *data,
+ int (*callback)(void *data,
+ const char *filename));
+extern char *util_search_full_lib_name (const char *filename,
+ const char *sys_directory);
+extern int util_weechat_version_cmp (const char *version1,
+ const char *version2);
#endif /* wee-util.h */
diff --git a/src/gui/curses/gui-curses-bar.c b/src/gui/curses/gui-curses-bar.c
index fd644ad05..fac44ef65 100644
--- a/src/gui/curses/gui-curses-bar.c
+++ b/src/gui/curses/gui-curses-bar.c
@@ -574,7 +574,7 @@ gui_bar_window_add_missing_bars (struct t_gui_window *window)
void
gui_bar_window_print_string (struct t_gui_bar_window *bar_window,
- int *x, int *y, char *string)
+ int *x, int *y, const char *string)
{
int weechat_color, size_on_screen, fg, bg;
char str_fg[3], str_bg[3], utf_char[16], *next_char, *output;
diff --git a/src/gui/curses/gui-curses-chat.c b/src/gui/curses/gui-curses-chat.c
index 77f2963f5..c4d1be26d 100644
--- a/src/gui/curses/gui-curses-chat.c
+++ b/src/gui/curses/gui-curses-chat.c
@@ -213,8 +213,8 @@ gui_chat_display_horizontal_line (struct t_gui_window *window, int simulate)
*/
char *
-gui_chat_string_next_char (struct t_gui_window *window, unsigned char *string,
- int apply_style)
+gui_chat_string_next_char (struct t_gui_window *window,
+ const unsigned char *string, int apply_style)
{
char str_fg[3], str_bg[3];
int weechat_color, fg, bg;
@@ -375,7 +375,7 @@ gui_chat_string_next_char (struct t_gui_window *window, unsigned char *string,
*/
void
-gui_chat_display_word_raw (struct t_gui_window *window, char *string,
+gui_chat_display_word_raw (struct t_gui_window *window, const char *string,
int max_chars_on_screen, int display)
{
char *next_char, *output, utf_char[16], chars_displayed, size_on_screen;
diff --git a/src/gui/curses/gui-curses-color.c b/src/gui/curses/gui-curses-color.c
index 74c962904..3eb699f2d 100644
--- a/src/gui/curses/gui-curses-color.c
+++ b/src/gui/curses/gui-curses-color.c
@@ -62,7 +62,7 @@ struct t_gui_color gui_weechat_colors[GUI_CURSES_NUM_WEECHAT_COLORS + 1] =
*/
int
-gui_color_search (char *color_name)
+gui_color_search (const char *color_name)
{
int i;
@@ -82,7 +82,7 @@ gui_color_search (char *color_name)
*/
/*void
-gui_color_get_fg_bg (char *string, char **fg, char **bg)
+gui_color_get_fg_bg (const char *string, const char **fg, const char **bg)
{
char *pos, *pos_end_fg;
@@ -124,7 +124,7 @@ gui_color_get_fg_bg (char *string, char **fg, char **bg)
*/
int
-gui_color_assign (int *color, char *color_name)
+gui_color_assign (int *color, const char *color_name)
{
int i;
@@ -149,7 +149,7 @@ gui_color_assign (int *color, char *color_name)
*/
/*void
-gui_color_assign (t_gui_color **color, char *fg_and_bg)
+gui_color_assign (t_gui_color **color, const char *fg_and_bg)
{
char *color_fg, *color_bg, *color_fg2, *color_bg2;
int value_fg, value_bg;
diff --git a/src/gui/curses/gui-curses-window.c b/src/gui/curses/gui-curses-window.c
index d92d1052a..8420398b1 100644
--- a/src/gui/curses/gui-curses-window.c
+++ b/src/gui/curses/gui-curses-window.c
@@ -158,7 +158,7 @@ gui_window_objects_free (struct t_gui_window *window, int free_separator,
*/
int
-gui_window_utf_char_valid (char *utf_char)
+gui_window_utf_char_valid (const char *utf_char)
{
/* 146 or 0x7F are not valid */
if ((((unsigned char)(utf_char[0]) == 146)
@@ -175,7 +175,7 @@ gui_window_utf_char_valid (char *utf_char)
*/
void
-gui_window_wprintw (WINDOW *window, char *data, ...)
+gui_window_wprintw (WINDOW *window, const char *data, ...)
{
va_list argptr;
static char buf[4096];
diff --git a/src/gui/curses/gui-curses.h b/src/gui/curses/gui-curses.h
index 87d1f2675..01580142d 100644
--- a/src/gui/curses/gui-curses.h
+++ b/src/gui/curses/gui-curses.h
@@ -90,8 +90,8 @@ extern void gui_keyboard_default_bindings ();
extern int gui_keyboard_read_cb (void *data);
/* window functions */
-extern int gui_window_utf_char_valid (char *utf_char);
-extern void gui_window_wprintw (WINDOW *window, char *data, ...);
+extern int gui_window_utf_char_valid (const char *utf_char);
+extern void gui_window_wprintw (WINDOW *window, const char *data, ...);
extern void gui_window_clear_weechat (WINDOW *window, int num_color);
extern void gui_window_clear (WINDOW *window, int bg);
extern void gui_window_reset_style (WINDOW *window, int num_color);
diff --git a/src/gui/gtk/gui-gtk-bar.c b/src/gui/gtk/gui-gtk-bar.c
index 60fac1be7..1c2e821c1 100644
--- a/src/gui/gtk/gui-gtk-bar.c
+++ b/src/gui/gtk/gui-gtk-bar.c
@@ -296,7 +296,7 @@ gui_bar_window_add_missing_bars (struct t_gui_window *window)
int
gui_bar_window_print_string (struct t_gui_bar_window *bar_window,
- char *string, int max_chars)
+ const char *string, int max_chars)
{
(void) bar_window;
(void) string;
diff --git a/src/gui/gtk/gui-gtk-chat.c b/src/gui/gtk/gui-gtk-chat.c
index e001e0c59..271a8a811 100644
--- a/src/gui/gtk/gui-gtk-chat.c
+++ b/src/gui/gtk/gui-gtk-chat.c
@@ -194,8 +194,8 @@ gui_chat_draw_title (struct t_gui_buffer *buffer, int erase)
*/
char *
-gui_chat_string_next_char (struct t_gui_window *window, unsigned char *string,
- int apply_style)
+gui_chat_string_next_char (struct t_gui_window *window,
+ const unsigned char *string, int apply_style)
{
char str_fg[3];
int weechat_color;
@@ -294,7 +294,7 @@ gui_chat_string_next_char (struct t_gui_window *window, unsigned char *string,
*/
void
-gui_chat_display_word_raw (struct t_gui_window *window, char *string)
+gui_chat_display_word_raw (struct t_gui_window *window, const char *string)
{
/*char *prev_char, *next_char, saved_char;*/
@@ -310,8 +310,8 @@ gui_chat_display_word_raw (struct t_gui_window *window, char *string)
void
gui_chat_display_word (struct t_gui_window *window,
struct t_gui_line *line,
- char *data,
- char *end_offset,
+ const char *data,
+ const char *end_offset,
int num_lines, int count, int *lines_displayed, int simulate)
{
/*char *end_line, saved_char_end, saved_char;
diff --git a/src/gui/gtk/gui-gtk-color.c b/src/gui/gtk/gui-gtk-color.c
index 8fc19e099..ccfd5ebef 100644
--- a/src/gui/gtk/gui-gtk-color.c
+++ b/src/gui/gtk/gui-gtk-color.c
@@ -61,7 +61,7 @@ struct t_gui_color gui_weechat_colors[] =
*/
int
-gui_color_search (char *color_name)
+gui_color_search (const char *color_name)
{
int i;
@@ -80,7 +80,7 @@ gui_color_search (char *color_name)
*/
int
-gui_color_assign (int *color, char *color_name)
+gui_color_assign (int *color, const char *color_name)
{
int i;
diff --git a/src/gui/gtk/gui-gtk-input.c b/src/gui/gtk/gui-gtk-input.c
index 96f93b050..3c4df768c 100644
--- a/src/gui/gtk/gui-gtk-input.c
+++ b/src/gui/gtk/gui-gtk-input.c
@@ -53,7 +53,7 @@ gui_input_set_color (struct t_gui_window *window, int irc_color)
*/
void
-gui_input_draw_prompt (struct t_gui_window *window, char *nick)
+gui_input_draw_prompt (struct t_gui_window *window, const char *nick)
{
/*char *pos, saved_char, *modes;
int char_size, mode_found;*/
diff --git a/src/gui/gui-bar-item.c b/src/gui/gui-bar-item.c
index cdef4e277..c4b21b8d4 100644
--- a/src/gui/gui-bar-item.c
+++ b/src/gui/gui-bar-item.c
@@ -57,7 +57,7 @@ struct t_hook *gui_bar_item_timer = NULL;
*/
struct t_gui_bar_item *
-gui_bar_item_search (char *name)
+gui_bar_item_search (const char *name)
{
struct t_gui_bar_item *ptr_item;
@@ -79,7 +79,7 @@ gui_bar_item_search (char *name)
*/
struct t_gui_bar_item *
-gui_bar_item_search_with_plugin (struct t_weechat_plugin *plugin, char *name)
+gui_bar_item_search_with_plugin (struct t_weechat_plugin *plugin, const char *name)
{
struct t_gui_bar_item *ptr_item;
@@ -102,7 +102,7 @@ gui_bar_item_search_with_plugin (struct t_weechat_plugin *plugin, char *name)
*/
struct t_gui_bar_item *
-gui_bar_item_new (struct t_weechat_plugin *plugin, char *name,
+gui_bar_item_new (struct t_weechat_plugin *plugin, const char *name,
char *(*build_callback)(void *data,
struct t_gui_bar_item *item,
struct t_gui_window *window,
@@ -148,7 +148,7 @@ gui_bar_item_new (struct t_weechat_plugin *plugin, char *name,
*/
int
-gui_bar_contains_item (struct t_gui_bar *bar, char *name)
+gui_bar_contains_item (struct t_gui_bar *bar, const char *name)
{
int i;
@@ -170,7 +170,7 @@ gui_bar_contains_item (struct t_gui_bar *bar, char *name)
*/
void
-gui_bar_item_update (char *name)
+gui_bar_item_update (const char *name)
{
struct t_gui_bar *ptr_bar;
@@ -585,8 +585,8 @@ gui_bar_item_timer_cb (void *data)
*/
int
-gui_bar_item_signal_cb (void *data, char *signal,
- char *type_data, void *signal_data)
+gui_bar_item_signal_cb (void *data, const char *signal,
+ const char *type_data, void *signal_data)
{
/* make C compiler happy */
(void) signal;
@@ -603,7 +603,7 @@ gui_bar_item_signal_cb (void *data, char *signal,
*/
void
-gui_bar_item_hook (char *signal, char *item)
+gui_bar_item_hook (const char *signal, const char *item)
{
struct t_gui_bar_item_hook *bar_item_hook;
@@ -611,7 +611,8 @@ gui_bar_item_hook (char *signal, char *item)
if (bar_item_hook)
{
bar_item_hook->hook = hook_signal (NULL, signal,
- &gui_bar_item_signal_cb, item);
+ &gui_bar_item_signal_cb,
+ (void *)item);
bar_item_hook->next_hook = gui_bar_item_hooks;
gui_bar_item_hooks = bar_item_hook;
}
diff --git a/src/gui/gui-bar-item.h b/src/gui/gui-bar-item.h
index a88daee31..2777ebfa1 100644
--- a/src/gui/gui-bar-item.h
+++ b/src/gui/gui-bar-item.h
@@ -63,15 +63,15 @@ extern struct t_gui_bar_item *last_gui_bar_item;
/* functions */
-extern struct t_gui_bar_item *gui_bar_item_search (char *name);
+extern struct t_gui_bar_item *gui_bar_item_search (const char *name);
extern struct t_gui_bar_item *gui_bar_item_new (struct t_weechat_plugin *plugin,
- char *name,
+ const char *name,
char *(*build_callback)(void *data,
struct t_gui_bar_item *item,
struct t_gui_window *window,
int max_width, int max_height),
void *build_callback_data);
-extern void gui_bar_item_update (char *name);
+extern void gui_bar_item_update (const char *name);
extern void gui_bar_item_free (struct t_gui_bar_item *item);
extern void gui_bar_item_free_all ();
extern void gui_bar_item_free_all_plugin (struct t_weechat_plugin *plugin);
diff --git a/src/gui/gui-bar.c b/src/gui/gui-bar.c
index 8ac5ac4ba..f5413fc8a 100644
--- a/src/gui/gui-bar.c
+++ b/src/gui/gui-bar.c
@@ -62,7 +62,7 @@ struct t_gui_bar *last_gui_temp_bar = NULL;
*/
int
-gui_bar_search_option (char *option_name)
+gui_bar_search_option (const char *option_name)
{
int i;
@@ -85,7 +85,7 @@ gui_bar_search_option (char *option_name)
*/
int
-gui_bar_search_type (char *type)
+gui_bar_search_type (const char *type)
{
int i;
@@ -105,7 +105,7 @@ gui_bar_search_type (char *type)
*/
int
-gui_bar_search_position (char *position)
+gui_bar_search_position (const char *position)
{
int i;
@@ -247,7 +247,7 @@ gui_bar_root_get_size (struct t_gui_bar *bar, enum t_gui_bar_position position)
*/
struct t_gui_bar *
-gui_bar_search (char *name)
+gui_bar_search (const char *name)
{
struct t_gui_bar *ptr_bar;
@@ -270,7 +270,7 @@ gui_bar_search (char *name)
*/
struct t_gui_bar *
-gui_bar_search_with_option_name (char *option_name)
+gui_bar_search_with_option_name (const char *option_name)
{
char *bar_name, *pos_option;
struct t_gui_bar *ptr_bar;
@@ -322,7 +322,7 @@ gui_bar_refresh (struct t_gui_bar *bar)
int
gui_bar_config_check_type (void *data, struct t_config_option *option,
- char *value)
+ const char *value)
{
/* make C compiler happy */
(void) data;
@@ -414,7 +414,7 @@ gui_bar_config_change_filling (void *data, struct t_config_option *option)
int
gui_bar_config_check_size (void *data, struct t_config_option *option,
- char *value)
+ const char *value)
{
struct t_gui_bar *ptr_bar;
long number;
@@ -581,7 +581,7 @@ gui_bar_config_change_items (void *data, struct t_config_option *option)
*/
void
-gui_bar_set_name (struct t_gui_bar *bar, char *name)
+gui_bar_set_name (struct t_gui_bar *bar, const char *name)
{
int length;
char *option_name;
@@ -629,7 +629,7 @@ gui_bar_set_name (struct t_gui_bar *bar, char *name)
*/
void
-gui_bar_set_priority (struct t_gui_bar *bar, char *priority)
+gui_bar_set_priority (struct t_gui_bar *bar, const char *priority)
{
long number;
char *error;
@@ -689,7 +689,7 @@ gui_bar_set_priority (struct t_gui_bar *bar, char *priority)
*/
void
-gui_bar_set_position (struct t_gui_bar *bar, char *position)
+gui_bar_set_position (struct t_gui_bar *bar, const char *position)
{
int position_value;
@@ -708,7 +708,7 @@ gui_bar_set_position (struct t_gui_bar *bar, char *position)
*/
void
-gui_bar_set_size (struct t_gui_bar *bar, char *size)
+gui_bar_set_size (struct t_gui_bar *bar, const char *size)
{
long number;
char *error, value[32];
@@ -753,7 +753,7 @@ gui_bar_set_size (struct t_gui_bar *bar, char *size)
*/
void
-gui_bar_set_size_max (struct t_gui_bar *bar, char *size)
+gui_bar_set_size_max (struct t_gui_bar *bar, const char *size)
{
long number;
char *error, value[32];
@@ -781,7 +781,7 @@ gui_bar_set_size_max (struct t_gui_bar *bar, char *size)
*/
int
-gui_bar_set (struct t_gui_bar *bar, char *property, char *value)
+gui_bar_set (struct t_gui_bar *bar, const char *property, const char *value)
{
if (!bar || !property || !value)
return 0;
@@ -860,7 +860,7 @@ gui_bar_set (struct t_gui_bar *bar, char *property, char *value)
*/
struct t_config_option *
-gui_bar_create_option (char *bar_name, int index_option, char *value)
+gui_bar_create_option (const char *bar_name, int index_option, const char *value)
{
struct t_config_option *ptr_option;
int length;
@@ -991,7 +991,7 @@ gui_bar_create_option (char *bar_name, int index_option, char *value)
void
gui_bar_create_option_temp (struct t_gui_bar *temp_bar, int index_option,
- char *value)
+ const char *value)
{
struct t_config_option *new_option;
@@ -1044,7 +1044,7 @@ gui_bar_create_option_temp (struct t_gui_bar *temp_bar, int index_option,
*/
struct t_gui_bar *
-gui_bar_alloc (char *name)
+gui_bar_alloc (const char *name)
{
struct t_gui_bar *new_bar;
@@ -1081,7 +1081,7 @@ gui_bar_alloc (char *name)
*/
struct t_gui_bar *
-gui_bar_new_with_options (struct t_weechat_plugin *plugin, char *name,
+gui_bar_new_with_options (struct t_weechat_plugin *plugin, const char *name,
struct t_config_option *priority,
struct t_config_option *type,
struct t_config_option *conditions,
@@ -1166,10 +1166,11 @@ gui_bar_new_with_options (struct t_weechat_plugin *plugin, char *name,
*/
struct t_gui_bar *
-gui_bar_new (struct t_weechat_plugin *plugin, char *name,
- char *priority, char *type, char *conditions, char *position,
- char *filling, char *size, char *size_max, char *color_fg,
- char *color_bg, char *separators, char *items)
+gui_bar_new (struct t_weechat_plugin *plugin, const char *name,
+ const char *priority, const char *type, const char *conditions,
+ const char *position, const char *filling, const char *size,
+ const char *size_max, const char *color_fg, const char *color_bg,
+ const char *separators, const char *items)
{
struct t_config_option *option_priority, *option_type, *option_conditions;
struct t_config_option *option_position, *option_filling, *option_size;
@@ -1417,7 +1418,7 @@ gui_bar_use_temp_bars ()
*/
void
-gui_bar_update (char *name)
+gui_bar_update (const char *name)
{
struct t_gui_bar *ptr_bar;
diff --git a/src/gui/gui-bar.h b/src/gui/gui-bar.h
index 3f888dd76..78b9d055a 100644
--- a/src/gui/gui-bar.h
+++ b/src/gui/gui-bar.h
@@ -106,28 +106,31 @@ extern struct t_gui_bar *last_gui_temp_bar;
/* functions */
-extern int gui_bar_search_option (char *option_name);
-extern int gui_bar_search_type (char *type);
-extern int gui_bar_search_position (char *position);
+extern int gui_bar_search_option (const char *option_name);
+extern int gui_bar_search_type (const char *type);
+extern int gui_bar_search_position (const char *position);
extern int gui_bar_check_conditions_for_window (struct t_gui_bar *bar,
struct t_gui_window *window);
extern int gui_bar_root_get_size (struct t_gui_bar *bar,
enum t_gui_bar_position position);
-extern struct t_gui_bar *gui_bar_search (char *name);
+extern struct t_gui_bar *gui_bar_search (const char *name);
extern void gui_bar_set_current_size (struct t_gui_bar *bar, int current_size);
-extern int gui_bar_set (struct t_gui_bar *bar, char *property, char *value);
+extern int gui_bar_set (struct t_gui_bar *bar, const char *property, const char *value);
extern void gui_bar_create_option_temp (struct t_gui_bar *temp_bar,
- int index_option, char *value);
-extern struct t_gui_bar *gui_bar_alloc (char *name);
+ int index_option, const char *value);
+extern struct t_gui_bar *gui_bar_alloc (const char *name);
extern struct t_gui_bar *gui_bar_new (struct t_weechat_plugin *plugin,
- char *name, char *priority, char *type,
- char *conditions, char *position,
- char *filling, char *size,
- char *size_max, char *color_fg,
- char *color_bg, char *separator,
- char *items);
+ const char *name, const char *priority,
+ const char *type, const char *conditions,
+ const char *position,
+ const char *filling, const char *size,
+ const char *size_max,
+ const char *color_fg,
+ const char *color_bg,
+ const char *separator,
+ const char *items);
extern void gui_bar_use_temp_bars ();
-extern void gui_bar_update (char *name);
+extern void gui_bar_update (const char *name);
extern void gui_bar_free (struct t_gui_bar *bar);
extern void gui_bar_free_all ();
extern void gui_bar_free_all_plugin (struct t_weechat_plugin *plugin);
diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c
index ee497f0c9..a08c649af 100644
--- a/src/gui/gui-buffer.c
+++ b/src/gui/gui-buffer.c
@@ -63,10 +63,11 @@ struct t_gui_buffer *gui_previous_buffer = NULL; /* previous buffer */
*/
struct t_gui_buffer *
-gui_buffer_new (struct t_weechat_plugin *plugin, char *category, char *name,
+gui_buffer_new (struct t_weechat_plugin *plugin,
+ const char *category, const char *name,
int (*input_callback)(void *data,
struct t_gui_buffer *buffer,
- char *input_data),
+ const char *input_data),
void *input_callback_data,
int (*close_callback)(void *data,
struct t_gui_buffer *buffer),
@@ -234,7 +235,7 @@ gui_buffer_valid (struct t_gui_buffer *buffer)
*/
char *
-gui_buffer_get_string (struct t_gui_buffer *buffer, char *property)
+gui_buffer_get_string (struct t_gui_buffer *buffer, const char *property)
{
static char value[32];
@@ -262,7 +263,7 @@ gui_buffer_get_string (struct t_gui_buffer *buffer, char *property)
*/
void *
-gui_buffer_get_pointer (struct t_gui_buffer *buffer, char *property)
+gui_buffer_get_pointer (struct t_gui_buffer *buffer, const char *property)
{
if (string_strcasecmp (property, "plugin") == 0)
return buffer->plugin;
@@ -319,7 +320,7 @@ gui_buffer_ask_input_refresh (struct t_gui_buffer *buffer, int refresh)
*/
void
-gui_buffer_set_category (struct t_gui_buffer *buffer, char *category)
+gui_buffer_set_category (struct t_gui_buffer *buffer, const char *category)
{
if (category && category[0])
{
@@ -338,7 +339,7 @@ gui_buffer_set_category (struct t_gui_buffer *buffer, char *category)
*/
void
-gui_buffer_set_name (struct t_gui_buffer *buffer, char *name)
+gui_buffer_set_name (struct t_gui_buffer *buffer, const char *name)
{
if (name && name[0])
{
@@ -374,7 +375,7 @@ gui_buffer_set_type (struct t_gui_buffer *buffer, enum t_gui_buffer_type type)
*/
void
-gui_buffer_set_title (struct t_gui_buffer *buffer, char *new_title)
+gui_buffer_set_title (struct t_gui_buffer *buffer, const char *new_title)
{
if (buffer->title)
free (buffer->title);
@@ -423,7 +424,7 @@ gui_buffer_set_nicklist_display_groups (struct t_gui_buffer *buffer,
*/
void
-gui_buffer_set_nick (struct t_gui_buffer *buffer, char *new_nick)
+gui_buffer_set_nick (struct t_gui_buffer *buffer, const char *new_nick)
{
if (buffer->input_nick)
free (buffer->input_nick);
@@ -437,7 +438,7 @@ gui_buffer_set_nick (struct t_gui_buffer *buffer, char *new_nick)
void
gui_buffer_set_highlight_words (struct t_gui_buffer *buffer,
- char *new_highlight_words)
+ const char *new_highlight_words)
{
if (buffer->highlight_words)
free (buffer->highlight_words);
@@ -451,7 +452,7 @@ gui_buffer_set_highlight_words (struct t_gui_buffer *buffer,
void
gui_buffer_set_highlight_tags (struct t_gui_buffer *buffer,
- char *new_highlight_tags)
+ const char *new_highlight_tags)
{
if (buffer->highlight_tags_array)
string_free_exploded (buffer->highlight_tags_array);
@@ -474,7 +475,8 @@ gui_buffer_set_highlight_tags (struct t_gui_buffer *buffer,
*/
void
-gui_buffer_set (struct t_gui_buffer *buffer, char *property, char *value)
+gui_buffer_set (struct t_gui_buffer *buffer, const char *property,
+ const char *value)
{
long number;
char *error;
@@ -598,7 +600,7 @@ gui_buffer_search_main ()
*/
struct t_gui_buffer *
-gui_buffer_search_by_category_name (char *category, char *name)
+gui_buffer_search_by_category_name (const char *category, const char *name)
{
struct t_gui_buffer *ptr_buffer;
@@ -709,10 +711,11 @@ gui_buffer_is_scrolled (struct t_gui_buffer *buffer)
*/
int
-gui_buffer_match_category_name (struct t_gui_buffer *buffer, char *mask,
+gui_buffer_match_category_name (struct t_gui_buffer *buffer, const char *mask,
int case_sensitive)
{
- char *pos_point, *category, *pos_name;
+ char *pos_point, *category;
+ const char *pos_name;
int rc;
if (!mask || !mask[0])
diff --git a/src/gui/gui-buffer.h b/src/gui/gui-buffer.h
index 8e29a4513..1aa59aa84 100644
--- a/src/gui/gui-buffer.h
+++ b/src/gui/gui-buffer.h
@@ -104,7 +104,7 @@ struct t_gui_buffer
int input; /* = 1 if input is enabled */
int (*input_callback)(void *data, /* called when user send data */
struct t_gui_buffer *buffer,
- char *input_data);
+ const char *input_data);
void *input_callback_data; /* data for callback */
/* to this buffer */
char *input_nick; /* self nick */
@@ -156,19 +156,19 @@ extern struct t_gui_buffer *gui_previous_buffer;
/* buffer functions */
extern struct t_gui_buffer *gui_buffer_new (struct t_weechat_plugin *plugin,
- char *category, char *name,
+ const char *category, const char *name,
int (*input_callback)(void *data,
struct t_gui_buffer *buffer,
- char *input_data),
+ const char *input_data),
void *input_callback_data,
int (*close_callback)(void *data,
struct t_gui_buffer *buffer),
void *close_callback_data);
extern int gui_buffer_valid (struct t_gui_buffer *buffer);
extern char *gui_buffer_get_string (struct t_gui_buffer *buffer,
- char *property);
+ const char *property);
extern void *gui_buffer_get_pointer (struct t_gui_buffer *buffer,
- char *property);
+ const char *property);
extern void gui_buffer_ask_title_refresh (struct t_gui_buffer *buffer,
int refresh);
extern void gui_buffer_ask_chat_refresh (struct t_gui_buffer *buffer,
@@ -178,25 +178,26 @@ extern void gui_buffer_ask_nicklist_refresh (struct t_gui_buffer *buffer,
extern void gui_buffer_ask_input_refresh (struct t_gui_buffer *buffer,
int refresh);
extern void gui_buffer_set_category (struct t_gui_buffer *buffer,
- char *category);
-extern void gui_buffer_set_name (struct t_gui_buffer *buffer, char *name);
+ const char *category);
+extern void gui_buffer_set_name (struct t_gui_buffer *buffer, const char *name);
extern void gui_buffer_set_title (struct t_gui_buffer *buffer,
- char *new_title);
+ const char *new_title);
extern void gui_buffer_set_nicklist (struct t_gui_buffer *buffer,
int nicklist);
extern void gui_buffer_set_nicklist_case_sensitive (struct t_gui_buffer * buffer,
int case_sensitive);
-extern void gui_buffer_set_nick (struct t_gui_buffer *buffer, char *new_nick);
-extern void gui_buffer_set (struct t_gui_buffer *buffer, char *property,
- char *value);
+extern void gui_buffer_set_nick (struct t_gui_buffer *buffer, const char *new_nick);
+extern void gui_buffer_set (struct t_gui_buffer *buffer, const char *property,
+ const char *value);
extern struct t_gui_buffer *gui_buffer_search_main ();
-extern struct t_gui_buffer *gui_buffer_search_by_category_name (char *category,
- char *name);
+extern struct t_gui_buffer *gui_buffer_search_by_category_name (const char *category,
+ const char *name);
extern struct t_gui_buffer *gui_buffer_search_by_number (int number);
extern struct t_gui_window *gui_buffer_find_window (struct t_gui_buffer *buffer);
extern int gui_buffer_is_scrolled (struct t_gui_buffer *buffer);
extern int gui_buffer_match_category_name (struct t_gui_buffer *buffer,
- char *mask, int case_sensitive);
+ const char *mask,
+ int case_sensitive);
extern void gui_buffer_clear (struct t_gui_buffer *buffer);
extern void gui_buffer_clear_all ();
extern void gui_buffer_close (struct t_gui_buffer *buffer,
diff --git a/src/gui/gui-chat.c b/src/gui/gui-chat.c
index 05ee317b3..57173f1e8 100644
--- a/src/gui/gui-chat.c
+++ b/src/gui/gui-chat.c
@@ -119,7 +119,7 @@ gui_chat_prefix_build ()
*/
int
-gui_chat_strlen_screen (char *string)
+gui_chat_strlen_screen (const char *string)
{
int length;
@@ -142,9 +142,9 @@ gui_chat_strlen_screen (char *string)
*/
int
-gui_chat_string_real_pos (char *string, int pos)
+gui_chat_string_real_pos (const char *string, int pos)
{
- char *ptr_string, *real_pos;
+ const char *real_pos, *ptr_string;
if (pos <= 0)
return 0;
@@ -172,11 +172,12 @@ gui_chat_string_real_pos (char *string, int pos)
void
gui_chat_get_word_info (struct t_gui_window *window,
- char *data,
+ const char *data,
int *word_start_offset, int *word_end_offset,
int *word_length_with_spaces, int *word_length)
{
- char *start_data, *next_char, *next_char2;
+ const char *start_data;
+ char *next_char, *next_char2;
int leading_spaces, char_size;
*word_start_offset = 0;
@@ -465,7 +466,8 @@ gui_chat_get_next_line_displayed (struct t_gui_line *line)
*/
int
-gui_chat_line_search (struct t_gui_line *line, char *text, int case_sensitive)
+gui_chat_line_search (struct t_gui_line *line, const char *text,
+ int case_sensitive)
{
char *message;
int rc;
@@ -670,8 +672,8 @@ gui_chat_line_free_all (struct t_gui_buffer *buffer)
void
gui_chat_line_add (struct t_gui_buffer *buffer, time_t date,
- time_t date_printed, char *tags,
- char *prefix, char *message)
+ time_t date_printed, const char *tags,
+ const char *prefix, const char *message)
{
struct t_gui_line *new_line;
@@ -745,7 +747,7 @@ gui_chat_line_add (struct t_gui_buffer *buffer, time_t date,
*/
void
-gui_chat_line_add_y (struct t_gui_buffer *buffer, int y, char *message)
+gui_chat_line_add_y (struct t_gui_buffer *buffer, int y, const char *message)
{
struct t_gui_line *ptr_line, *new_line;
@@ -839,7 +841,7 @@ gui_chat_line_add_y (struct t_gui_buffer *buffer, int y, char *message)
void
gui_chat_printf_date_tags (struct t_gui_buffer *buffer, time_t date,
- char *tags, char *message, ...)
+ const char *tags, const char *message, ...)
{
char *buf;
va_list argptr;
@@ -958,7 +960,7 @@ gui_chat_printf_date_tags (struct t_gui_buffer *buffer, time_t date,
*/
void
-gui_chat_printf_y (struct t_gui_buffer *buffer, int y, char *message, ...)
+gui_chat_printf_y (struct t_gui_buffer *buffer, int y, const char *message, ...)
{
char *buf;
va_list argptr;
diff --git a/src/gui/gui-chat.h b/src/gui/gui-chat.h
index dcf0617f4..cc4181188 100644
--- a/src/gui/gui-chat.h
+++ b/src/gui/gui-chat.h
@@ -50,10 +50,10 @@ extern int gui_chat_time_length;
extern void gui_chat_prefix_build_empty ();
extern void gui_chat_prefix_build ();
-extern int gui_chat_strlen_screen (char *string);
-extern int gui_chat_string_real_pos (char *string, int pos);
+extern int gui_chat_strlen_screen (const char *string);
+extern int gui_chat_string_real_pos (const char *string, int pos);
extern void gui_chat_get_word_info (struct t_gui_window *window,
- char *data, int *word_start_offset,
+ const char *data, int *word_start_offset,
int *word_end_offset,
int *word_length_with_spaces,
int *word_length);
@@ -66,7 +66,7 @@ extern struct t_gui_line *gui_chat_get_first_line_displayed (struct t_gui_buffer
extern struct t_gui_line *gui_chat_get_last_line_displayed (struct t_gui_buffer *buffer);
extern struct t_gui_line *gui_chat_get_prev_line_displayed (struct t_gui_line *line);
extern struct t_gui_line *gui_chat_get_next_line_displayed (struct t_gui_line *line);
-extern int gui_chat_line_search (struct t_gui_line *line, char *text,
+extern int gui_chat_line_search (struct t_gui_line *line, const char *text,
int case_sensitive);
extern int gui_chat_line_match_regex (struct t_gui_line *line,
regex_t *regex_prefix,
@@ -77,16 +77,16 @@ extern void gui_chat_line_free (struct t_gui_buffer *buffer,
struct t_gui_line *line);
extern void gui_chat_line_free_all (struct t_gui_buffer *buffer);
extern void gui_chat_printf_date_tags (struct t_gui_buffer *buffer,
- time_t date, char *tags,
- char *message, ...);
+ time_t date, const char *tags,
+ const char *message, ...);
extern void gui_chat_printf_y (struct t_gui_buffer *buffer, int y,
- char *message, ...);
+ const char *message, ...);
/* chat functions (GUI dependent) */
extern void gui_chat_draw_title (struct t_gui_buffer *buffer, int erase);
extern char *gui_chat_string_next_char (struct t_gui_window *window,
- unsigned char *string,
+ const unsigned char *string,
int apply_style);
extern void gui_chat_draw (struct t_gui_buffer *buffer, int erase);
extern void gui_chat_draw_line (struct t_gui_buffer *buffer,
diff --git a/src/gui/gui-color.c b/src/gui/gui-color.c
index 0cb4b5261..e7bc2c2c2 100644
--- a/src/gui/gui-color.c
+++ b/src/gui/gui-color.c
@@ -48,7 +48,7 @@ struct t_gui_color *gui_color[GUI_COLOR_NUM_COLORS]; /* GUI colors */
*/
int
-gui_color_search_config_int (char *color_name)
+gui_color_search_config_int (const char *color_name)
{
struct t_config_section *ptr_section;
struct t_config_option *ptr_option;
@@ -105,7 +105,7 @@ gui_color_search_config_str (int color_number)
*/
unsigned char *
-gui_color_decode (unsigned char *string)
+gui_color_decode (const unsigned char *string)
{
unsigned char *out;
int out_length, out_pos, length;
diff --git a/src/gui/gui-color.h b/src/gui/gui-color.h
index 1b455ba43..ec6e49e48 100644
--- a/src/gui/gui-color.h
+++ b/src/gui/gui-color.h
@@ -137,15 +137,15 @@ extern struct t_gui_color *gui_color[];
/* color functions */
-extern int gui_color_search_config_int (char *color_name);
+extern int gui_color_search_config_int (const char *color_name);
extern char *gui_color_search_config_str (int color_number);
-extern unsigned char *gui_color_decode (unsigned char *string);
+extern unsigned char *gui_color_decode (const unsigned char *string);
extern void gui_color_free (struct t_gui_color *color);
/* color functions (GUI dependent) */
-extern int gui_color_search (char *color_name);
-extern int gui_color_assign (int *color, char *color_name);
+extern int gui_color_search (const char *color_name);
+extern int gui_color_assign (int *color, char const *color_name);
extern int gui_color_get_number ();
extern char *gui_color_get_name (int num_color);
extern void gui_color_init_pairs ();
diff --git a/src/gui/gui-completion.c b/src/gui/gui-completion.c
index f7a108b85..939b3982e 100644
--- a/src/gui/gui-completion.c
+++ b/src/gui/gui-completion.c
@@ -159,7 +159,7 @@ gui_completion_search_command (struct t_gui_completion *completion)
*/
int
-gui_completion_is_only_alphanum (char *string)
+gui_completion_is_only_alphanum (const char *string)
{
while (string[0])
{
@@ -176,7 +176,7 @@ gui_completion_is_only_alphanum (char *string)
*/
char *
-gui_completion_strdup_alphanum (char *string)
+gui_completion_strdup_alphanum (const char *string)
{
char *result, *pos;
@@ -202,7 +202,7 @@ gui_completion_strdup_alphanum (char *string)
*/
int
-gui_completion_nickncmp (char *base_word, char *nick, int max)
+gui_completion_nickncmp (const char *base_word, const char *nick, int max)
{
char *base_word2, *nick2;
int return_cmp;
@@ -229,8 +229,8 @@ gui_completion_nickncmp (char *base_word, char *nick, int max)
*/
void
-gui_completion_list_add (struct t_gui_completion *completion, char *word,
- int nick_completion, char *where)
+gui_completion_list_add (struct t_gui_completion *completion, const char *word,
+ int nick_completion, const char *where)
{
if (!word || !word[0])
return;
@@ -805,7 +805,7 @@ gui_completion_list_add_weechat_cmd (struct t_gui_completion *completion)
void
gui_completion_custom (struct t_gui_completion *completion,
- char *custom_completion,
+ const char *custom_completion,
struct t_weechat_plugin *plugin)
{
hook_completion_exec (plugin,
@@ -820,10 +820,11 @@ gui_completion_custom (struct t_gui_completion *completion,
void
gui_completion_build_list_template (struct t_gui_completion *completion,
- char *template,
+ const char *template,
struct t_weechat_plugin *plugin)
{
- char *word, *pos, *pos_end, *custom_completion;
+ char *word, *custom_completion;
+ const char *pos, *pos_end;
int word_offset;
word = strdup (template);
@@ -999,7 +1000,7 @@ gui_completion_build_list (struct t_gui_completion *completion)
*/
void
-gui_completion_find_context (struct t_gui_completion *completion, char *data,
+gui_completion_find_context (struct t_gui_completion *completion, const char *data,
int size, int pos)
{
int i, command, command_arg, pos_start, pos_end;
@@ -1406,7 +1407,7 @@ gui_completion_auto (struct t_gui_completion *completion)
void
gui_completion_search (struct t_gui_completion *completion, int direction,
- char *data, int size, int pos)
+ const char *data, int size, int pos)
{
char *old_word_found;
diff --git a/src/gui/gui-completion.h b/src/gui/gui-completion.h
index 3b8e39ef1..4f86220ee 100644
--- a/src/gui/gui-completion.h
+++ b/src/gui/gui-completion.h
@@ -57,7 +57,7 @@ extern void gui_completion_init (struct t_gui_completion *completion,
struct t_gui_buffer *buffer);
extern void gui_completion_free (struct t_gui_completion *completion);
extern void gui_completion_search (struct t_gui_completion *completion,
- int direction, char *data, int size,
+ int direction, const char *data, int size,
int pos);
extern void gui_completion_print_log (struct t_gui_completion *completion);
diff --git a/src/gui/gui-filter.c b/src/gui/gui-filter.c
index b39debe3f..6c2047bf3 100644
--- a/src/gui/gui-filter.c
+++ b/src/gui/gui-filter.c
@@ -175,7 +175,7 @@ gui_filter_disable ()
*/
struct t_gui_filter *
-gui_filter_search (char *buffer, char *tags, char *regex)
+gui_filter_search (const char *buffer, const char *tags, const char *regex)
{
struct t_gui_filter *ptr_filter;
@@ -220,11 +220,12 @@ gui_filter_search_by_number (int number)
*/
struct t_gui_filter *
-gui_filter_new (char *buffer, char *tags, char *regex)
+gui_filter_new (const char *buffer, const char *tags, const char *regex)
{
struct t_gui_filter *new_filter;
regex_t *regex1, *regex2;
- char *pos_tab, *regex_prefix, *pos_regex_message;
+ char *pos_tab, *regex_prefix;
+ const char *pos_regex_message;
if (!buffer || !tags || !regex)
return NULL;
diff --git a/src/gui/gui-filter.h b/src/gui/gui-filter.h
index 9a6a6830c..93c3184fb 100644
--- a/src/gui/gui-filter.h
+++ b/src/gui/gui-filter.h
@@ -51,11 +51,13 @@ extern int gui_filter_check_line (struct t_gui_buffer *buffer,
struct t_gui_line *line);
extern void gui_filter_enable ();
extern void gui_filter_disable ();
-extern struct t_gui_filter *gui_filter_search (char *buffer, char *tags,
- char *regex);
+extern struct t_gui_filter *gui_filter_search (const char *buffer,
+ const char *tags,
+ const char *regex);
extern struct t_gui_filter *gui_filter_search_by_number (int number);
-extern struct t_gui_filter *gui_filter_new (char *buffer, char *tags,
- char *regex);
+extern struct t_gui_filter *gui_filter_new (const char *buffer,
+ const char *tags,
+ const char *regex);
extern void gui_filter_free (struct t_gui_filter *filter);
extern void gui_filter_free_all ();
extern void gui_filter_print_log ();
diff --git a/src/gui/gui-history.c b/src/gui/gui-history.c
index d7b98d47b..84d7eea93 100644
--- a/src/gui/gui-history.c
+++ b/src/gui/gui-history.c
@@ -44,7 +44,7 @@ int num_history_global = 0;
*/
void
-gui_history_buffer_add (struct t_gui_buffer *buffer, char *string)
+gui_history_buffer_add (struct t_gui_buffer *buffer, const char *string)
{
struct t_gui_history *new_history, *ptr_history;
@@ -94,7 +94,7 @@ gui_history_buffer_add (struct t_gui_buffer *buffer, char *string)
*/
void
-gui_history_global_add (char *string)
+gui_history_global_add (const char *string)
{
struct t_gui_history *new_history, *ptr_history;
diff --git a/src/gui/gui-history.h b/src/gui/gui-history.h
index 73bd669e6..323817d33 100644
--- a/src/gui/gui-history.h
+++ b/src/gui/gui-history.h
@@ -34,8 +34,8 @@ extern struct t_gui_history *history_global_last;
extern struct t_gui_history *history_global_ptr;
/* history functions (gui-history.c) */
-extern void gui_history_buffer_add (struct t_gui_buffer *buffer, char *string);
-extern void gui_history_global_add (char *string);
+extern void gui_history_buffer_add (struct t_gui_buffer *buffer, const char *string);
+extern void gui_history_global_add (const char *string);
extern void gui_history_global_free ();
extern void gui_history_buffer_free (struct t_gui_buffer *buffer);
diff --git a/src/gui/gui-infobar.c b/src/gui/gui-infobar.c
index 31bdbd451..2bfa9f676 100644
--- a/src/gui/gui-infobar.c
+++ b/src/gui/gui-infobar.c
@@ -45,7 +45,7 @@ struct t_hook *gui_infobar_highlight_timer = NULL; /* highlight timer */
*/
void
-gui_infobar_printf (int delay, int color, char *message, ...)
+gui_infobar_printf (int delay, int color, const char *message, ...)
{
static char buf[1024];
va_list argptr;
diff --git a/src/gui/gui-infobar.h b/src/gui/gui-infobar.h
index 1043ce1c0..8a2e4bc7d 100644
--- a/src/gui/gui-infobar.h
+++ b/src/gui/gui-infobar.h
@@ -38,7 +38,8 @@ extern struct t_hook *gui_infobar_highlight_timer;
/* infobar functions */
-extern void gui_infobar_printf (int delay, int color, char *message, ...);
+extern void gui_infobar_printf (int delay, int color,
+ const char *message, ...);
extern void gui_infobar_remove ();
extern void gui_infobar_remove_all ();
diff --git a/src/gui/gui-input.c b/src/gui/gui-input.c
index dc4bd2887..32afa3c3f 100644
--- a/src/gui/gui-input.c
+++ b/src/gui/gui-input.c
@@ -93,7 +93,7 @@ gui_input_init_color_mask (struct t_gui_buffer *buffer)
*/
void
-gui_input_move (struct t_gui_buffer *buffer, char *target, char *source,
+gui_input_move (struct t_gui_buffer *buffer, char *target, const char *source,
int size)
{
int pos_source, pos_target;
@@ -114,7 +114,8 @@ gui_input_move (struct t_gui_buffer *buffer, char *target, char *source,
*/
int
-gui_input_insert_string (struct t_gui_buffer *buffer, char *string, int pos)
+gui_input_insert_string (struct t_gui_buffer *buffer, const char *string,
+ int pos)
{
int i, pos_start, size, length;
char *ptr_start;
@@ -255,7 +256,7 @@ gui_input_get_prompt_length (struct t_gui_buffer *buffer)
*/
void
-gui_input_clipboard_copy (char *buffer, int size)
+gui_input_clipboard_copy (const char *buffer, int size)
{
if (size <= 0)
return;
@@ -710,7 +711,7 @@ gui_input_delete_beginning_of_line ()
*/
void
-gui_input_delete_end_of_line (char *args)
+gui_input_delete_end_of_line (const char *args)
{
char *start;
int size_deleted, length_deleted, pos_start;
@@ -1344,7 +1345,7 @@ gui_input_set_unread_current_buffer ()
*/
void
-gui_input_insert (char *args)
+gui_input_insert (const char *args)
{
char *args2;
diff --git a/src/gui/gui-input.h b/src/gui/gui-input.h
index 0182e8651..25a138e93 100644
--- a/src/gui/gui-input.h
+++ b/src/gui/gui-input.h
@@ -31,9 +31,9 @@ extern char *gui_input_clipboard;
extern void gui_input_optimize_size (struct t_gui_buffer *buffer);
extern void gui_input_init_color_mask (struct t_gui_buffer *buffer);
extern void gui_input_move (struct t_gui_buffer *buffer, char *target,
- char *source, int size);
-extern int gui_input_insert_string (struct t_gui_buffer *buffer, char *string,
- int pos);
+ const char *source, int size);
+extern int gui_input_insert_string (struct t_gui_buffer *buffer,
+ const char *string, int pos);
extern int gui_input_get_prompt_length (struct t_gui_buffer *buffer);
extern void gui_input_return ();
extern void gui_input_clipboard_paste ();
diff --git a/src/gui/gui-keyboard.c b/src/gui/gui-keyboard.c
index cff63b9a0..d48e69101 100644
--- a/src/gui/gui-keyboard.c
+++ b/src/gui/gui-keyboard.c
@@ -132,7 +132,7 @@ gui_keyboard_grab_end ()
*/
char *
-gui_keyboard_get_internal_code (char *key)
+gui_keyboard_get_internal_code (const char *key)
{
char *result;
@@ -175,7 +175,7 @@ gui_keyboard_get_internal_code (char *key)
*/
char *
-gui_keyboard_get_expanded_name (char *key)
+gui_keyboard_get_expanded_name (const char *key)
{
char *result;
@@ -279,7 +279,8 @@ gui_keyboard_insert_sorted (struct t_gui_key **keys, struct t_gui_key **last_key
*/
struct t_gui_key *
-gui_keyboard_new (struct t_gui_buffer *buffer, char *key, char *command)
+gui_keyboard_new (struct t_gui_buffer *buffer, const char *key,
+ const char *command)
{
struct t_gui_key *new_key;
char *internal_code;
@@ -308,7 +309,7 @@ gui_keyboard_new (struct t_gui_buffer *buffer, char *key, char *command)
*/
struct t_gui_key *
-gui_keyboard_search (struct t_gui_buffer *buffer, char *key)
+gui_keyboard_search (struct t_gui_buffer *buffer, const char *key)
{
struct t_gui_key *ptr_key;
@@ -328,7 +329,7 @@ gui_keyboard_search (struct t_gui_buffer *buffer, char *key)
*/
int
-gui_keyboard_cmp (char *key, char *search)
+gui_keyboard_cmp (const char *key, const char *search)
{
while (search[0])
{
@@ -346,7 +347,7 @@ gui_keyboard_cmp (char *key, char *search)
*/
struct t_gui_key *
-gui_keyboard_search_part (struct t_gui_buffer *buffer, char *key)
+gui_keyboard_search_part (struct t_gui_buffer *buffer, const char *key)
{
struct t_gui_key *ptr_key;
@@ -368,7 +369,7 @@ gui_keyboard_search_part (struct t_gui_buffer *buffer, char *key)
*/
struct t_gui_key *
-gui_keyboard_bind (struct t_gui_buffer *buffer, char *key, char *command)
+gui_keyboard_bind (struct t_gui_buffer *buffer, const char *key, const char *command)
{
struct t_gui_key *new_key;
@@ -395,7 +396,7 @@ gui_keyboard_bind (struct t_gui_buffer *buffer, char *key, char *command)
*/
int
-gui_keyboard_unbind (struct t_gui_buffer *buffer, char *key)
+gui_keyboard_unbind (struct t_gui_buffer *buffer, const char *key)
{
struct t_gui_key *ptr_key;
char *internal_code;
@@ -424,7 +425,7 @@ gui_keyboard_unbind (struct t_gui_buffer *buffer, char *key)
*/
int
-gui_keyboard_pressed (char *key_str)
+gui_keyboard_pressed (const char *key_str)
{
int first_key;
struct t_gui_key *ptr_key;
diff --git a/src/gui/gui-keyboard.h b/src/gui/gui-keyboard.h
index 5e88f97e6..1e997bff6 100644
--- a/src/gui/gui-keyboard.h
+++ b/src/gui/gui-keyboard.h
@@ -49,14 +49,15 @@ extern time_t gui_keyboard_last_activity_time;
extern void gui_keyboard_init ();
extern void gui_keyboard_grab_init ();
extern void gui_keyboard_grab_end ();
-extern char *gui_keyboard_get_internal_code (char *key);
-extern char *gui_keyboard_get_expanded_name (char *key);
+extern char *gui_keyboard_get_internal_code (const char *key);
+extern char *gui_keyboard_get_expanded_name (const char *key);
extern struct t_gui_key *gui_keyboard_search (struct t_gui_buffer *buffer,
- char *key);
+ const char *key);
extern struct t_gui_key *gui_keyboard_bind (struct t_gui_buffer *buffer,
- char *key, char *command);
-extern int gui_keyboard_unbind (struct t_gui_buffer *buffer, char *key);
-extern int gui_keyboard_pressed (char *key_str);
+ const char *key,
+ const char *command);
+extern int gui_keyboard_unbind (struct t_gui_buffer *buffer, const char *key);
+extern int gui_keyboard_pressed (const char *key_str);
extern void gui_keyboard_free (struct t_gui_key **keys,
struct t_gui_key **last_key,
struct t_gui_key *key);
diff --git a/src/gui/gui-nicklist.c b/src/gui/gui-nicklist.c
index 473898910..3b3af85a9 100644
--- a/src/gui/gui-nicklist.c
+++ b/src/gui/gui-nicklist.c
@@ -113,7 +113,7 @@ gui_nicklist_insert_group_sorted (struct t_gui_nick_group **groups,
struct t_gui_nick_group *
gui_nicklist_search_group (struct t_gui_buffer *buffer,
struct t_gui_nick_group *from_group,
- char *name)
+ const char *name)
{
struct t_gui_nick_group *ptr_group;
@@ -148,8 +148,8 @@ gui_nicklist_search_group (struct t_gui_buffer *buffer,
struct t_gui_nick_group *
gui_nicklist_add_group (struct t_gui_buffer *buffer,
- struct t_gui_nick_group *parent_group, char *name,
- char *color, int visible)
+ struct t_gui_nick_group *parent_group, const char *name,
+ const char *color, int visible)
{
struct t_gui_nick_group *new_group;
int num_color;
@@ -273,7 +273,7 @@ gui_nicklist_insert_nick_sorted (struct t_gui_nick_group *group,
struct t_gui_nick *
gui_nicklist_search_nick (struct t_gui_buffer *buffer,
struct t_gui_nick_group *from_group,
- char *name)
+ const char *name)
{
struct t_gui_nick *ptr_nick;
@@ -294,8 +294,8 @@ gui_nicklist_search_nick (struct t_gui_buffer *buffer,
struct t_gui_nick *
gui_nicklist_add_nick (struct t_gui_buffer *buffer,
- struct t_gui_nick_group *group, char *name,
- char *color, char prefix, char *prefix_color,
+ struct t_gui_nick_group *group, const char *name,
+ const char *color, char prefix, const char *prefix_color,
int visible)
{
struct t_gui_nick *new_nick;
@@ -529,9 +529,9 @@ gui_nicklist_get_next_item (struct t_gui_buffer *buffer,
*/
char *
-gui_nicklist_get_group_start (char *name)
+gui_nicklist_get_group_start (const char *name)
{
- char *ptr_name;
+ const char *ptr_name;
ptr_name = name;
while (isdigit (ptr_name[0]))
@@ -541,9 +541,9 @@ gui_nicklist_get_group_start (char *name)
ptr_name++;
}
if ((ptr_name[0] == '|') && (ptr_name != name))
- return ptr_name + 1;
+ return (char *)ptr_name + 1;
else
- return name;
+ return (char *)name;
}
/*
diff --git a/src/gui/gui-nicklist.h b/src/gui/gui-nicklist.h
index ed4a6c3bd..cf031675b 100644
--- a/src/gui/gui-nicklist.h
+++ b/src/gui/gui-nicklist.h
@@ -53,18 +53,18 @@ struct t_gui_nick
extern struct t_gui_nick_group *gui_nicklist_search_group (struct t_gui_buffer *buffer,
struct t_gui_nick_group *from_group,
- char *name);
+ const char *name);
extern struct t_gui_nick_group *gui_nicklist_add_group (struct t_gui_buffer *buffer,
struct t_gui_nick_group *parent_group,
- char *name, char *color,
+ const char *name, const char *color,
int visible);
extern struct t_gui_nick *gui_nicklist_search_nick (struct t_gui_buffer *buffer,
struct t_gui_nick_group *from_group,
- char *name);
+ const char *name);
extern struct t_gui_nick *gui_nicklist_add_nick (struct t_gui_buffer *buffer,
struct t_gui_nick_group *group,
- char *name, char *color,
- char prefix, char *prefix_color,
+ const char *name, const char *color,
+ char prefix, const char *prefix_color,
int visible);
extern void gui_nicklist_remove_group (struct t_gui_buffer *buffer,
struct t_gui_nick_group *group);
@@ -74,7 +74,7 @@ extern void gui_nicklist_remove_all (struct t_gui_buffer *buffer);
extern void gui_nicklist_get_next_item (struct t_gui_buffer *buffer,
struct t_gui_nick_group **group,
struct t_gui_nick **nick);
-extern char *gui_nicklist_get_group_start (char *name);
+extern char *gui_nicklist_get_group_start (const char *name);
extern int gui_nicklist_get_max_length (struct t_gui_buffer *buffer,
struct t_gui_nick_group *group);
extern void gui_nicklist_compute_visible_count (struct t_gui_buffer *buffer,
diff --git a/src/gui/gui-window.c b/src/gui/gui-window.c
index adb7202e5..c637849cd 100644
--- a/src/gui/gui-window.c
+++ b/src/gui/gui-window.c
@@ -469,7 +469,7 @@ gui_window_scroll (struct t_gui_window *window, char *scroll)
int direction, stop, count_msg;
char time_letter, saved_char;
time_t old_date, diff_date;
- char *error;
+ char *pos, *error;
long number;
struct t_gui_line *ptr_line;
struct tm *date_tmp, line_date, old_line_date;
@@ -493,7 +493,7 @@ gui_window_scroll (struct t_gui_window *window, char *scroll)
}
/* search number and letter */
- char *pos = scroll;
+ pos = scroll;
while (pos && pos[0] && isdigit (pos[0]))
{
pos++;
diff --git a/src/plugins/alias/alias.c b/src/plugins/alias/alias.c
index b0d8c5482..3bfd3094d 100644
--- a/src/plugins/alias/alias.c
+++ b/src/plugins/alias/alias.c
@@ -51,7 +51,7 @@ struct t_alias *last_alias = NULL;
*/
struct t_alias *
-alias_search (char *alias_name)
+alias_search (const char *alias_name)
{
struct t_alias *ptr_alias;
@@ -70,7 +70,7 @@ alias_search (char *alias_name)
*/
void
-alias_add_word (char **alias, int *length, char *word)
+alias_add_word (char **alias, int *length, const char *word)
{
int length_word;
@@ -99,9 +99,10 @@ alias_add_word (char **alias, int *length, char *word)
*/
char *
-alias_replace_args (char *alias_args, char *user_args)
+alias_replace_args (const char *alias_args, const char *user_args)
{
- char **argv, *start, *pos, *res;
+ char **argv, *res, *word;
+ const char *start, *pos;
int argc, length_res, args_count;
argv = weechat_string_explode (user_args, " ", 0, 0, &argc);
@@ -115,10 +116,13 @@ alias_replace_args (char *alias_args, char *user_args)
{
if ((pos[0] == '\\') && (pos[1] == '$'))
{
- pos[0] = '\0';
- alias_add_word (&res, &length_res, start);
+ word = weechat_strndup (start, pos - start);
+ if (word)
+ {
+ alias_add_word (&res, &length_res, word);
+ free (word);
+ }
alias_add_word (&res, &length_res, "$");
- pos[0] = '\\';
start = pos + 2;
pos = start;
}
@@ -129,10 +133,13 @@ alias_replace_args (char *alias_args, char *user_args)
if (pos[1] == '*')
{
args_count++;
- pos[0] = '\0';
- alias_add_word (&res, &length_res, start);
+ word = weechat_strndup (start, pos - start);
+ if (word)
+ {
+ alias_add_word (&res, &length_res, word);
+ free (word);
+ }
alias_add_word (&res, &length_res, user_args);
- pos[0] = '$';
start = pos + 2;
pos = start;
}
@@ -141,11 +148,14 @@ alias_replace_args (char *alias_args, char *user_args)
if ((pos[1] >= '1') && (pos[1] <= '9'))
{
args_count++;
- pos[0] = '\0';
- alias_add_word (&res, &length_res, start);
+ word = weechat_strndup (start, pos - start);
+ if (word)
+ {
+ alias_add_word (&res, &length_res, start);
+ free (word);
+ }
if (pos[1] - '0' <= argc)
alias_add_word (&res, &length_res, argv[pos[1] - '1']);
- pos[0] = '$';
start = pos + 2;
pos = start;
}
@@ -293,7 +303,7 @@ alias_cb (void *data, struct t_gui_buffer *buffer, int argc, char **argv,
*/
struct t_alias *
-alias_find_pos (char *name)
+alias_find_pos (const char *name)
{
struct t_alias *ptr_alias;
@@ -312,7 +322,7 @@ alias_find_pos (char *name)
*/
struct t_alias *
-alias_new (char *name, char *command)
+alias_new (const char *name, const char *command)
{
struct t_alias *new_alias, *ptr_alias, *pos_alias;
struct t_hook *new_hook;
@@ -524,7 +534,7 @@ alias_config_reload (void *data, struct t_config_file *config_file)
void
alias_config_write_default (void *data,
struct t_config_file *config_file,
- char *section_name)
+ const char *section_name)
{
/* make C compiler happy */
(void) data;
@@ -565,7 +575,7 @@ alias_config_write_default (void *data,
int
alias_config_create_option (void *data, struct t_config_file *config_file,
struct t_config_section *section,
- char *option_name, char *value)
+ const char *option_name, const char *value)
{
struct t_alias *ptr_alias;
int rc;
@@ -795,8 +805,8 @@ unalias_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
*/
int
-alias_completion_cb (void *data, char *completion, struct t_gui_buffer *buffer,
- struct t_weelist *list)
+alias_completion_cb (void *data, const char *completion,
+ struct t_gui_buffer *buffer, struct t_weelist *list)
{
struct t_alias *ptr_alias;
diff --git a/src/plugins/charset/charset.c b/src/plugins/charset/charset.c
index 94a664980..49d5e0c14 100644
--- a/src/plugins/charset/charset.c
+++ b/src/plugins/charset/charset.c
@@ -59,7 +59,8 @@ int charset_debug = 0;
*/
int
-charset_debug_cb (void *data, char *signal, char *type_data, void *signal_data)
+charset_debug_cb (void *data, const char *signal, const char *type_data,
+ void *signal_data)
{
/* make C compiler happy */
(void) data;
@@ -104,7 +105,7 @@ charset_config_reload (void *data, struct t_config_file *config_file)
int
charset_config_create_option (void *data, struct t_config_file *config_file,
struct t_config_section *section,
- char *option_name, char *value)
+ const char *option_name, const char *value)
{
struct t_config_option *ptr_option;
int rc;
@@ -256,7 +257,7 @@ charset_config_write ()
*/
int
-charset_check (char *charset)
+charset_check (const char *charset)
{
iconv_t cd;
@@ -278,7 +279,7 @@ charset_check (char *charset)
*/
char *
-charset_get (struct t_config_section *section, char *name,
+charset_get (struct t_config_section *section, const char *name,
struct t_config_option *default_charset)
{
char *option_name, *ptr_end;
@@ -326,12 +327,12 @@ charset_get (struct t_config_section *section, char *name,
}
/*
- * charset_decode: decode a string with a charset to internal charset
+ * charset_decode_cb: decode a string with a charset to internal charset
*/
char *
-charset_decode (void *data, char *modifier, char *modifier_data,
- char *string)
+charset_decode_cb (void *data, const char *modifier, const char *modifier_data,
+ const char *string)
{
char *charset;
@@ -355,12 +356,12 @@ charset_decode (void *data, char *modifier, char *modifier_data,
}
/*
- * charset_encode: encode a string from internal charset to another one
+ * charset_encode_cb: encode a string from internal charset to another one
*/
char *
-charset_encode (void *data, char *modifier, char *modifier_data,
- char *string)
+charset_encode_cb (void *data, const char *modifier, const char *modifier_data,
+ const char *string)
{
char *charset;
@@ -388,8 +389,8 @@ charset_encode (void *data, char *modifier, char *modifier_data,
*/
void
-charset_set (struct t_config_section *section, char *type,
- char *name, char *value)
+charset_set (struct t_config_section *section, const char *type,
+ const char *name, const char *value)
{
if (charset_config_create_option (NULL,
charset_config_file,
@@ -552,8 +553,8 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
&charset_command_cb, NULL);
/* modifiers hooks */
- weechat_hook_modifier ("charset_decode", &charset_decode, NULL);
- weechat_hook_modifier ("charset_encode", &charset_encode, NULL);
+ weechat_hook_modifier ("charset_decode", &charset_decode_cb, NULL);
+ weechat_hook_modifier ("charset_encode", &charset_encode_cb, NULL);
/* callback for debug */
weechat_hook_signal ("debug", &charset_debug_cb, NULL);
diff --git a/src/plugins/demo/demo.c b/src/plugins/demo/demo.c
index 2206a13c5..b0977f0da 100644
--- a/src/plugins/demo/demo.c
+++ b/src/plugins/demo/demo.c
@@ -49,8 +49,8 @@ int demo_debug = 0;
*/
int
-demo_debug_signal_debug_cb (void *data, char *signal, char *type_data,
- void *signal_data)
+demo_debug_signal_debug_cb (void *data, const char *signal,
+ const char *type_data, void *signal_data)
{
/* make C compiler happy */
(void) data;
@@ -132,7 +132,7 @@ demo_infobar_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
int
demo_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
- char *input_data)
+ const char *input_data)
{
/* make C compiler happy */
(void) data;
@@ -223,7 +223,7 @@ demo_buffer_set_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
*/
void
-demo_infolist_print (struct t_plugin_infolist *infolist, char *item_name)
+demo_infolist_print (struct t_plugin_infolist *infolist, const char *item_name)
{
char *fields, **argv;
int i, j, argc;
@@ -357,7 +357,8 @@ demo_info_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
*/
int
-demo_signal_cb (void *data, char *signal, char *type_data, void *signal_data)
+demo_signal_cb (void *data, const char *signal, const char *type_data,
+ void *signal_data)
{
/* make C compiler happy */
(void) data;
diff --git a/src/plugins/fifo/fifo.c b/src/plugins/fifo/fifo.c
index 1317fc9b5..e493a1dad 100644
--- a/src/plugins/fifo/fifo.c
+++ b/src/plugins/fifo/fifo.c
@@ -157,52 +157,57 @@ fifo_remove ()
*/
void
-fifo_exec (char *text)
+fifo_exec (const char *text)
{
- char *pos_msg, *pos;
+ char *text2, *pos_msg, *pos;
struct t_gui_buffer *ptr_buffer;
+ text2 = strdup (text);
+ if (!text2)
+ return;
+
pos = NULL;
ptr_buffer = NULL;
/* look for category/name at beginning of text
text may be: "category,name *text" or "name *text" or "*text" */
- if (text[0] == '*')
+ if (text2[0] == '*')
{
- pos_msg = text + 1;
+ pos_msg = text2 + 1;
ptr_buffer = weechat_buffer_search (NULL, NULL);
if (!ptr_buffer)
ptr_buffer = weechat_current_buffer;
}
else
{
- pos_msg = strstr (text, " *");
+ pos_msg = strstr (text2, " *");
if (!pos_msg)
{
weechat_printf (NULL,
_("%s%s: error, invalid text received on pipe"),
weechat_prefix ("error"), "fifo");
+ free (text2);
return;
}
pos_msg[0] = '\0';
pos = pos_msg - 1;
pos_msg += 2;
- while ((pos >= text) && (pos[0] == ' '))
+ while ((pos >= text2) && (pos[0] == ' '))
{
pos[0] = '\0';
pos--;
}
- if (text[0])
+ if (text2[0])
{
- pos = strchr (text, ',');
+ pos = strchr (text2, ',');
if (pos)
{
pos[0] = '\0';
- ptr_buffer = weechat_buffer_search (text, pos + 1);
+ ptr_buffer = weechat_buffer_search (text2, pos + 1);
}
else
- ptr_buffer = weechat_buffer_search (NULL, text);
+ ptr_buffer = weechat_buffer_search (NULL, text2);
if (!ptr_buffer)
ptr_buffer = weechat_current_buffer;
}
@@ -213,10 +218,13 @@ fifo_exec (char *text)
weechat_printf (NULL,
_("%s%s: error, buffer not found for pipe data"),
weechat_prefix ("error"), "fifo");
+ free (text2);
return;
}
weechat_command (ptr_buffer, pos_msg);
+
+ free (text2);
}
/*
@@ -320,7 +328,7 @@ fifo_read ()
*/
int
-fifo_config_cb (void *data, char *option, char *value)
+fifo_config_cb (void *data, const char *option, const char *value)
{
/* make C compiler happy */
(void) data;
diff --git a/src/plugins/irc/irc-channel.c b/src/plugins/irc/irc-channel.c
index e70d329cc..8e73d57d1 100644
--- a/src/plugins/irc/irc-channel.c
+++ b/src/plugins/irc/irc-channel.c
@@ -40,7 +40,7 @@
struct t_irc_channel *
irc_channel_new (struct t_irc_server *server, int channel_type,
- char *channel_name, int switch_to_channel)
+ const char *channel_name, int switch_to_channel)
{
struct t_irc_channel *new_channel;
struct t_gui_buffer *new_buffer;
@@ -188,7 +188,7 @@ irc_channel_free_all (struct t_irc_server *server)
*/
struct t_irc_channel *
-irc_channel_search (struct t_irc_server *server, char *channel_name)
+irc_channel_search (struct t_irc_server *server, const char *channel_name)
{
struct t_irc_channel *ptr_channel;
@@ -209,7 +209,7 @@ irc_channel_search (struct t_irc_server *server, char *channel_name)
*/
struct t_irc_channel *
-irc_channel_search_any (struct t_irc_server *server, char *channel_name)
+irc_channel_search_any (struct t_irc_server *server, const char *channel_name)
{
struct t_irc_channel *ptr_channel;
@@ -232,7 +232,7 @@ irc_channel_search_any (struct t_irc_server *server, char *channel_name)
struct t_irc_channel *
irc_channel_search_any_without_buffer (struct t_irc_server *server,
- char *channel_name)
+ const char *channel_name)
{
struct t_irc_channel *ptr_channel;
@@ -254,7 +254,7 @@ irc_channel_search_any_without_buffer (struct t_irc_server *server,
*/
int
-irc_channel_is_channel (char *string)
+irc_channel_is_channel (const char *string)
{
char first_char[2];
@@ -311,7 +311,7 @@ irc_channel_check_away (struct t_irc_server *server,
*/
void
-irc_channel_set_away (struct t_irc_channel *channel, char *nick, int is_away)
+irc_channel_set_away (struct t_irc_channel *channel, const char *nick, int is_away)
{
(void) channel;
(void) nick;
@@ -404,7 +404,7 @@ irc_channel_set_notify_level (struct t_irc_server *server,
*/
void
-irc_channel_add_nick_speaking (struct t_irc_channel *channel, char *nick)
+irc_channel_add_nick_speaking (struct t_irc_channel *channel, const char *nick)
{
int size, to_remove, i;
diff --git a/src/plugins/irc/irc-channel.h b/src/plugins/irc/irc-channel.h
index 7aa4ca493..ac8a268f3 100644
--- a/src/plugins/irc/irc-channel.h
+++ b/src/plugins/irc/irc-channel.h
@@ -56,22 +56,22 @@ struct t_irc_channel
extern struct t_irc_channel *irc_channel_new (struct t_irc_server *server,
int channel_type,
- char *channel_name,
+ const char *channel_name,
int switch_to_channel);
extern void irc_channel_free (struct t_irc_server *server,
struct t_irc_channel *channel);
extern void irc_channel_free_all (struct t_irc_server *server);
extern struct t_irc_channel *irc_channel_search (struct t_irc_server *server,
- char *channel_name);
+ const char *channel_name);
extern struct t_irc_channel *irc_channel_search_any (struct t_irc_server *server,
- char *channel_name);
+ const char *channel_name);
extern struct t_irc_channel *irc_channel_search_any_without_buffer (struct t_irc_server *server,
- char *channel_name);
-extern int irc_channel_is_channel (char *string);
+ const char *channel_name);
+extern int irc_channel_is_channel (const char *string);
extern void irc_channel_remove_away (struct t_irc_channel *channel);
extern void irc_channel_check_away (struct t_irc_server *server,
struct t_irc_channel *channel, int force);
-extern void irc_channel_set_away (struct t_irc_channel *channel, char *nick,
+extern void irc_channel_set_away (struct t_irc_channel *channel, const char *nick,
int is_away);
extern int irc_channel_get_notify_level (struct t_irc_server *server,
struct t_irc_channel *channel);
@@ -79,7 +79,7 @@ extern void irc_channel_set_notify_level (struct t_irc_server *server,
struct t_irc_channel *channel,
int notify);
extern void irc_channel_add_nick_speaking (struct t_irc_channel *channel,
- char *nick);
+ const char *nick);
extern void irc_channel_print_log (struct t_irc_channel *channel);
#endif /* irc-channel.h */
diff --git a/src/plugins/irc/irc-color.c b/src/plugins/irc/irc-color.c
index bda5f8f3f..dd2bf28c3 100644
--- a/src/plugins/irc/irc-color.c
+++ b/src/plugins/irc/irc-color.c
@@ -58,7 +58,7 @@ char *irc_color_to_weechat[IRC_NUM_COLORS] =
*/
char *
-irc_color_decode (char *string, int keep_colors)
+irc_color_decode (const char *string, int keep_colors)
{
unsigned char *out, *ptr_string;
int out_length, length, out_pos;
@@ -184,7 +184,7 @@ irc_color_decode (char *string, int keep_colors)
*/
char *
-irc_color_decode_for_user_entry (char *string)
+irc_color_decode_for_user_entry (const char *string)
{
unsigned char *out, *ptr_string;
int out_length, out_pos, length;
@@ -252,7 +252,7 @@ irc_color_decode_for_user_entry (char *string)
*/
char *
-irc_color_encode (char *string, int keep_colors)
+irc_color_encode (const char *string, int keep_colors)
{
unsigned char *out, *ptr_string;
int out_length, out_pos, length;
diff --git a/src/plugins/irc/irc-color.h b/src/plugins/irc/irc-color.h
index 7b4ff08b9..a62984e18 100644
--- a/src/plugins/irc/irc-color.h
+++ b/src/plugins/irc/irc-color.h
@@ -53,8 +53,8 @@
#define IRC_COLOR_UNDERLINE_CHAR '\x1F'
#define IRC_COLOR_UNDERLINE_STR "\x1F"
-extern char *irc_color_decode (char *string, int keep_colors);
-extern char *irc_color_decode_for_user_entry (char *string);
-extern char *irc_color_encode (char *string, int keep_colors);
+extern char *irc_color_decode (const char *string, int keep_colors);
+extern char *irc_color_decode_for_user_entry (const char *string);
+extern char *irc_color_encode (const char *string, int keep_colors);
#endif /* irc-color.h */
diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c
index 4498fceac..a2ab247d4 100644
--- a/src/plugins/irc/irc-command.c
+++ b/src/plugins/irc/irc-command.c
@@ -71,7 +71,7 @@ irc_command_admin (void *data, struct t_gui_buffer *buffer, int argc,
void
irc_command_me_channel (struct t_irc_server *server,
struct t_irc_channel *channel,
- char *arguments)
+ const char *arguments)
{
char *string;
@@ -97,7 +97,7 @@ irc_command_me_channel (struct t_irc_server *server,
*/
void
-irc_command_me_all_channels (struct t_irc_server *server, char *arguments)
+irc_command_me_all_channels (struct t_irc_server *server, const char *arguments)
{
struct t_irc_channel *ptr_channel;
@@ -114,8 +114,8 @@ irc_command_me_all_channels (struct t_irc_server *server, char *arguments)
*/
void
-irc_command_mode_nicks (struct t_irc_server *server, char *channel,
- char *set, char *mode, int argc, char **argv)
+irc_command_mode_nicks (struct t_irc_server *server, const char *channel,
+ const char *set, const char *mode, int argc, char **argv)
{
int i, length;
char *command;
@@ -248,7 +248,7 @@ irc_command_amsg (void *data, struct t_gui_buffer *buffer, int argc,
*/
void
-irc_command_away_server (struct t_irc_server *server, char *arguments)
+irc_command_away_server (struct t_irc_server *server, const char *arguments)
{
char *string, buffer[4096];
time_t time_now, elapsed;
@@ -1098,9 +1098,10 @@ irc_command_die (void *data, struct t_gui_buffer *buffer, int argc,
*/
void
-irc_command_quit_server (struct t_irc_server *server, char *arguments)
+irc_command_quit_server (struct t_irc_server *server, const char *arguments)
{
- char *ptr_arg, *buf, *version;
+ const char *ptr_arg;
+ char *buf, *version;
if (!server)
return;
@@ -1348,7 +1349,7 @@ irc_command_ison (void *data, struct t_gui_buffer *buffer, int argc,
*/
void
-irc_command_join_server (struct t_irc_server *server, char *arguments)
+irc_command_join_server (struct t_irc_server *server, const char *arguments)
{
if (irc_channel_is_channel (arguments))
irc_server_sendf (server, "JOIN %s", arguments);
@@ -1708,7 +1709,7 @@ irc_command_me (void *data, struct t_gui_buffer *buffer, int argc, char **argv,
*/
void
-irc_command_mode_server (struct t_irc_server *server, char *arguments)
+irc_command_mode_server (struct t_irc_server *server, const char *arguments)
{
irc_server_sendf (server, "MODE %s", arguments);
}
@@ -1967,7 +1968,7 @@ irc_command_names (void *data, struct t_gui_buffer *buffer, int argc,
*/
void
-irc_send_nick_server (struct t_irc_server *server, char *nickname)
+irc_send_nick_server (struct t_irc_server *server, const char *nickname)
{
if (!server)
return;
@@ -2133,10 +2134,11 @@ irc_command_oper (void *data, struct t_gui_buffer *buffer, int argc,
*/
void
-irc_command_part_channel (struct t_irc_server *server, char *channel_name,
- char *part_message)
+irc_command_part_channel (struct t_irc_server *server, const char *channel_name,
+ const char *part_message)
{
- char *ptr_arg, *buf, *version;
+ const char *ptr_arg;
+ char *buf, *version;
ptr_arg = (part_message) ? part_message :
(weechat_config_string (irc_config_network_default_msg_part)
diff --git a/src/plugins/irc/irc-command.h b/src/plugins/irc/irc-command.h
index fbc346725..5c1b1e8bd 100644
--- a/src/plugins/irc/irc-command.h
+++ b/src/plugins/irc/irc-command.h
@@ -30,16 +30,16 @@ struct t_irc_server;
extern void irc_command_away_server (struct t_irc_server *server,
- char *arguments);
+ const char *arguments);
extern void irc_command_join_server (struct t_irc_server *server,
- char *arguments);
+ const char *arguments);
extern void irc_command_mode_server (struct t_irc_server *server,
- char *arguments);
+ const char *arguments);
extern void irc_command_part_channel (struct t_irc_server *server,
- char *channel_name,
- char *part_message);
+ const char *channel_name,
+ const char *part_message);
extern void irc_command_quit_server (struct t_irc_server *server,
- char *arguments);
+ const char *arguments);
extern void irc_command_init ();
#endif /* irc-command.h */
diff --git a/src/plugins/irc/irc-completion.c b/src/plugins/irc/irc-completion.c
index 392ee7871..776d183d2 100644
--- a/src/plugins/irc/irc-completion.c
+++ b/src/plugins/irc/irc-completion.c
@@ -38,7 +38,7 @@
*/
int
-irc_completion_server_cb (void *data, char *completion,
+irc_completion_server_cb (void *data, const char *completion,
struct t_gui_buffer *buffer, struct t_weelist *list)
{
IRC_GET_SERVER(buffer);
@@ -59,7 +59,7 @@ irc_completion_server_cb (void *data, char *completion,
*/
int
-irc_completion_server_nicks_cb (void *data, char *completion,
+irc_completion_server_nicks_cb (void *data, const char *completion,
struct t_gui_buffer *buffer,
struct t_weelist *list)
{
@@ -101,7 +101,7 @@ irc_completion_server_nicks_cb (void *data, char *completion,
*/
int
-irc_completion_servers_cb (void *data, char *completion,
+irc_completion_servers_cb (void *data, const char *completion,
struct t_gui_buffer *buffer, struct t_weelist *list)
{
struct t_irc_server *ptr_server;
@@ -125,7 +125,7 @@ irc_completion_servers_cb (void *data, char *completion,
*/
int
-irc_completion_channel_cb (void *data, char *completion,
+irc_completion_channel_cb (void *data, const char *completion,
struct t_gui_buffer *buffer, struct t_weelist *list)
{
IRC_GET_SERVER_CHANNEL(buffer);
@@ -146,7 +146,7 @@ irc_completion_channel_cb (void *data, char *completion,
*/
int
-irc_completion_channel_nicks_cb (void *data, char *completion,
+irc_completion_channel_nicks_cb (void *data, const char *completion,
struct t_gui_buffer *buffer,
struct t_weelist *list)
{
@@ -206,7 +206,7 @@ irc_completion_channel_nicks_cb (void *data, char *completion,
*/
int
-irc_completion_channel_nicks_hosts_cb (void *data, char *completion,
+irc_completion_channel_nicks_hosts_cb (void *data, const char *completion,
struct t_gui_buffer *buffer,
struct t_weelist *list)
{
@@ -259,7 +259,7 @@ irc_completion_channel_nicks_hosts_cb (void *data, char *completion,
*/
int
-irc_completion_channel_topic_cb (void *data, char *completion,
+irc_completion_channel_topic_cb (void *data, const char *completion,
struct t_gui_buffer *buffer,
struct t_weelist *list)
{
@@ -289,7 +289,7 @@ irc_completion_channel_topic_cb (void *data, char *completion,
*/
int
-irc_completion_channels_cb (void *data, char *completion,
+irc_completion_channels_cb (void *data, const char *completion,
struct t_gui_buffer *buffer, struct t_weelist *list)
{
struct t_irc_server *ptr_server;
@@ -318,7 +318,7 @@ irc_completion_channels_cb (void *data, char *completion,
*/
int
-irc_completion_msg_part_cb (void *data, char *completion,
+irc_completion_msg_part_cb (void *data, const char *completion,
struct t_gui_buffer *buffer, struct t_weelist *list)
{
/* make C compiler happy */
diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c
index 5907e0ffb..f028642d5 100644
--- a/src/plugins/irc/irc-config.c
+++ b/src/plugins/irc/irc-config.c
@@ -92,7 +92,7 @@ struct t_config_option *irc_config_server_default[IRC_CONFIG_NUM_SERVER_OPTIONS]
*/
int
-irc_config_search_server_option (char *option_name)
+irc_config_search_server_option (const char *option_name)
{
int i;
@@ -111,7 +111,7 @@ irc_config_search_server_option (char *option_name)
}
struct t_irc_server *
-irc_config_get_server_from_option_name (char *name)
+irc_config_get_server_from_option_name (const char *name)
{
struct t_irc_server *ptr_server;
char *pos_option, *server_name;
@@ -492,7 +492,7 @@ irc_config_reload (void *data, struct t_config_file *config_file)
void
irc_config_server_write_default (void *data, struct t_config_file *config_file,
- char *section_name)
+ const char *section_name)
{
/* make C compiler happy */
(void) data;
@@ -511,7 +511,7 @@ struct t_config_option *
irc_config_server_new_option (struct t_config_file *config_file,
struct t_config_section *section,
int index_option,
- char *option_name, char *value,
+ const char *option_name, const char *value,
void *callback_change,
void *callback_change_data,
void *callback_delete,
@@ -688,7 +688,7 @@ irc_config_server_new_option (struct t_config_file *config_file,
int
irc_config_server_create_option (void *data, struct t_config_file *config_file,
struct t_config_section *section,
- char *option_name, char *value)
+ const char *option_name, const char *value)
{
struct t_config_option *ptr_option;
struct t_irc_server *ptr_server;
diff --git a/src/plugins/irc/irc-debug.c b/src/plugins/irc/irc-debug.c
index eb3c123a3..4f16ce8f3 100644
--- a/src/plugins/irc/irc-debug.c
+++ b/src/plugins/irc/irc-debug.c
@@ -54,7 +54,7 @@ irc_debug_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
void
irc_debug_printf (struct t_irc_server *server, int send, int modified,
- char *message)
+ const char *message)
{
char *buf;
@@ -100,8 +100,8 @@ irc_debug_printf (struct t_irc_server *server, int send, int modified,
*/
int
-irc_debug_signal_debug_cb (void *data, char *signal, char *type_data,
- void *signal_data)
+irc_debug_signal_debug_cb (void *data, const char *signal,
+ const char *type_data, void *signal_data)
{
/* make C compiler happy */
(void) data;
@@ -127,8 +127,8 @@ irc_debug_signal_debug_cb (void *data, char *signal, char *type_data,
*/
int
-irc_debug_signal_debug_dump_cb (void *data, char *signal, char *type_data,
- void *signal_data)
+irc_debug_signal_debug_dump_cb (void *data, const char *signal,
+ const char *type_data, void *signal_data)
{
/* make C compiler happy */
(void) data;
diff --git a/src/plugins/irc/irc-debug.h b/src/plugins/irc/irc-debug.h
index 421c21b9a..a894df6b1 100644
--- a/src/plugins/irc/irc-debug.h
+++ b/src/plugins/irc/irc-debug.h
@@ -28,7 +28,7 @@
struct t_irc_server;
extern void irc_debug_printf (struct t_irc_server *server, int send,
- int modified, char *message);
+ int modified, const char *message);
extern void irc_debug_init ();
#endif /* irc-debug.h */
diff --git a/src/plugins/irc/irc-display.c b/src/plugins/irc/irc-display.c
index fa4034360..e34835561 100644
--- a/src/plugins/irc/irc-display.c
+++ b/src/plugins/irc/irc-display.c
@@ -90,7 +90,7 @@ irc_display_hide_password (char *string, int look_for_nickserv)
*/
void
-irc_display_away (struct t_irc_server *server, char *string1, char *string2)
+irc_display_away (struct t_irc_server *server, const char *string1, const char *string2)
{
struct t_irc_channel *ptr_channel;
@@ -118,8 +118,9 @@ irc_display_away (struct t_irc_server *server, char *string1, char *string2)
void
irc_display_mode (struct t_gui_buffer *buffer,
- char *channel_name, char *nick_name, char set_flag,
- char *symbol, char *nick_host, char *message, char *param)
+ const char *channel_name, const char *nick_name,
+ char set_flag, const char *symbol, const char *nick_host,
+ const char *message, const char *param)
{
weechat_printf (buffer,
"%s[%s%s%s/%s%c%s%s] %s%s %s%s%s%s%s",
diff --git a/src/plugins/irc/irc-display.h b/src/plugins/irc/irc-display.h
index 74ab46bcf..e98d79ca2 100644
--- a/src/plugins/irc/irc-display.h
+++ b/src/plugins/irc/irc-display.h
@@ -22,14 +22,16 @@
extern void irc_display_hide_password (char *string, int look_for_nickserv);
extern void irc_display_nick (struct t_gui_buffer *buffer,
- struct t_irc_nick *nick, char *nickname,
- int type, int display_around, char *force_color,
- int no_nickmode);
-extern void irc_display_away (struct t_irc_server *server, char *string1,
- char *string2);
-extern void irc_display_mode (struct t_gui_buffer *buffer, char *channel_name,
- char *nick_name, char set_flag, char *symbol,
- char *nick_host, char *message, char *param);
+ struct t_irc_nick *nick, const char *nickname,
+ int type, int display_around,
+ const char *force_color, int no_nickmode);
+extern void irc_display_away (struct t_irc_server *server, const char *string1,
+ const char *string2);
+extern void irc_display_mode (struct t_gui_buffer *buffer,
+ const char *channel_name, const char *nick_name,
+ char set_flag, const char *symbol,
+ const char *nick_host, const char *message,
+ const char *param);
extern void irc_display_server (struct t_irc_server *server, int with_detail);
#endif /* irc-display.h */
diff --git a/src/plugins/irc/irc-input.c b/src/plugins/irc/irc-input.c
index 47c22f3f7..1e76901e5 100644
--- a/src/plugins/irc/irc-input.c
+++ b/src/plugins/irc/irc-input.c
@@ -36,7 +36,7 @@
*/
void
-irc_input_user_message_display (struct t_gui_buffer *buffer, char *text)
+irc_input_user_message_display (struct t_gui_buffer *buffer, const char *text)
{
struct t_irc_nick *ptr_nick;
char *text_decoded;
@@ -84,13 +84,15 @@ irc_input_user_message_display (struct t_gui_buffer *buffer, char *text)
/*
* irc_input_send_user_message: send a PRIVMSG message, and split it
* if > 512 bytes
+ * warning: this function makes temporarirly
+ * changes in "text"
*/
void
irc_input_send_user_message (struct t_gui_buffer *buffer, char *text)
{
int max_length;
- char *pos, *pos_next, *pos_max, *next, saved_char, *last_space;
+ char *pos, *pos_max, *last_space, *pos_next, *next, saved_char;
IRC_GET_SERVER_CHANNEL(buffer);
@@ -151,9 +153,10 @@ irc_input_send_user_message (struct t_gui_buffer *buffer, char *text)
*/
int
-irc_input_data_cb (void *data, struct t_gui_buffer *buffer, char *input_data)
+irc_input_data_cb (void *data, struct t_gui_buffer *buffer,
+ const char *input_data)
{
- char *data_with_colors;
+ char *data_with_colors, *msg;
/* make C compiler happy */
(void) data;
@@ -164,9 +167,13 @@ irc_input_data_cb (void *data, struct t_gui_buffer *buffer, char *input_data)
{
data_with_colors = irc_color_encode (input_data,
weechat_config_boolean (irc_config_network_colors_send));
-
- irc_input_send_user_message (buffer,
- (data_with_colors) ? data_with_colors : input_data);
+
+ msg = strdup ((data_with_colors) ? data_with_colors : input_data);
+ if (msg)
+ {
+ irc_input_send_user_message (buffer, msg);
+ free (msg);
+ }
if (data_with_colors)
free (data_with_colors);
diff --git a/src/plugins/irc/irc-input.h b/src/plugins/irc/irc-input.h
index 6310546ad..67649fe65 100644
--- a/src/plugins/irc/irc-input.h
+++ b/src/plugins/irc/irc-input.h
@@ -21,6 +21,6 @@
#define __WEECHAT_IRC_INPUT_H 1
extern int irc_input_data_cb (void *data, struct t_gui_buffer *buffer,
- char *input_data);
+ const char *input_data);
#endif /* irc-input.h */
diff --git a/src/plugins/irc/irc-mode.c b/src/plugins/irc/irc-mode.c
index 9fd51b2d6..3afaacf5f 100644
--- a/src/plugins/irc/irc-mode.c
+++ b/src/plugins/irc/irc-mode.c
@@ -35,7 +35,7 @@
*/
void
-irc_mode_channel_set_nick (struct t_irc_channel *channel, char *nick,
+irc_mode_channel_set_nick (struct t_irc_channel *channel, const char *nick,
char set_flag, int flag)
{
struct t_irc_nick *ptr_nick;
@@ -53,13 +53,13 @@ irc_mode_channel_set_nick (struct t_irc_channel *channel, char *nick,
*/
char
-irc_mode_channel_get_flag (char *str, char *pos)
+irc_mode_channel_get_flag (const char *string, const char *pos)
{
char set_flag;
set_flag = '+';
pos--;
- while (pos >= str)
+ while (pos >= string)
{
if (pos[0] == '-')
return '-';
@@ -76,7 +76,7 @@ irc_mode_channel_get_flag (char *str, char *pos)
void
irc_mode_channel_set (struct t_irc_server *server,
- struct t_irc_channel *channel, char *modes)
+ struct t_irc_channel *channel, const char *modes)
{
char *pos_args, *str_modes, set_flag, **argv, *pos, *ptr_arg;
int argc, current_arg;
@@ -269,7 +269,7 @@ irc_mode_user_remove (struct t_irc_server *server, char mode)
*/
void
-irc_mode_user_set (struct t_irc_server *server, char *modes)
+irc_mode_user_set (struct t_irc_server *server, const char *modes)
{
char set_flag;
diff --git a/src/plugins/irc/irc-mode.h b/src/plugins/irc/irc-mode.h
index cfed89cc1..564a0f388 100644
--- a/src/plugins/irc/irc-mode.h
+++ b/src/plugins/irc/irc-mode.h
@@ -24,8 +24,9 @@ struct t_irc_server;
struct t_irc_channel;
extern void irc_mode_channel_set (struct t_irc_server *server,
- struct t_irc_channel *channel, char *modes);
-extern void irc_mode_user_set (struct t_irc_server *server, char *modes);
+ struct t_irc_channel *channel,
+ const char *modes);
+extern void irc_mode_user_set (struct t_irc_server *server, const char *modes);
extern int irc_mode_nick_prefix_allowed (struct t_irc_server *server,
char prefix);
diff --git a/src/plugins/irc/irc-nick.c b/src/plugins/irc/irc-nick.c
index fcc232ef8..464d585c9 100644
--- a/src/plugins/irc/irc-nick.c
+++ b/src/plugins/irc/irc-nick.c
@@ -155,7 +155,7 @@ irc_nick_get_gui_infos (struct t_irc_nick *nick,
struct t_irc_nick *
irc_nick_new (struct t_irc_server *server, struct t_irc_channel *channel,
- char *nick_name, int is_chanowner, int is_chanadmin,
+ const char *nick_name, int is_chanowner, int is_chanadmin,
int is_chanadmin2, int is_op, int is_halfop, int has_voice,
int is_chanuser)
{
@@ -251,7 +251,7 @@ irc_nick_new (struct t_irc_server *server, struct t_irc_channel *channel,
void
irc_nick_change (struct t_irc_server *server, struct t_irc_channel *channel,
- struct t_irc_nick *nick, char *new_nick)
+ struct t_irc_nick *nick, const char *new_nick)
{
int nick_is_me, prefix_color;
struct t_gui_nick_group *ptr_group;
@@ -402,7 +402,7 @@ irc_nick_free_all (struct t_irc_channel *channel)
*/
struct t_irc_nick *
-irc_nick_search (struct t_irc_channel *channel, char *nickname)
+irc_nick_search (struct t_irc_channel *channel, const char *nickname)
{
struct t_irc_nick *ptr_nick;
@@ -500,7 +500,8 @@ irc_nick_set_away (struct t_irc_channel *channel, struct t_irc_nick *nick,
*/
char *
-irc_nick_as_prefix (struct t_irc_nick *nick, char *nickname, char *force_color)
+irc_nick_as_prefix (struct t_irc_nick *nick, const char *nickname,
+ const char *force_color)
{
static char result[256];
char prefix[2], str_prefix_color[64];
diff --git a/src/plugins/irc/irc-nick.h b/src/plugins/irc/irc-nick.h
index cd34d39d8..d6a57b6e6 100644
--- a/src/plugins/irc/irc-nick.h
+++ b/src/plugins/irc/irc-nick.h
@@ -58,27 +58,27 @@ struct t_irc_nick
extern struct t_irc_nick *irc_nick_new (struct t_irc_server *server,
struct t_irc_channel *channel,
- char *nick_name, int is_chanowner,
+ const char *nick_name, int is_chanowner,
int is_chanadmin, int is_chanadmin2,
int is_op, int is_halfop,
int has_voice, int is_chanuser);
extern void irc_nick_change (struct t_irc_server *server,
struct t_irc_channel *channel,
- struct t_irc_nick *nick, char *new_nick);
+ struct t_irc_nick *nick, const char *new_nick);
extern void irc_nick_set (struct t_irc_channel *channel,
struct t_irc_nick *nick, int set, int flag);
extern void irc_nick_free (struct t_irc_channel *channel,
struct t_irc_nick *nick);
extern void irc_nick_free_all (struct t_irc_channel *channel);
extern struct t_irc_nick *irc_nick_search (struct t_irc_channel *channel,
- char *nickname);
+ const char *nickname);
extern void irc_nick_count (struct t_irc_channel *channel, int *total,
int *count_op, int *count_halfop, int *count_voice,
int *count_normal);
extern void irc_nick_set_away (struct t_irc_channel *channel,
struct t_irc_nick *nick, int is_away);
-extern char *irc_nick_as_prefix (struct t_irc_nick *nick, char *nickname,
- char *force_color);
+extern char *irc_nick_as_prefix (struct t_irc_nick *nick, const char *nickname,
+ const char *force_color);
extern void irc_nick_print_log (struct t_irc_nick *nick);
#endif /* irc-nick.h */
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c
index fad80f891..c7b1f16b1 100644
--- a/src/plugins/irc/irc-protocol.c
+++ b/src/plugins/irc/irc-protocol.c
@@ -48,7 +48,7 @@
*/
char *
-irc_protocol_get_nick_from_host (char *host)
+irc_protocol_get_nick_from_host (const char *host)
{
static char nick[128];
char *pos;
@@ -75,7 +75,7 @@ irc_protocol_get_nick_from_host (char *host)
*/
char *
-irc_protocol_get_address_from_host (char *host)
+irc_protocol_get_address_from_host (const char *host)
{
static char address[256];
char *pos;
@@ -99,7 +99,7 @@ irc_protocol_get_address_from_host (char *host)
*/
char *
-irc_protocol_tags (char *command, char *tags)
+irc_protocol_tags (const char *command, const char *tags)
{
static char string[256];
@@ -132,7 +132,7 @@ irc_protocol_tags (char *command, char *tags)
char *
irc_protocol_replace_vars (struct t_irc_server *server,
- struct t_irc_channel *channel, char *string)
+ struct t_irc_channel *channel, const char *string)
{
char *var_nick, *var_channel, *var_server;
char empty_string[1] = { '\0' };
@@ -171,7 +171,7 @@ irc_protocol_replace_vars (struct t_irc_server *server,
*/
int
-irc_protocol_cmd_error (struct t_irc_server *server, char *command,
+irc_protocol_cmd_error (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
int first_arg;
@@ -216,7 +216,7 @@ irc_protocol_cmd_error (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_invite (struct t_irc_server *server, char *command,
+irc_protocol_cmd_invite (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* INVITE message looks like:
@@ -251,7 +251,7 @@ irc_protocol_cmd_invite (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_join (struct t_irc_server *server, char *command,
+irc_protocol_cmd_join (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
struct t_irc_channel *ptr_channel;
@@ -325,7 +325,7 @@ irc_protocol_cmd_join (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_kick (struct t_irc_server *server, char *command,
+irc_protocol_cmd_kick (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_comment;
@@ -414,7 +414,7 @@ irc_protocol_cmd_kick (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_kill (struct t_irc_server *server, char *command,
+irc_protocol_cmd_kill (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_comment;
@@ -481,7 +481,7 @@ irc_protocol_cmd_kill (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_mode (struct t_irc_server *server, char *command,
+irc_protocol_cmd_mode (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_modes;
@@ -543,7 +543,7 @@ irc_protocol_cmd_mode (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_nick (struct t_irc_server *server, char *command,
+irc_protocol_cmd_nick (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
struct t_irc_channel *ptr_channel;
@@ -632,7 +632,7 @@ irc_protocol_cmd_nick (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_notice (struct t_irc_server *server, char *command,
+irc_protocol_cmd_notice (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *nick, *host, *pos_args, *pos_end, *pos_usec;
@@ -820,7 +820,7 @@ irc_protocol_cmd_notice (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_part (struct t_irc_server *server, char *command,
+irc_protocol_cmd_part (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *nick, *host, *pos_comment, *join_string;
@@ -929,7 +929,7 @@ irc_protocol_cmd_part (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_ping (struct t_irc_server *server, char *command,
+irc_protocol_cmd_ping (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* PING message looks like:
@@ -952,7 +952,7 @@ irc_protocol_cmd_ping (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_pong (struct t_irc_server *server, char *command,
+irc_protocol_cmd_pong (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
struct timeval tv;
@@ -990,8 +990,8 @@ irc_protocol_cmd_pong (struct t_irc_server *server, char *command,
void
irc_protocol_reply_version (struct t_irc_server *server,
- struct t_irc_channel *channel, char *nick,
- char *message, char *str_version)
+ struct t_irc_channel *channel, const char *nick,
+ const char *message, const char *str_version)
{
char *pos, *version, *date;
struct t_gui_buffer *ptr_buffer;
@@ -1043,7 +1043,7 @@ irc_protocol_reply_version (struct t_irc_server *server,
}
weechat_hook_signal_send ("irc_ctcp",
WEECHAT_HOOK_SIGNAL_STRING,
- message);
+ (void *)message);
}
/*
@@ -1051,7 +1051,7 @@ irc_protocol_reply_version (struct t_irc_server *server,
*/
int
-irc_protocol_cmd_privmsg (struct t_irc_server *server, char *command,
+irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *nick, *host, *pos_args, *pos_end_01, *pos, *pos_message;
@@ -1911,7 +1911,7 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_quit (struct t_irc_server *server, char *command,
+irc_protocol_cmd_quit (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *nick, *host, *pos_comment;
@@ -1988,7 +1988,7 @@ irc_protocol_cmd_quit (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_server_mode_reason (struct t_irc_server *server, char *command,
+irc_protocol_cmd_server_mode_reason (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_mode, *pos_args;
@@ -2022,7 +2022,7 @@ irc_protocol_cmd_server_mode_reason (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_numeric (struct t_irc_server *server, char *command,
+irc_protocol_cmd_numeric (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_args;
@@ -2056,7 +2056,7 @@ irc_protocol_cmd_numeric (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_topic (struct t_irc_server *server, char *command,
+irc_protocol_cmd_topic (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_topic, *topic_color;
@@ -2135,7 +2135,7 @@ irc_protocol_cmd_topic (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_wallops (struct t_irc_server *server, char *command,
+irc_protocol_cmd_wallops (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* WALLOPS message looks like:
@@ -2165,7 +2165,7 @@ irc_protocol_cmd_wallops (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_001 (struct t_irc_server *server, char *command,
+irc_protocol_cmd_001 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char **commands, **ptr_cmd, *vars_replaced;
@@ -2233,7 +2233,7 @@ irc_protocol_cmd_001 (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_005 (struct t_irc_server *server, char *command,
+irc_protocol_cmd_005 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos, *pos2;
@@ -2278,7 +2278,7 @@ irc_protocol_cmd_005 (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_221 (struct t_irc_server *server, char *command,
+irc_protocol_cmd_221 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* 221 message looks like:
@@ -2309,7 +2309,7 @@ irc_protocol_cmd_221 (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_301 (struct t_irc_server *server, char *command,
+irc_protocol_cmd_301 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_away_msg;
@@ -2361,7 +2361,7 @@ irc_protocol_cmd_301 (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_303 (struct t_irc_server *server, char *command,
+irc_protocol_cmd_303 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* 301 message looks like:
@@ -2388,7 +2388,7 @@ irc_protocol_cmd_303 (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_305 (struct t_irc_server *server, char *command,
+irc_protocol_cmd_305 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* 305 message looks like:
@@ -2430,7 +2430,7 @@ irc_protocol_cmd_305 (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_306 (struct t_irc_server *server, char *command,
+irc_protocol_cmd_306 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* 306 message looks like:
@@ -2478,7 +2478,7 @@ irc_protocol_cmd_306 (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_whois_nick_msg (struct t_irc_server *server, char *command,
+irc_protocol_cmd_whois_nick_msg (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* messages look like:
@@ -2506,7 +2506,7 @@ irc_protocol_cmd_whois_nick_msg (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_311 (struct t_irc_server *server, char *command,
+irc_protocol_cmd_311 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* 311 message looks like:
@@ -2538,7 +2538,7 @@ irc_protocol_cmd_311 (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_312 (struct t_irc_server *server, char *command,
+irc_protocol_cmd_312 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* 312 message looks like:
@@ -2570,7 +2570,7 @@ irc_protocol_cmd_312 (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_314 (struct t_irc_server *server, char *command,
+irc_protocol_cmd_314 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* 314 message looks like:
@@ -2601,7 +2601,7 @@ irc_protocol_cmd_314 (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_315 (struct t_irc_server *server, char *command,
+irc_protocol_cmd_315 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* 315 message looks like:
@@ -2639,7 +2639,7 @@ irc_protocol_cmd_315 (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_317 (struct t_irc_server *server, char *command,
+irc_protocol_cmd_317 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
int idle_time, day, hour, min, sec;
@@ -2731,7 +2731,7 @@ irc_protocol_cmd_317 (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_321 (struct t_irc_server *server, char *command,
+irc_protocol_cmd_321 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_args;
@@ -2761,7 +2761,7 @@ irc_protocol_cmd_321 (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_322 (struct t_irc_server *server, char *command,
+irc_protocol_cmd_322 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_topic;
@@ -2801,7 +2801,7 @@ irc_protocol_cmd_322 (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_323 (struct t_irc_server *server, char *command,
+irc_protocol_cmd_323 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_args;
@@ -2832,7 +2832,7 @@ irc_protocol_cmd_323 (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_324 (struct t_irc_server *server, char *command,
+irc_protocol_cmd_324 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
struct t_irc_channel *ptr_channel;
@@ -2875,7 +2875,7 @@ irc_protocol_cmd_324 (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_327 (struct t_irc_server *server, char *command,
+irc_protocol_cmd_327 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_realname;
@@ -2930,7 +2930,7 @@ irc_protocol_cmd_327 (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_329 (struct t_irc_server *server, char *command,
+irc_protocol_cmd_329 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
struct t_irc_channel *ptr_channel;
@@ -2979,7 +2979,7 @@ irc_protocol_cmd_329 (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_331 (struct t_irc_server *server, char *command,
+irc_protocol_cmd_331 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
struct t_irc_channel *ptr_channel;
@@ -3010,7 +3010,7 @@ irc_protocol_cmd_331 (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_332 (struct t_irc_server *server, char *command,
+irc_protocol_cmd_332 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_topic;
@@ -3053,7 +3053,7 @@ irc_protocol_cmd_332 (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_333 (struct t_irc_server *server, char *command,
+irc_protocol_cmd_333 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
struct t_irc_channel *ptr_channel;
@@ -3102,7 +3102,7 @@ irc_protocol_cmd_333 (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_338 (struct t_irc_server *server, char *command,
+irc_protocol_cmd_338 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* 338 message looks like:
@@ -3132,7 +3132,7 @@ irc_protocol_cmd_338 (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_341 (struct t_irc_server *server, char *command,
+irc_protocol_cmd_341 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* 341 message looks like:
@@ -3165,7 +3165,7 @@ irc_protocol_cmd_341 (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_344 (struct t_irc_server *server, char *command,
+irc_protocol_cmd_344 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* 344 message looks like:
@@ -3192,7 +3192,7 @@ irc_protocol_cmd_344 (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_345 (struct t_irc_server *server, char *command,
+irc_protocol_cmd_345 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* 345 message looks like:
@@ -3218,7 +3218,7 @@ irc_protocol_cmd_345 (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_348 (struct t_irc_server *server, char *command,
+irc_protocol_cmd_348 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
struct t_irc_channel *ptr_channel;
@@ -3285,7 +3285,7 @@ irc_protocol_cmd_348 (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_349 (struct t_irc_server *server, char *command,
+irc_protocol_cmd_349 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_args;
@@ -3322,7 +3322,7 @@ irc_protocol_cmd_349 (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_351 (struct t_irc_server *server, char *command,
+irc_protocol_cmd_351 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* 351 message looks like:
@@ -3359,7 +3359,7 @@ irc_protocol_cmd_351 (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_352 (struct t_irc_server *server, char *command,
+irc_protocol_cmd_352 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_attr, *pos_hopcount, *pos_realname;
@@ -3441,7 +3441,7 @@ irc_protocol_cmd_352 (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_353 (struct t_irc_server *server, char *command,
+irc_protocol_cmd_353 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_channel, *pos_nick, *color;
@@ -3568,7 +3568,7 @@ irc_protocol_cmd_353 (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_366 (struct t_irc_server *server, char *command,
+irc_protocol_cmd_366 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
struct t_irc_channel *ptr_channel;
@@ -3699,7 +3699,7 @@ irc_protocol_cmd_366 (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_367 (struct t_irc_server *server, char *command,
+irc_protocol_cmd_367 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
struct t_irc_channel *ptr_channel;
@@ -3771,7 +3771,7 @@ irc_protocol_cmd_367 (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_368 (struct t_irc_server *server, char *command,
+irc_protocol_cmd_368 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_args;
@@ -3808,7 +3808,7 @@ irc_protocol_cmd_368 (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_432 (struct t_irc_server *server, char *command,
+irc_protocol_cmd_432 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
int i, nick_found, nick_to_use;
@@ -3864,7 +3864,7 @@ irc_protocol_cmd_432 (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_433 (struct t_irc_server *server, char *command,
+irc_protocol_cmd_433 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
int i, nick_found, nick_to_use;
@@ -3922,7 +3922,7 @@ irc_protocol_cmd_433 (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_cmd_438 (struct t_irc_server *server, char *command,
+irc_protocol_cmd_438 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* 438 message looks like:
@@ -3959,7 +3959,7 @@ irc_protocol_cmd_438 (struct t_irc_server *server, char *command,
*/
int
-irc_protocol_is_numeric_command (char *str)
+irc_protocol_is_numeric_command (const char *str)
{
while (str && str[0])
{
@@ -3979,14 +3979,16 @@ irc_protocol_is_numeric_command (char *str)
*/
void
-irc_protocol_recv_command (struct t_irc_server *server, char *entire_line,
- char *host, char *command, char *arguments)
+irc_protocol_recv_command (struct t_irc_server *server, const char *entire_line,
+ const char *host, const char *command,
+ const char *arguments)
{
int i, cmd_found, return_code, argc, decode_color;
char *pos, *nick;
char *dup_entire_line, *dup_host, *dup_arguments, *irc_message;
t_irc_recv_func *cmd_recv_func;
- char *cmd_name, **argv, **argv_eol;
+ const char *cmd_name;
+ char **argv, **argv_eol;
struct t_irc_protocol_msg irc_protocol_messages[] =
{ { "error", N_("error received from IRC server"), 1, &irc_protocol_cmd_error },
{ "invite", N_("invite a nick on a channel"), 1, &irc_protocol_cmd_invite },
diff --git a/src/plugins/irc/irc-protocol.h b/src/plugins/irc/irc-protocol.h
index 4c56ef5dc..28f3e45e6 100644
--- a/src/plugins/irc/irc-protocol.h
+++ b/src/plugins/irc/irc-protocol.h
@@ -44,7 +44,7 @@
struct t_irc_server;
-typedef int (t_irc_recv_func)(struct t_irc_server *server, char *comand,
+typedef int (t_irc_recv_func)(struct t_irc_server *server, const char *comand,
int argc, char **argv, char **argv_eol);
struct t_irc_protocol_msg
@@ -56,7 +56,8 @@ struct t_irc_protocol_msg
};
extern void irc_protocol_recv_command (struct t_irc_server *server,
- char *entire_line, char *host,
- char *command, char *arguments);
+ const char *entire_line,
+ const char *host, const char *command,
+ const char *arguments);
#endif /* irc-protocol.h */
diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c
index 7c36bf550..89d6d54ea 100644
--- a/src/plugins/irc/irc-server.c
+++ b/src/plugins/irc/irc-server.c
@@ -53,7 +53,7 @@ struct t_irc_message *irc_msgq_last_msg = NULL;
*/
void
-irc_server_set_addresses (struct t_irc_server *server, char *addresses)
+irc_server_set_addresses (struct t_irc_server *server, const char *addresses)
{
int i;
char *pos, *error;
@@ -113,7 +113,7 @@ irc_server_set_addresses (struct t_irc_server *server, char *addresses)
*/
void
-irc_server_set_nicks (struct t_irc_server *server, char *nicks)
+irc_server_set_nicks (struct t_irc_server *server, const char *nicks)
{
/* free data */
if (server->nicks)
@@ -224,7 +224,7 @@ irc_server_set_with_option (struct t_irc_server *server,
*/
void
-irc_server_set_nick (struct t_irc_server *server, char *nick)
+irc_server_set_nick (struct t_irc_server *server, const char *nick)
{
struct t_irc_channel *ptr_channel;
@@ -323,7 +323,7 @@ irc_server_init (struct t_irc_server *server)
*/
struct t_irc_server *
-irc_server_alloc (char *name)
+irc_server_alloc (const char *name)
{
struct t_irc_server *new_server;
@@ -363,41 +363,51 @@ irc_server_alloc (char *name)
*/
int
-irc_server_alloc_with_url (char *irc_url)
+irc_server_alloc_with_url (const char *irc_url)
{
- char *url, *pos_server, *pos_channel, *pos, *pos2;
+ char *irc_url2, *url, *pos_server, *pos_channel, *pos, *pos2;
char *password, *nick1, *nicks, *autojoin;
int ipv6, ssl, length;
struct t_irc_server *ptr_server;
+ irc_url2 = strdup (irc_url);
+ if (!irc_url2)
+ return 0;
+
ipv6 = 0;
ssl = 0;
password = NULL;
nick1 = NULL;
autojoin = NULL;
- if (weechat_strncasecmp (irc_url, "irc6://", 7) == 0)
+
+ if (weechat_strncasecmp (irc_url2, "irc6://", 7) == 0)
{
- pos = irc_url + 7;
+ pos = irc_url2 + 7;
ipv6 = 1;
}
- else if (weechat_strncasecmp (irc_url, "ircs://", 7) == 0)
+ else if (weechat_strncasecmp (irc_url2, "ircs://", 7) == 0)
{
- pos = irc_url + 7;
+ pos = irc_url2 + 7;
ssl = 1;
}
- else if ((weechat_strncasecmp (irc_url, "irc6s://", 8) == 0)
- || (weechat_strncasecmp (irc_url, "ircs6://", 8) == 0))
+ else if ((weechat_strncasecmp (irc_url2, "irc6s://", 8) == 0)
+ || (weechat_strncasecmp (irc_url2, "ircs6://", 8) == 0))
{
- pos = irc_url + 8;
+ pos = irc_url2 + 8;
ipv6 = 1;
ssl = 1;
}
- else if (weechat_strncasecmp (irc_url, "irc://", 6) == 0)
+ else if (weechat_strncasecmp (irc_url2, "irc://", 6) == 0)
{
- pos = irc_url + 6;
+ pos = irc_url2 + 6;
}
else
+ {
+ free (irc_url2);
return 0;
+ }
+
+ free (irc_url2);
url = strdup (pos);
pos_server = strchr (url, '@');
@@ -487,8 +497,8 @@ irc_server_alloc_with_url (char *irc_url)
*/
void
-irc_server_outqueue_add (struct t_irc_server *server, char *msg1, char *msg2,
- int modified)
+irc_server_outqueue_add (struct t_irc_server *server, const char *msg1,
+ const char *msg2, int modified)
{
struct t_irc_outqueue *new_outqueue;
@@ -657,12 +667,12 @@ irc_server_free_all ()
*/
struct t_irc_server *
-irc_server_new (char *name, int autoconnect, int autoreconnect,
- int autoreconnect_delay, int temp_server, char *addresses,
- int ipv6, int ssl, char *password, char *nicks,
- char *username, char *realname, char *local_hostname,
- char *command, int command_delay, char *autojoin,
- int autorejoin, char *notify_levels)
+irc_server_new (const char *name, int autoconnect, int autoreconnect,
+ int autoreconnect_delay, int temp_server, const char *addresses,
+ int ipv6, int ssl, const char *password, const char *nicks,
+ const char *username, const char *realname, const char *local_hostname,
+ const char *command, int command_delay, const char *autojoin,
+ int autorejoin, const char *notify_levels)
{
struct t_irc_server *new_server;
@@ -725,7 +735,7 @@ irc_server_new (char *name, int autoconnect, int autoreconnect,
*/
struct t_irc_server *
-irc_server_duplicate (struct t_irc_server *server, char *new_name)
+irc_server_duplicate (struct t_irc_server *server, const char *new_name)
{
struct t_irc_server *new_server;
@@ -762,7 +772,7 @@ irc_server_duplicate (struct t_irc_server *server, char *new_name)
*/
int
-irc_server_rename (struct t_irc_server *server, char *new_name)
+irc_server_rename (struct t_irc_server *server, const char *new_name)
{
int length;
char *option_name, *name, *pos_option;
@@ -820,7 +830,7 @@ irc_server_rename (struct t_irc_server *server, char *new_name)
*/
int
-irc_server_send (struct t_irc_server *server, char *buffer, int size_buf)
+irc_server_send (struct t_irc_server *server, const char *buffer, int size_buf)
{
int rc;
@@ -912,10 +922,10 @@ irc_server_outqueue_send (struct t_irc_server *server)
*/
void
-irc_server_parse_message (char *message, char **nick, char **host,
+irc_server_parse_message (const char *message, char **nick, char **host,
char **command, char **channel, char **arguments)
{
- char *pos, *pos2, *pos3, *pos4;
+ const char *pos, *pos2, *pos3, *pos4;
if (nick)
*nick = NULL;
@@ -1029,10 +1039,11 @@ irc_server_parse_message (char *message, char **nick, char **host,
*/
int
-irc_server_send_one_msg (struct t_irc_server *server, char *message)
+irc_server_send_one_msg (struct t_irc_server *server, const char *message)
{
static char buffer[4096];
- char *new_msg, *ptr_msg, *pos, *nick, *command, *channel;
+ const char *ptr_msg;
+ char *new_msg, *pos, *nick, *command, *channel;
char *ptr_chan_nick, *msg_encoded;
char str_modifier[64], modifier_data[256];
int rc, queue, first_message;
@@ -1160,7 +1171,7 @@ irc_server_send_one_msg (struct t_irc_server *server, char *message)
*/
void
-irc_server_sendf (struct t_irc_server *server, char *format, ...)
+irc_server_sendf (struct t_irc_server *server, const char *format, ...)
{
va_list args;
static char buffer[4096];
@@ -1189,7 +1200,7 @@ irc_server_sendf (struct t_irc_server *server, char *format, ...)
*/
void
-irc_server_msgq_add_msg (struct t_irc_server *server, char *msg)
+irc_server_msgq_add_msg (struct t_irc_server *server, const char *msg)
{
struct t_irc_message *message;
@@ -1246,7 +1257,7 @@ irc_server_msgq_add_msg (struct t_irc_server *server, char *msg)
*/
void
-irc_server_msgq_add_unterminated (struct t_irc_server *server, char *string)
+irc_server_msgq_add_unterminated (struct t_irc_server *server, const char *string)
{
if (!string[0])
return;
@@ -1285,7 +1296,7 @@ irc_server_msgq_add_unterminated (struct t_irc_server *server, char *string)
*/
void
-irc_server_msgq_add_buffer (struct t_irc_server *server, char *buffer)
+irc_server_msgq_add_buffer (struct t_irc_server *server, const char *buffer)
{
char *pos_cr, *pos_lf;
@@ -2135,7 +2146,7 @@ irc_server_autojoin_channels (struct t_irc_server *server)
*/
struct t_irc_server *
-irc_server_search (char *server_name)
+irc_server_search (const char *server_name)
{
struct t_irc_server *ptr_server;
@@ -2286,7 +2297,7 @@ irc_server_check_away ()
*/
void
-irc_server_set_away (struct t_irc_server *server, char *nick, int is_away)
+irc_server_set_away (struct t_irc_server *server, const char *nick, int is_away)
{
struct t_irc_channel *ptr_channel;
@@ -2364,8 +2375,8 @@ irc_server_set_default_notify_level (struct t_irc_server *server, int notify)
*/
int
-irc_server_xfer_send_ready_cb (void *data, char *signal, char *type_data,
- void *signal_data)
+irc_server_xfer_send_ready_cb (void *data, const char *signal,
+ const char *type_data, void *signal_data)
{
struct t_plugin_infolist *infolist;
struct t_irc_server *server, *ptr_server;
@@ -2437,8 +2448,8 @@ irc_server_xfer_send_ready_cb (void *data, char *signal, char *type_data,
*/
int
-irc_server_xfer_resume_ready_cb (void *data, char *signal, char *type_data,
- void *signal_data)
+irc_server_xfer_resume_ready_cb (void *data, const char *signal,
+ const char *type_data, void *signal_data)
{
struct t_plugin_infolist *infolist;
struct t_irc_server *server, *ptr_server;
@@ -2493,8 +2504,9 @@ irc_server_xfer_resume_ready_cb (void *data, char *signal, char *type_data,
*/
int
-irc_server_xfer_send_accept_resume_cb (void *data, char *signal,
- char *type_data, void *signal_data)
+irc_server_xfer_send_accept_resume_cb (void *data, const char *signal,
+ const char *type_data,
+ void *signal_data)
{
struct t_plugin_infolist *infolist;
struct t_irc_server *server, *ptr_server;
diff --git a/src/plugins/irc/irc-server.h b/src/plugins/irc/irc-server.h
index 136ddf022..66fdb90ce 100644
--- a/src/plugins/irc/irc-server.h
+++ b/src/plugins/irc/irc-server.h
@@ -137,41 +137,41 @@ extern struct t_irc_message *irc_recv_msgq, *irc_msgq_last_msg;
extern void irc_server_set_addresses (struct t_irc_server *server,
- char *addresses);
-extern void irc_server_set_nicks (struct t_irc_server *server, char *nicks);
+ const char *addresses);
+extern void irc_server_set_nicks (struct t_irc_server *server, const char *nicks);
extern void irc_server_set_with_option (struct t_irc_server *server,
int index_option,
struct t_config_option *option);
extern void irc_server_init (struct t_irc_server *server);
-extern struct t_irc_server *irc_server_alloc (char *name);
-extern int irc_server_alloc_with_url (char *irc_url);
-extern struct t_irc_server *irc_server_new (char *name, int autoconnect,
+extern struct t_irc_server *irc_server_alloc (const char *name);
+extern int irc_server_alloc_with_url (const char *irc_url);
+extern struct t_irc_server *irc_server_new (const char *name, int autoconnect,
int autoreconnect,
int autoreconnect_delay,
- int temp_server, char *addresses,
+ int temp_server, const char *addresses,
int ipv6, int ssl,
- char *password, char *nicks,
- char *username, char *realname,
- char *hostname, char *command,
- int command_delay, char *autojoin,
+ const char *password, const char *nicks,
+ const char *username, const char *realname,
+ const char *hostname, const char *command,
+ int command_delay, const char *autojoin,
int autorejoin,
- char *notify_levels);
+ const char *notify_levels);
extern struct t_irc_server *irc_server_duplicate (struct t_irc_server *server,
- char *new_name);
-extern int irc_server_rename (struct t_irc_server *server, char *new_name);
-extern void irc_server_set_nick (struct t_irc_server *server, char *nick);
-extern struct t_irc_server *irc_server_search (char *server_name);
+ const char *new_name);
+extern int irc_server_rename (struct t_irc_server *server, const char *new_name);
+extern void irc_server_set_nick (struct t_irc_server *server, const char *nick);
+extern struct t_irc_server *irc_server_search (const char *server_name);
extern void irc_server_free_all ();
extern int irc_server_connect (struct t_irc_server *server,
int disable_autojoin);
extern void irc_server_auto_connect (int auto_connect, int temp_server);
extern void irc_server_autojoin_channels ();
extern int irc_server_timer_cb (void *data);
-extern void irc_server_sendf (struct t_irc_server *server, char *format, ...);
+extern void irc_server_sendf (struct t_irc_server *server, const char *format, ...);
extern void irc_server_outqueue_free_all (struct t_irc_server *server);
extern int irc_server_get_channel_count (struct t_irc_server *server);
extern int irc_server_get_pv_count (struct t_irc_server *server);
-extern void irc_server_set_away (struct t_irc_server *server, char *nick,
+extern void irc_server_set_away (struct t_irc_server *server, const char *nick,
int is_away);
extern void irc_server_remove_away ();
extern void irc_server_check_away ();
@@ -180,12 +180,12 @@ extern void irc_server_disconnect (struct t_irc_server *server, int reconnect);
extern void irc_server_disconnect_all ();
extern void irc_server_free (struct t_irc_server *server);
extern void irc_server_free_data (struct t_irc_server *server);
-extern int irc_server_xfer_send_ready_cb (void *data, char *signal,
- char *type_data, void *signal_data);
-extern int irc_server_xfer_resume_ready_cb (void *data, char *signal,
- char *type_data, void *signal_data);
-extern int irc_server_xfer_send_accept_resume_cb (void *data, char *signal,
- char *type_data,
+extern int irc_server_xfer_send_ready_cb (void *data, const char *signal,
+ const char *type_data, void *signal_data);
+extern int irc_server_xfer_resume_ready_cb (void *data, const char *signal,
+ const char *type_data, void *signal_data);
+extern int irc_server_xfer_send_accept_resume_cb (void *data, const char *signal,
+ const char *type_data,
void *signal_data);
extern void irc_server_print_log ();
diff --git a/src/plugins/irc/irc.c b/src/plugins/irc/irc.c
index f4947f8bf..9c4ac32c7 100644
--- a/src/plugins/irc/irc.c
+++ b/src/plugins/irc/irc.c
@@ -51,7 +51,7 @@ struct t_hook *irc_hook_timer_check_away = NULL;
*/
int
-irc_signal_quit_cb (void *data, char *signal, char *type_data,
+irc_signal_quit_cb (void *data, const char *signal, const char *type_data,
void *signal_data)
{
struct t_irc_server *ptr_server;
diff --git a/src/plugins/logger/logger-buffer.c b/src/plugins/logger/logger-buffer.c
index 7db26859c..338566f88 100644
--- a/src/plugins/logger/logger-buffer.c
+++ b/src/plugins/logger/logger-buffer.c
@@ -39,7 +39,7 @@ struct t_logger_buffer *last_logger_buffer = NULL;
*/
struct t_logger_buffer *
-logger_buffer_add (struct t_gui_buffer *buffer, char *log_filename)
+logger_buffer_add (struct t_gui_buffer *buffer, const char *log_filename)
{
struct t_logger_buffer *new_logger_buffer;
diff --git a/src/plugins/logger/logger-buffer.h b/src/plugins/logger/logger-buffer.h
index 571c2e520..da17c3f10 100644
--- a/src/plugins/logger/logger-buffer.h
+++ b/src/plugins/logger/logger-buffer.h
@@ -34,7 +34,7 @@ extern struct t_logger_buffer *logger_buffers;
extern struct t_logger_buffer *last_logger_buffer;
extern struct t_logger_buffer *logger_buffer_add (struct t_gui_buffer *,
- char *log_filename);
+ const char *log_filename);
extern struct t_logger_buffer *logger_buffer_search (struct t_gui_buffer *buffer);
extern void logger_buffer_free (struct t_logger_buffer *logger_buffer);
extern void logger_buffer_free_all ();
diff --git a/src/plugins/logger/logger-tail.c b/src/plugins/logger/logger-tail.c
index 52157a289..e129d2a75 100644
--- a/src/plugins/logger/logger-tail.c
+++ b/src/plugins/logger/logger-tail.c
@@ -42,12 +42,12 @@
*/
char *
-logger_tail_last_eol (char *string_start, char *string_ptr)
+logger_tail_last_eol (const char *string_start, const char *string_ptr)
{
while (string_ptr >= string_start)
{
if ((string_ptr[0] == '\n') || (string_ptr[0] == '\r'))
- return string_ptr;
+ return (char *)string_ptr;
string_ptr--;
}
@@ -60,7 +60,7 @@ logger_tail_last_eol (char *string_start, char *string_ptr)
*/
struct t_logger_line *
-logger_tail_file (char *filename, int n_lines)
+logger_tail_file (const char *filename, int n_lines)
{
int fd;
off_t file_length, file_pos;
diff --git a/src/plugins/logger/logger-tail.h b/src/plugins/logger/logger-tail.h
index 278e1eeba..0baeb8cf9 100644
--- a/src/plugins/logger/logger-tail.h
+++ b/src/plugins/logger/logger-tail.h
@@ -26,7 +26,8 @@ struct t_logger_line
struct t_logger_line *next_line; /* link to next line */
};
-extern struct t_logger_line *logger_tail_file (char *filename, int n_lines);
+extern struct t_logger_line *logger_tail_file (const char *filename,
+ int n_lines);
extern void logger_tail_free (struct t_logger_line *lines);
#endif /* logger-tail.h */
diff --git a/src/plugins/logger/logger.c b/src/plugins/logger/logger.c
index b73aad733..c19a63352 100644
--- a/src/plugins/logger/logger.c
+++ b/src/plugins/logger/logger.c
@@ -280,7 +280,8 @@ logger_get_filename (struct t_gui_buffer *buffer)
*/
void
-logger_write_line (struct t_logger_buffer *logger_buffer, char *format, ...)
+logger_write_line (struct t_logger_buffer *logger_buffer,
+ const char *format, ...)
{
va_list argptr;
char *buf, *charset, *message;
@@ -460,8 +461,8 @@ logger_stop_all ()
*/
int
-logger_buffer_open_signal_cb (void *data, char *signal, char *type_data,
- void *signal_data)
+logger_buffer_open_signal_cb (void *data, const char *signal,
+ const char *type_data, void *signal_data)
{
/* make C compiler happy */
(void) data;
@@ -478,8 +479,8 @@ logger_buffer_open_signal_cb (void *data, char *signal, char *type_data,
*/
int
-logger_buffer_closing_signal_cb (void *data, char *signal, char *type_data,
- void *signal_data)
+logger_buffer_closing_signal_cb (void *data, const char *signal,
+ const char *type_data, void *signal_data)
{
/* make C compiler happy */
(void) data;
@@ -496,7 +497,7 @@ logger_buffer_closing_signal_cb (void *data, char *signal, char *type_data,
*/
void
-logger_backlog (struct t_gui_buffer *buffer, char *filename, int lines)
+logger_backlog (struct t_gui_buffer *buffer, const char *filename, int lines)
{
struct t_logger_line *last_lines, *ptr_lines;
char *pos_message, *error;
@@ -547,8 +548,8 @@ logger_backlog (struct t_gui_buffer *buffer, char *filename, int lines)
*/
int
-logger_backlog_signal_cb (void *data, char *signal, char *type_data,
- void *signal_data)
+logger_backlog_signal_cb (void *data, const char *signal,
+ const char *type_data, void *signal_data)
{
struct t_logger_buffer *ptr_logger_buffer;
@@ -581,7 +582,7 @@ logger_backlog_signal_cb (void *data, char *signal, char *type_data,
*/
int
-logger_start_signal_cb (void *data, char *signal, char *type_data,
+logger_start_signal_cb (void *data, const char *signal, const char *type_data,
void *signal_data)
{
/* make C compiler happy */
@@ -599,7 +600,7 @@ logger_start_signal_cb (void *data, char *signal, char *type_data,
*/
int
-logger_stop_signal_cb (void *data, char *signal, char *type_data,
+logger_stop_signal_cb (void *data, const char *signal, const char *type_data,
void *signal_data)
{
struct t_logger_buffer *ptr_logger_buffer;
@@ -623,7 +624,7 @@ logger_stop_signal_cb (void *data, char *signal, char *type_data,
int
logger_print_cb (void *data, struct t_gui_buffer *buffer, time_t date,
int tags_count, char **tags,
- char *prefix, char *message)
+ const char *prefix, const char *message)
{
struct t_logger_buffer *ptr_logger_buffer;
struct tm *date_tmp;
@@ -661,7 +662,7 @@ logger_print_cb (void *data, struct t_gui_buffer *buffer, time_t date,
*/
int
-logger_config_cb (void *data, char *option, char *value)
+logger_config_cb (void *data, const char *option, const char *value)
{
/* make C compiler happy */
(void) data;
diff --git a/src/plugins/plugin-api.c b/src/plugins/plugin-api.c
index 5c16cf095..ca0c8d576 100644
--- a/src/plugins/plugin-api.c
+++ b/src/plugins/plugin-api.c
@@ -54,7 +54,7 @@
*/
void
-plugin_api_charset_set (struct t_weechat_plugin *plugin, char *charset)
+plugin_api_charset_set (struct t_weechat_plugin *plugin, const char *charset)
{
if (!plugin || !charset)
return;
@@ -70,7 +70,7 @@ plugin_api_charset_set (struct t_weechat_plugin *plugin, char *charset)
*/
char *
-plugin_api_gettext (char *string)
+plugin_api_gettext (const char *string)
{
return _(string);
}
@@ -80,7 +80,7 @@ plugin_api_gettext (char *string)
*/
char *
-plugin_api_ngettext (char *single, char *plural, int count)
+plugin_api_ngettext (const char *single, const char *plural, int count)
{
return NG_(single, plural, count);
}
@@ -91,7 +91,7 @@ plugin_api_ngettext (char *single, char *plural, int count)
*/
int
-plugin_api_mkdir_home (char *directory, int mode)
+plugin_api_mkdir_home (const char *directory, int mode)
{
char *dir_name;
int dir_length;
@@ -126,7 +126,7 @@ plugin_api_mkdir_home (char *directory, int mode)
*/
int
-plugin_api_mkdir (char *directory, int mode)
+plugin_api_mkdir (const char *directory, int mode)
{
if (!directory)
return 0;
@@ -145,7 +145,7 @@ plugin_api_mkdir (char *directory, int mode)
*/
struct t_config_option *
-plugin_api_config_get (char *option_name)
+plugin_api_config_get (const char *option_name)
{
struct t_config_option *ptr_option;
@@ -160,7 +160,7 @@ plugin_api_config_get (char *option_name)
char *
plugin_api_config_get_plugin (struct t_weechat_plugin *plugin,
- char *option_name)
+ const char *option_name)
{
struct t_config_option *ptr_option;
@@ -181,7 +181,7 @@ plugin_api_config_get_plugin (struct t_weechat_plugin *plugin,
int
plugin_api_config_set_plugin (struct t_weechat_plugin *plugin,
- char *option_name, char *value)
+ const char *option_name, const char *value)
{
if (!plugin || !option_name)
return 0;
@@ -197,7 +197,7 @@ plugin_api_config_set_plugin (struct t_weechat_plugin *plugin,
*/
char *
-plugin_api_prefix (char *prefix)
+plugin_api_prefix (const char *prefix)
{
if (!prefix)
return gui_chat_prefix_empty;
@@ -221,7 +221,7 @@ plugin_api_prefix (char *prefix)
*/
char *
-plugin_api_color (char *color_name)
+plugin_api_color (const char *color_name)
{
int num_color, fg, bg;
static char color[20][16];
@@ -328,7 +328,7 @@ plugin_api_color (char *color_name)
void
plugin_api_infobar_printf (struct t_weechat_plugin *plugin, int delay,
- char *color_name, char *format, ...)
+ const char *color_name, const char *format, ...)
{
va_list argptr;
static char buf[1024];
@@ -385,7 +385,7 @@ plugin_api_infobar_remove (int how_many)
void
plugin_api_command (struct t_weechat_plugin *plugin,
- struct t_gui_buffer *buffer, char *command)
+ struct t_gui_buffer *buffer, const char *command)
{
char *command2;
@@ -405,7 +405,7 @@ plugin_api_command (struct t_weechat_plugin *plugin,
*/
char *
-plugin_api_info_get (struct t_weechat_plugin *plugin, char *info)
+plugin_api_info_get (struct t_weechat_plugin *plugin, const char *info)
{
time_t inactivity;
static char value[32];
@@ -730,7 +730,7 @@ plugin_api_infolist_get_add_window (struct t_plugin_infolist *infolist,
int
plugin_api_infolist_get_add_options (struct t_plugin_infolist *infolist,
- char *option_name)
+ const char *option_name)
{
struct t_config_file *ptr_config;
struct t_config_section *ptr_section;
@@ -930,7 +930,7 @@ plugin_api_infolist_get_add_options (struct t_plugin_infolist *infolist,
*/
struct t_plugin_infolist *
-plugin_api_infolist_get (char *name, void *pointer, char *arguments)
+plugin_api_infolist_get (const char *name, void *pointer, const char *arguments)
{
struct t_plugin_infolist *ptr_infolist;
struct t_gui_buffer *ptr_buffer;
@@ -1140,7 +1140,7 @@ plugin_api_infolist_fields (struct t_plugin_infolist *infolist)
*/
int
-plugin_api_infolist_integer (struct t_plugin_infolist *infolist, char *var)
+plugin_api_infolist_integer (struct t_plugin_infolist *infolist, const char *var)
{
if (!infolist || !plugin_infolist_valid (infolist)
|| !((struct t_plugin_infolist *)infolist)->ptr_item)
@@ -1154,7 +1154,7 @@ plugin_api_infolist_integer (struct t_plugin_infolist *infolist, char *var)
*/
char *
-plugin_api_infolist_string (struct t_plugin_infolist *infolist, char *var)
+plugin_api_infolist_string (struct t_plugin_infolist *infolist, const char *var)
{
if (!infolist || !plugin_infolist_valid (infolist)
|| !((struct t_plugin_infolist *)infolist)->ptr_item)
@@ -1168,7 +1168,7 @@ plugin_api_infolist_string (struct t_plugin_infolist *infolist, char *var)
*/
void *
-plugin_api_infolist_pointer (struct t_plugin_infolist *infolist, char *var)
+plugin_api_infolist_pointer (struct t_plugin_infolist *infolist, const char *var)
{
if (!infolist || !plugin_infolist_valid (infolist)
|| !((struct t_plugin_infolist *)infolist)->ptr_item)
@@ -1182,7 +1182,7 @@ plugin_api_infolist_pointer (struct t_plugin_infolist *infolist, char *var)
*/
time_t
-plugin_api_infolist_time (struct t_plugin_infolist *infolist, char *var)
+plugin_api_infolist_time (struct t_plugin_infolist *infolist, const char *var)
{
if (!infolist || !plugin_infolist_valid (infolist)
|| !((struct t_plugin_infolist *)infolist)->ptr_item)
diff --git a/src/plugins/plugin-api.h b/src/plugins/plugin-api.h
index bc61ab425..4d93117e9 100644
--- a/src/plugins/plugin-api.h
+++ b/src/plugins/plugin-api.h
@@ -22,51 +22,52 @@
/* strings */
extern void plugin_api_charset_set (struct t_weechat_plugin *plugin,
- char *charset);
-extern char *plugin_api_gettext (char *string);
-extern char *plugin_api_ngettext (char *single, char *plural, int count);
+ const char *charset);
+extern char *plugin_api_gettext (const char *string);
+extern char *plugin_api_ngettext (const char *single, const char *plural,
+ int count);
/* directories */
-extern int plugin_api_mkdir_home (char *directory, int mode);
-extern int plugin_api_mkdir (char *directory, int mode);
+extern int plugin_api_mkdir_home (const char *directory, int mode);
+extern int plugin_api_mkdir (const char *directory, int mode);
/* config */
-extern struct t_config_option *plugin_api_config_get (char *option_name);
+extern struct t_config_option *plugin_api_config_get (const char *option_name);
extern char *plugin_api_config_get_plugin (struct t_weechat_plugin *plugin,
- char *option_name);
+ const char *option_name);
extern int plugin_api_config_set_plugin (struct t_weechat_plugin *plugin,
- char *option_name, char *value);
+ const char *option_name, const char *value);
/* display */
-extern char *plugin_api_prefix (char *prefix);
-extern char *plugin_api_color (char *color_name);
+extern char *plugin_api_prefix (const char *prefix);
+extern char *plugin_api_color (const char *color_name);
extern void plugin_api_infobar_printf (struct t_weechat_plugin *plugin,
- int delay, char *color_name,
- char *format, ...);
+ int delay, const char *color_name,
+ const char *format, ...);
extern void plugin_api_infobar_remove (int how_many);
/* command */
extern void plugin_api_command (struct t_weechat_plugin *plugin,
- struct t_gui_buffer *buffer, char *command);
+ struct t_gui_buffer *buffer, const char *command);
/* infos */
-extern char *plugin_api_info_get (struct t_weechat_plugin *plugin, char *info);
+extern char *plugin_api_info_get (struct t_weechat_plugin *plugin, const char *info);
/* infolists */
-extern struct t_plugin_infolist *plugin_api_infolist_get (char *name,
+extern struct t_plugin_infolist *plugin_api_infolist_get (const char *name,
void *pointer,
- char *arguments);
+ const char *arguments);
extern int plugin_api_infolist_next (struct t_plugin_infolist *infolist);
extern int plugin_api_infolist_prev (struct t_plugin_infolist *infolist);
extern char *plugin_api_infolist_fields (struct t_plugin_infolist *infolist);
extern int plugin_api_infolist_integer (struct t_plugin_infolist *infolist,
- char *var);
+ const char *var);
extern char *plugin_api_infolist_string (struct t_plugin_infolist *infolist,
- char *var);
+ const char *var);
extern void *plugin_api_infolist_pointer (struct t_plugin_infolist *infolist,
- char *var);
+ const char *var);
extern time_t plugin_api_infolist_time (struct t_plugin_infolist *infolist,
- char *var);
+ const char *var);
extern void plugin_api_infolist_free (struct t_plugin_infolist *infolist);
#endif /* plugin-api.h */
diff --git a/src/plugins/plugin-config.c b/src/plugins/plugin-config.c
index c7a767929..064593ad0 100644
--- a/src/plugins/plugin-config.c
+++ b/src/plugins/plugin-config.c
@@ -48,7 +48,7 @@ struct t_config_section *plugin_config_section_var = NULL;
*/
struct t_config_option *
-plugin_config_search (char *plugin_name, char *option_name)
+plugin_config_search (const char *plugin_name, const char *option_name)
{
int length;
char *option_full_name;
@@ -77,7 +77,7 @@ plugin_config_search (char *plugin_name, char *option_name)
*/
int
-plugin_config_set_internal (char *option, char *value)
+plugin_config_set_internal (const char *option, const char *value)
{
int rc;
struct t_config_option *ptr_option;
@@ -108,7 +108,8 @@ plugin_config_set_internal (char *option, char *value)
*/
int
-plugin_config_set (char *plugin_name, char *option_name, char *value)
+plugin_config_set (const char *plugin_name, const char *option_name,
+ const char *value)
{
int length, rc;
char *option_full_name;
@@ -153,7 +154,7 @@ plugin_config_reload (void *data, struct t_config_file *config_file)
int
plugin_config_create_option (void *data, struct t_config_file *config_file,
struct t_config_section *section,
- char *option_name, char *value)
+ const char *option_name, const char *value)
{
struct t_config_option *ptr_option;
diff --git a/src/plugins/plugin-config.h b/src/plugins/plugin-config.h
index dac48cd95..8226db0d1 100644
--- a/src/plugins/plugin-config.h
+++ b/src/plugins/plugin-config.h
@@ -25,12 +25,12 @@
extern struct t_config_file *plugin_config;
extern struct t_config_option *plugin_options;
-extern struct t_config_option *plugin_config_search_internal (char *option_name);
-extern struct t_config_option *plugin_config_search (char *plugin_name,
- char *option_name);
-extern int plugin_config_set_internal (char *option, char *value);
-extern int plugin_config_set (char *plugin_name, char *option_name,
- char *value);
+extern struct t_config_option *plugin_config_search_internal (const char *option_name);
+extern struct t_config_option *plugin_config_search (const char *plugin_name,
+ const char *option_name);
+extern int plugin_config_set_internal (const char *option, const char *value);
+extern int plugin_config_set (const char *plugin_name, const char *option_name,
+ const char *value);
extern void plugin_config_init ();
extern int plugin_config_read ();
extern int plugin_config_reload ();
diff --git a/src/plugins/plugin-infolist.c b/src/plugins/plugin-infolist.c
index 2b780f707..dd5495e1c 100644
--- a/src/plugins/plugin-infolist.c
+++ b/src/plugins/plugin-infolist.c
@@ -98,7 +98,7 @@ plugin_infolist_new_item (struct t_plugin_infolist *list)
struct t_plugin_infolist_var *
plugin_infolist_new_var_integer (struct t_plugin_infolist_item *item,
- char *name, int value)
+ const char *name, int value)
{
struct t_plugin_infolist_var *new_var;
@@ -132,7 +132,7 @@ plugin_infolist_new_var_integer (struct t_plugin_infolist_item *item,
struct t_plugin_infolist_var *
plugin_infolist_new_var_string (struct t_plugin_infolist_item *item,
- char *name, char *value)
+ const char *name, const char *value)
{
struct t_plugin_infolist_var *new_var;
@@ -164,7 +164,7 @@ plugin_infolist_new_var_string (struct t_plugin_infolist_item *item,
struct t_plugin_infolist_var *
plugin_infolist_new_var_pointer (struct t_plugin_infolist_item *item,
- char *name, void *pointer)
+ const char *name, void *pointer)
{
struct t_plugin_infolist_var *new_var;
@@ -196,7 +196,7 @@ plugin_infolist_new_var_pointer (struct t_plugin_infolist_item *item,
struct t_plugin_infolist_var *
plugin_infolist_new_var_time (struct t_plugin_infolist_item *item,
- char *name, time_t time)
+ const char *name, time_t time)
{
struct t_plugin_infolist_var *new_var;
@@ -340,7 +340,7 @@ plugin_infolist_get_fields (struct t_plugin_infolist *list)
*/
int
-plugin_infolist_get_integer (struct t_plugin_infolist *list, char *var)
+plugin_infolist_get_integer (struct t_plugin_infolist *list, const char *var)
{
struct t_plugin_infolist_var *ptr_var;
@@ -367,7 +367,7 @@ plugin_infolist_get_integer (struct t_plugin_infolist *list, char *var)
*/
char *
-plugin_infolist_get_string (struct t_plugin_infolist *list, char *var)
+plugin_infolist_get_string (struct t_plugin_infolist *list, const char *var)
{
struct t_plugin_infolist_var *ptr_var;
@@ -394,7 +394,7 @@ plugin_infolist_get_string (struct t_plugin_infolist *list, char *var)
*/
void *
-plugin_infolist_get_pointer (struct t_plugin_infolist *list, char *var)
+plugin_infolist_get_pointer (struct t_plugin_infolist *list, const char *var)
{
struct t_plugin_infolist_var *ptr_var;
@@ -421,7 +421,7 @@ plugin_infolist_get_pointer (struct t_plugin_infolist *list, char *var)
*/
time_t
-plugin_infolist_get_time (struct t_plugin_infolist *list, char *var)
+plugin_infolist_get_time (struct t_plugin_infolist *list, const char *var)
{
struct t_plugin_infolist_var *ptr_var;
diff --git a/src/plugins/plugin-infolist.h b/src/plugins/plugin-infolist.h
index 980415732..74cd3d301 100644
--- a/src/plugins/plugin-infolist.h
+++ b/src/plugins/plugin-infolist.h
@@ -68,29 +68,29 @@ extern struct t_plugin_infolist *last_plugin_infolist;
extern struct t_plugin_infolist *plugin_infolist_new ();
extern struct t_plugin_infolist_item *plugin_infolist_new_item (struct t_plugin_infolist *list);
extern struct t_plugin_infolist_var *plugin_infolist_new_var_integer (struct t_plugin_infolist_item *item,
- char *name,
+ const char *name,
int value);
extern struct t_plugin_infolist_var *plugin_infolist_new_var_string (struct t_plugin_infolist_item *item,
- char *name,
- char *value);
+ const char *name,
+ const char *value);
extern struct t_plugin_infolist_var *plugin_infolist_new_var_pointer (struct t_plugin_infolist_item *item,
- char *name,
+ const char *name,
void *pointer);
extern struct t_plugin_infolist_var *plugin_infolist_new_var_time (struct t_plugin_infolist_item *item,
- char *name,
+ const char *name,
time_t time);
extern int plugin_infolist_valid (struct t_plugin_infolist *list);
extern struct t_plugin_infolist_item *plugin_infolist_next_item (struct t_plugin_infolist *list);
extern struct t_plugin_infolist_item *plugin_infolist_prev_item (struct t_plugin_infolist *list);
extern char *plugin_infolist_get_fields (struct t_plugin_infolist *list);
extern int plugin_infolist_get_integer (struct t_plugin_infolist *list,
- char *var);
+ const char *var);
extern char *plugin_infolist_get_string (struct t_plugin_infolist *list,
- char *var);
+ const char *var);
extern void *plugin_infolist_get_pointer (struct t_plugin_infolist *list,
- char *var);
+ const char *var);
extern time_t plugin_infolist_get_time (struct t_plugin_infolist *list,
- char *var);
+ const char *var);
extern void plugin_infolist_free (struct t_plugin_infolist *list);
extern void plugin_infolist_print_log ();
diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c
index b3bdf8055..9626a3624 100644
--- a/src/plugins/plugin.c
+++ b/src/plugins/plugin.c
@@ -65,7 +65,7 @@ char **plugin_argv; /* first time loading plugin) */
*/
struct t_weechat_plugin *
-plugin_search (char *name)
+plugin_search (const char *name)
{
struct t_weechat_plugin *ptr_plugin;
@@ -86,7 +86,7 @@ plugin_search (char *name)
*/
struct t_weechat_plugin *
-plugin_load (char *filename)
+plugin_load (const char *filename)
{
char *ptr_home, *full_name, *full_name2;
void *handle;
@@ -517,7 +517,7 @@ plugin_load (char *filename)
*/
int
-plugin_auto_load_file (void *plugin, char *filename)
+plugin_auto_load_file (void *plugin, const char *filename)
{
char *pos;
@@ -716,7 +716,7 @@ plugin_unload (struct t_weechat_plugin *plugin)
*/
void
-plugin_unload_name (char *name)
+plugin_unload_name (const char *name)
{
struct t_weechat_plugin *ptr_plugin;
@@ -750,7 +750,7 @@ plugin_unload_all ()
*/
void
-plugin_reload_name (char *name)
+plugin_reload_name (const char *name)
{
struct t_weechat_plugin *ptr_plugin;
char *filename;
diff --git a/src/plugins/plugin.h b/src/plugins/plugin.h
index 1d05abe98..7c7cead09 100644
--- a/src/plugins/plugin.h
+++ b/src/plugins/plugin.h
@@ -31,14 +31,14 @@ extern struct t_weechat_plugin *last_weechat_plugin;
//extern t_plugin_irc_color plugins_irc_colors[GUI_NUM_IRC_COLORS];
-extern struct t_weechat_plugin *plugin_search (char *name);
-extern struct t_weechat_plugin *plugin_load (char *filename);
+extern struct t_weechat_plugin *plugin_search (const char *name);
+extern struct t_weechat_plugin *plugin_load (const char *filename);
extern void plugin_auto_load ();
extern void plugin_remove (struct t_weechat_plugin *plugin);
extern void plugin_unload (struct t_weechat_plugin *plugin);
-extern void plugin_unload_name (char *name);
+extern void plugin_unload_name (const char *name);
extern void plugin_unload_all ();
-extern void plugin_reload_name (char *name);
+extern void plugin_reload_name (const char *name);
extern void plugin_init (int auto_load, int argc, char *argv[]);
extern void plugin_end ();
extern void plugin_print_log ();
diff --git a/src/plugins/scripts/lua/weechat-lua-api.c b/src/plugins/scripts/lua/weechat-lua-api.c
index 3dcec99de..add53f967 100644
--- a/src/plugins/scripts/lua/weechat-lua-api.c
+++ b/src/plugins/scripts/lua/weechat-lua-api.c
@@ -94,7 +94,7 @@ weechat_lua_api_register (lua_State *L)
shutdown_func = lua_tostring (lua_current_interpreter, -2);
charset = lua_tostring (lua_current_interpreter, -1);
- if (script_search (weechat_lua_plugin, lua_scripts, (char *)name))
+ if (script_search (weechat_lua_plugin, lua_scripts, name))
{
weechat_printf (NULL,
weechat_gettext ("%s%s: unable to register script "
@@ -109,13 +109,13 @@ weechat_lua_api_register (lua_State *L)
&lua_scripts,
(lua_current_script_filename) ?
lua_current_script_filename : "",
- (char *)name,
- (char *)author,
- (char *)version,
- (char *)license,
- (char *)description,
- (char *)shutdown_func,
- (char *)charset);
+ name,
+ author,
+ version,
+ license,
+ description,
+ shutdown_func,
+ charset);
if (lua_current_script)
{
weechat_printf (NULL,
@@ -163,7 +163,7 @@ weechat_lua_api_charset_set (lua_State *L)
charset = lua_tostring (lua_current_interpreter, -1);
script_api_charset_set (lua_current_script,
- (char *) charset);
+ charset);
LUA_RETURN_OK;
}
@@ -202,7 +202,7 @@ weechat_lua_api_iconv_to_internal (lua_State *L)
charset = lua_tostring (lua_current_interpreter, -2);
string = lua_tostring (lua_current_interpreter, -1);
- result = weechat_iconv_to_internal ((char *)charset, (char *)string);
+ result = weechat_iconv_to_internal (charset, string);
LUA_RETURN_STRING_FREE(result);
}
@@ -242,7 +242,7 @@ weechat_lua_api_iconv_from_internal (lua_State *L)
charset = lua_tostring (lua_current_interpreter, -2);
string = lua_tostring (lua_current_interpreter, -1);
- result = weechat_iconv_from_internal ((char *)charset, (char *)string);
+ result = weechat_iconv_from_internal (charset, string);
LUA_RETURN_STRING_FREE(result);
}
@@ -279,7 +279,7 @@ weechat_lua_api_gettext (lua_State *L)
string = lua_tostring (lua_current_interpreter, -1);
- result = weechat_gettext ((char *)string);
+ result = weechat_gettext (string);
LUA_RETURN_STRING(result);
}
@@ -320,7 +320,7 @@ weechat_lua_api_ngettext (lua_State *L)
plural = lua_tostring (lua_current_interpreter, -2);
count = lua_tonumber (lua_current_interpreter, -1);
- result = weechat_ngettext ((char *)single, (char *)plural, count);
+ result = weechat_ngettext (single, plural, count);
LUA_RETURN_STRING(result);
}
@@ -358,7 +358,7 @@ weechat_lua_api_mkdir_home (lua_State *L)
directory = lua_tostring (lua_current_interpreter, -2);
mode = lua_tonumber (lua_current_interpreter, -1);
- if (weechat_mkdir_home ((char *)directory, mode))
+ if (weechat_mkdir_home (directory, mode))
LUA_RETURN_OK;
LUA_RETURN_OK;
@@ -397,7 +397,7 @@ weechat_lua_api_mkdir (lua_State *L)
directory = lua_tostring (lua_current_interpreter, -2);
mode = lua_tonumber (lua_current_interpreter, -1);
- if (weechat_mkdir ((char *)directory, mode))
+ if (weechat_mkdir (directory, mode))
LUA_RETURN_OK;
LUA_RETURN_OK;
@@ -462,9 +462,9 @@ weechat_lua_api_list_add (lua_State *L)
data = lua_tostring (lua_current_interpreter, -2);
where = lua_tostring (lua_current_interpreter, -1);
- result = script_ptr2str (weechat_list_add (script_str2ptr ((char *)weelist),
- (char *)data,
- (char *)where));
+ result = script_ptr2str (weechat_list_add (script_str2ptr (weelist),
+ data,
+ where));
LUA_RETURN_STRING_FREE(result);
}
@@ -503,8 +503,8 @@ weechat_lua_api_list_search (lua_State *L)
weelist = lua_tostring (lua_current_interpreter, -2);
data = lua_tostring (lua_current_interpreter, -1);
- result = script_ptr2str (weechat_list_search (script_str2ptr ((char *)weelist),
- (char *)data));
+ result = script_ptr2str (weechat_list_search (script_str2ptr (weelist),
+ data));
LUA_RETURN_STRING_FREE(result);
}
@@ -543,8 +543,8 @@ weechat_lua_api_list_casesearch (lua_State *L)
weelist = lua_tostring (lua_current_interpreter, -2);
data = lua_tostring (lua_current_interpreter, -1);
- result = script_ptr2str (weechat_list_casesearch (script_str2ptr ((char *)weelist),
- (char *)data));
+ result = script_ptr2str (weechat_list_casesearch (script_str2ptr (weelist),
+ data));
LUA_RETURN_STRING_FREE(result);
}
@@ -583,7 +583,7 @@ weechat_lua_api_list_get (lua_State *L)
weelist = lua_tostring (lua_current_interpreter, -2);
position = lua_tonumber (lua_current_interpreter, -1);
- result = script_ptr2str (weechat_list_get (script_str2ptr ((char *)weelist),
+ result = script_ptr2str (weechat_list_get (script_str2ptr (weelist),
position));
LUA_RETURN_STRING_FREE(result);
@@ -622,8 +622,8 @@ weechat_lua_api_list_set (lua_State *L)
item = lua_tostring (lua_current_interpreter, -2);
new_value = lua_tostring (lua_current_interpreter, -1);
- weechat_list_set (script_str2ptr ((char *)item),
- (char *)new_value);
+ weechat_list_set (script_str2ptr (item),
+ new_value);
LUA_RETURN_OK;
}
@@ -660,7 +660,7 @@ weechat_lua_api_list_next (lua_State *L)
item = lua_tostring (lua_current_interpreter, -1);
- result = script_ptr2str (weechat_list_next (script_str2ptr ((char *)item)));
+ result = script_ptr2str (weechat_list_next (script_str2ptr (item)));
LUA_RETURN_STRING_FREE(result);
}
@@ -697,7 +697,7 @@ weechat_lua_api_list_prev (lua_State *L)
item = lua_tostring (lua_current_interpreter, -1);
- result = script_ptr2str (weechat_list_prev (script_str2ptr ((char *)item)));
+ result = script_ptr2str (weechat_list_prev (script_str2ptr (item)));
LUA_RETURN_STRING_FREE(result);
}
@@ -734,7 +734,7 @@ weechat_lua_api_list_string (lua_State *L)
item = lua_tostring (lua_current_interpreter, -1);
- result = weechat_list_string (script_str2ptr ((char *)item));
+ result = weechat_list_string (script_str2ptr (item));
LUA_RETURN_STRING(result);
}
@@ -770,7 +770,7 @@ weechat_lua_api_list_size (lua_State *L)
weelist = lua_tostring (lua_current_interpreter, -1);
- size = weechat_list_size (script_str2ptr ((char *)weelist));
+ size = weechat_list_size (script_str2ptr (weelist));
LUA_RETURN_INT(size);
}
@@ -808,8 +808,8 @@ weechat_lua_api_list_remove (lua_State *L)
weelist = lua_tostring (lua_current_interpreter, -2);
item = lua_tostring (lua_current_interpreter, -1);
- weechat_list_remove (script_str2ptr ((char *)weelist),
- script_str2ptr ((char *)item));
+ weechat_list_remove (script_str2ptr (weelist),
+ script_str2ptr (item));
LUA_RETURN_OK;
}
@@ -845,7 +845,7 @@ weechat_lua_api_list_remove_all (lua_State *L)
weelist = lua_tostring (lua_current_interpreter, -1);
- weechat_list_remove_all (script_str2ptr ((char *)weelist));
+ weechat_list_remove_all (script_str2ptr (weelist));
LUA_RETURN_OK;
}
@@ -881,7 +881,7 @@ weechat_lua_api_list_free (lua_State *L)
weelist = lua_tostring (lua_current_interpreter, -1);
- weechat_list_free (script_str2ptr ((char *)weelist));
+ weechat_list_free (script_str2ptr (weelist));
LUA_RETURN_OK;
}
@@ -962,9 +962,9 @@ weechat_lua_api_config_new (lua_State *L)
result = script_ptr2str (script_api_config_new (weechat_lua_plugin,
lua_current_script,
- (char *)name,
+ name,
&weechat_lua_api_config_reload_cb,
- (char *)function));
+ function));
LUA_RETURN_STRING_FREE(result);
}
@@ -976,7 +976,7 @@ weechat_lua_api_config_new (lua_State *L)
void
weechat_lua_api_config_read_cb (void *data,
struct t_config_file *config_file,
- char *option_name, char *value)
+ const char *option_name, const char *value)
{
struct t_script_callback *script_callback;
char *lua_argv[4];
@@ -987,8 +987,8 @@ weechat_lua_api_config_read_cb (void *data,
if (script_callback->function && script_callback->function[0])
{
lua_argv[0] = script_ptr2str (config_file);
- lua_argv[1] = option_name;
- lua_argv[2] = value;
+ lua_argv[1] = (char *)option_name;
+ lua_argv[2] = (char *)value;
lua_argv[3] = NULL;
rc = (int *) weechat_lua_exec (script_callback->script,
@@ -1010,7 +1010,7 @@ weechat_lua_api_config_read_cb (void *data,
void
weechat_lua_api_config_section_write_cb (void *data,
struct t_config_file *config_file,
- char *section_name)
+ const char *section_name)
{
struct t_script_callback *script_callback;
char *lua_argv[3];
@@ -1021,7 +1021,7 @@ weechat_lua_api_config_section_write_cb (void *data,
if (script_callback->function && script_callback->function[0])
{
lua_argv[0] = script_ptr2str (config_file);
- lua_argv[1] = section_name;
+ lua_argv[1] = (char *)section_name;
lua_argv[2] = NULL;
rc = (int *) weechat_lua_exec (script_callback->script,
@@ -1044,7 +1044,7 @@ weechat_lua_api_config_section_write_cb (void *data,
void
weechat_lua_api_config_section_write_default_cb (void *data,
struct t_config_file *config_file,
- char *section_name)
+ const char *section_name)
{
struct t_script_callback *script_callback;
char *lua_argv[3];
@@ -1055,7 +1055,7 @@ weechat_lua_api_config_section_write_default_cb (void *data,
if (script_callback->function && script_callback->function[0])
{
lua_argv[0] = script_ptr2str (config_file);
- lua_argv[1] = section_name;
+ lua_argv[1] = (char *)section_name;
lua_argv[2] = NULL;
rc = (int *) weechat_lua_exec (script_callback->script,
@@ -1078,8 +1078,8 @@ int
weechat_lua_api_config_section_create_option_cb (void *data,
struct t_config_file *config_file,
struct t_config_section *section,
- char *option_name,
- char *value)
+ const char *option_name,
+ const char *value)
{
struct t_script_callback *script_callback;
char *lua_argv[5];
@@ -1091,8 +1091,8 @@ weechat_lua_api_config_section_create_option_cb (void *data,
{
lua_argv[0] = script_ptr2str (config_file);
lua_argv[1] = script_ptr2str (section);
- lua_argv[2] = option_name;
- lua_argv[3] = value;
+ lua_argv[2] = (char *)option_name;
+ lua_argv[3] = (char *)value;
lua_argv[4] = NULL;
rc = (int *) weechat_lua_exec (script_callback->script,
@@ -1167,18 +1167,18 @@ weechat_lua_api_config_new_section (lua_State *L)
result = script_ptr2str (script_api_config_new_section (weechat_lua_plugin,
lua_current_script,
- script_str2ptr ((char *)config_file),
- (char *)name,
+ script_str2ptr (config_file),
+ name,
user_can_add_options,
user_can_delete_options,
&weechat_lua_api_config_read_cb,
- (char *)function_read,
+ function_read,
&weechat_lua_api_config_section_write_cb,
- (char *)function_write,
+ function_write,
&weechat_lua_api_config_section_write_default_cb,
- (char *)function_write_default,
+ function_write_default,
&weechat_lua_api_config_section_create_option_cb,
- (char *)function_create_option));
+ function_create_option));
LUA_RETURN_STRING_FREE(result);
}
@@ -1217,8 +1217,8 @@ weechat_lua_api_config_search_section (lua_State *L)
config_file = lua_tostring (lua_current_interpreter, -2);
section_name = lua_tostring (lua_current_interpreter, -1);
- result = script_ptr2str (weechat_config_search_section (script_str2ptr ((char *)config_file),
- (char *)section_name));
+ result = script_ptr2str (weechat_config_search_section (script_str2ptr (config_file),
+ section_name));
LUA_RETURN_STRING_FREE(result);
}
@@ -1303,17 +1303,17 @@ weechat_lua_api_config_new_option (lua_State *L)
result = script_ptr2str (script_api_config_new_option (weechat_lua_plugin,
lua_current_script,
- script_str2ptr ((char *)config_file),
- script_str2ptr ((char *)section),
- (char *)name,
- (char *)type,
- (char *)description,
- (char *)string_values,
+ script_str2ptr (config_file),
+ script_str2ptr (section),
+ name,
+ type,
+ description,
+ string_values,
min,
max,
- (char *)default_value,
+ default_value,
&weechat_lua_api_config_option_change_cb,
- (char *)function));
+ function));
LUA_RETURN_STRING_FREE(result);
}
@@ -1354,9 +1354,9 @@ weechat_lua_api_config_search_option (lua_State *L)
section = lua_tostring (lua_current_interpreter, -2);
option_name = lua_tostring (lua_current_interpreter, -1);
- result = script_ptr2str (weechat_config_search_option (script_str2ptr ((char *)config_file),
- script_str2ptr ((char *)section),
- (char *)option_name));
+ result = script_ptr2str (weechat_config_search_option (script_str2ptr (config_file),
+ script_str2ptr (section),
+ option_name));
LUA_RETURN_STRING_FREE(result);
}
@@ -1392,7 +1392,7 @@ weechat_lua_api_config_string_to_boolean (lua_State *L)
text = lua_tostring (lua_current_interpreter, -1);
- value = weechat_config_string_to_boolean ((char *)text);
+ value = weechat_config_string_to_boolean (text);
LUA_RETURN_INT(value);
}
@@ -1430,7 +1430,7 @@ weechat_lua_api_config_option_reset (lua_State *L)
option = lua_tostring (lua_current_interpreter, -2);
run_callback = lua_tonumber (lua_current_interpreter, -1);
- rc = weechat_config_option_reset (script_str2ptr ((char *)option),
+ rc = weechat_config_option_reset (script_str2ptr (option),
run_callback);
LUA_RETURN_INT(rc);
@@ -1471,8 +1471,8 @@ weechat_lua_api_config_option_set (lua_State *L)
new_value = lua_tostring (lua_current_interpreter, -2);
run_callback = lua_tonumber (lua_current_interpreter, -1);
- rc = weechat_config_option_set (script_str2ptr ((char *)option),
- (char *)new_value,
+ rc = weechat_config_option_set (script_str2ptr (option),
+ new_value,
run_callback);
LUA_RETURN_INT(rc);
@@ -1511,8 +1511,8 @@ weechat_lua_api_config_option_rename (lua_State *L)
option = lua_tostring (lua_current_interpreter, -2);
new_name = lua_tostring (lua_current_interpreter, -1);
- weechat_config_option_rename (script_str2ptr ((char *)option),
- (char *)new_name);
+ weechat_config_option_rename (script_str2ptr (option),
+ new_name);
LUA_RETURN_OK;
}
@@ -1548,7 +1548,7 @@ weechat_lua_api_config_boolean (lua_State *L)
option = lua_tostring (lua_current_interpreter, -1);
- value = weechat_config_boolean (script_str2ptr ((char *)option));
+ value = weechat_config_boolean (script_str2ptr (option));
LUA_RETURN_INT(value);
}
@@ -1584,7 +1584,7 @@ weechat_lua_api_config_integer (lua_State *L)
option = lua_tostring (lua_current_interpreter, -1);
- value = weechat_config_integer (script_str2ptr ((char *)option));
+ value = weechat_config_integer (script_str2ptr (option));
LUA_RETURN_INT(value);
}
@@ -1621,7 +1621,7 @@ weechat_lua_api_config_string (lua_State *L)
option = lua_tostring (lua_current_interpreter, -1);
- value = weechat_config_string (script_str2ptr ((char *)option));
+ value = weechat_config_string (script_str2ptr (option));
LUA_RETURN_STRING(value);
}
@@ -1657,7 +1657,7 @@ weechat_lua_api_config_color (lua_State *L)
option = lua_tostring (lua_current_interpreter, -1);
- value = weechat_config_color (script_str2ptr ((char *)option));
+ value = weechat_config_color (script_str2ptr (option));
LUA_RETURN_INT(value);
}
@@ -1697,10 +1697,10 @@ weechat_lua_api_config_write_line (lua_State *L)
option_name = lua_tostring (lua_current_interpreter, -2);
value = lua_tostring (lua_current_interpreter, -1);
- weechat_config_write_line (script_str2ptr ((char *)config_file),
- (char *)option_name,
+ weechat_config_write_line (script_str2ptr (config_file),
+ option_name,
"%s",
- (char *)value);
+ value);
LUA_RETURN_OK;
}
@@ -1736,7 +1736,7 @@ weechat_lua_api_config_write (lua_State *L)
config_file = lua_tostring (lua_current_interpreter, -1);
- rc = weechat_config_write (script_str2ptr ((char *)config_file));
+ rc = weechat_config_write (script_str2ptr (config_file));
LUA_RETURN_INT(rc);
}
@@ -1772,7 +1772,7 @@ weechat_lua_api_config_read (lua_State *L)
config_file = lua_tostring (lua_current_interpreter, -1);
- rc = weechat_config_read (script_str2ptr ((char *)config_file));
+ rc = weechat_config_read (script_str2ptr (config_file));
LUA_RETURN_INT(rc);
}
@@ -1808,7 +1808,7 @@ weechat_lua_api_config_reload (lua_State *L)
config_file = lua_tostring (lua_current_interpreter, -1);
- rc = weechat_config_reload (script_str2ptr ((char *)config_file));
+ rc = weechat_config_reload (script_str2ptr (config_file));
LUA_RETURN_INT(rc);
}
@@ -1846,7 +1846,7 @@ weechat_lua_api_config_free (lua_State *L)
script_api_config_free (weechat_lua_plugin,
lua_current_script,
- script_str2ptr ((char *)config_file));
+ script_str2ptr (config_file));
LUA_RETURN_OK;
}
@@ -1883,7 +1883,7 @@ weechat_lua_api_config_get (lua_State *L)
option = lua_tostring (lua_current_interpreter, -1);
- result = script_ptr2str (weechat_config_get ((char *)option));
+ result = script_ptr2str (weechat_config_get (option));
LUA_RETURN_STRING_FREE(result);
}
@@ -1922,7 +1922,7 @@ weechat_lua_api_config_get_plugin (lua_State *L)
value = script_api_config_get_plugin (weechat_lua_plugin,
lua_current_script,
- (char *)option);
+ option);
LUA_RETURN_STRING(value);
}
@@ -1962,8 +1962,8 @@ weechat_lua_api_config_set_plugin (lua_State *L)
if (script_api_config_set_plugin (weechat_lua_plugin,
lua_current_script,
- (char *)option,
- (char *)value))
+ option,
+ value))
LUA_RETURN_OK;
LUA_RETURN_ERROR;
@@ -2001,7 +2001,7 @@ weechat_lua_api_prefix (lua_State *L)
prefix = lua_tostring (lua_current_interpreter, -1);
- result = weechat_prefix ((char *)prefix);
+ result = weechat_prefix (prefix);
LUA_RETURN_STRING(result);
}
@@ -2038,7 +2038,7 @@ weechat_lua_api_color (lua_State *L)
color = lua_tostring (lua_current_interpreter, -1);
- result = weechat_prefix ((char *)color);
+ result = weechat_prefix (color);
LUA_RETURN_STRING(result);
}
@@ -2078,8 +2078,8 @@ weechat_lua_api_print (lua_State *L)
script_api_printf (weechat_lua_plugin,
lua_current_script,
- script_str2ptr ((char *)buffer),
- "%s", (char *)message);
+ script_str2ptr (buffer),
+ "%s", message);
LUA_RETURN_OK;
}
@@ -2124,10 +2124,10 @@ weechat_lua_api_print_date_tags (lua_State *L)
script_api_printf_date_tags (weechat_lua_plugin,
lua_current_script,
- script_str2ptr ((char *)buffer),
+ script_str2ptr (buffer),
date,
- (char *)tags,
- "%s", (char *)message);
+ tags,
+ "%s", message);
LUA_RETURN_OK;
}
@@ -2169,9 +2169,9 @@ weechat_lua_api_print_y (lua_State *L)
script_api_printf_y (weechat_lua_plugin,
lua_current_script,
- script_str2ptr ((char *)buffer),
+ script_str2ptr (buffer),
y,
- "%s", (char *)message);
+ "%s", message);
LUA_RETURN_OK;
}
@@ -2214,9 +2214,9 @@ weechat_lua_api_infobar_print (lua_State *L)
script_api_infobar_printf (weechat_lua_plugin,
lua_current_script,
delay,
- (char *)color,
+ color,
"%s",
- (char *)message);
+ message);
LUA_RETURN_OK;
}
@@ -2284,7 +2284,7 @@ weechat_lua_api_log_print (lua_State *L)
script_api_log_printf (weechat_lua_plugin,
lua_current_script,
- "%s", (char *) message);
+ "%s", message);
LUA_RETURN_OK;
}
@@ -2373,13 +2373,13 @@ weechat_lua_api_hook_command (lua_State *L)
result = script_ptr2str (script_api_hook_command (weechat_lua_plugin,
lua_current_script,
- (char *)command,
- (char *)description,
- (char *)args,
- (char *)args_description,
- (char *)completion,
+ command,
+ description,
+ args,
+ args_description,
+ completion,
&weechat_lua_api_hook_command_cb,
- (char *)function));
+ function));
LUA_RETURN_STRING_FREE(result);
}
@@ -2459,7 +2459,7 @@ weechat_lua_api_hook_timer (lua_State *L)
align_second,
max_calls,
&weechat_lua_api_hook_timer_cb,
- (char *)function));
+ function));
LUA_RETURN_STRING_FREE(result);
}
@@ -2542,7 +2542,7 @@ weechat_lua_api_hook_fd (lua_State *L)
write,
exception,
&weechat_lua_api_hook_fd_cb,
- (char *)function));
+ function));
LUA_RETURN_STRING_FREE(result);
}
@@ -2554,7 +2554,7 @@ weechat_lua_api_hook_fd (lua_State *L)
int
weechat_lua_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
time_t date, int tags_count, char **tags,
- char *prefix, char *message)
+ const char *prefix, const char *message)
{
struct t_script_callback *script_callback;
char *lua_argv[6];
@@ -2571,8 +2571,8 @@ weechat_lua_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
lua_argv[0] = script_ptr2str (buffer);
lua_argv[1] = timebuffer;
lua_argv[2] = weechat_string_build_with_exploded (tags, ",");
- lua_argv[3] = prefix;
- lua_argv[4] = message;
+ lua_argv[3] = (char *)prefix;
+ lua_argv[4] = (char *)message;
lua_argv[5] = NULL;
rc = (int *) weechat_lua_exec (script_callback->script,
@@ -2637,12 +2637,12 @@ weechat_lua_api_hook_print (lua_State *L)
result = script_ptr2str (script_api_hook_print (weechat_lua_plugin,
lua_current_script,
- script_str2ptr ((char *)buffer),
- (char *)tags,
- (char *)message,
+ script_str2ptr (buffer),
+ tags,
+ message,
strip_colors,
&weechat_lua_api_hook_print_cb,
- (char *)function));
+ function));
LUA_RETURN_STRING_FREE(result);
}
@@ -2652,8 +2652,8 @@ weechat_lua_api_hook_print (lua_State *L)
*/
int
-weechat_lua_api_hook_signal_cb (void *data, char *signal, char *type_data,
- void *signal_data)
+weechat_lua_api_hook_signal_cb (void *data, const char *signal,
+ const char *type_data, void *signal_data)
{
struct t_script_callback *script_callback;
char *lua_argv[3];
@@ -2662,7 +2662,7 @@ weechat_lua_api_hook_signal_cb (void *data, char *signal, char *type_data,
script_callback = (struct t_script_callback *)data;
- lua_argv[0] = signal;
+ lua_argv[0] = (char *)signal;
free_needed = 0;
if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_STRING) == 0)
{
@@ -2735,9 +2735,9 @@ weechat_lua_api_hook_signal (lua_State *L)
result = script_ptr2str (script_api_hook_signal (weechat_lua_plugin,
lua_current_script,
- (char *)signal,
+ signal,
&weechat_lua_api_hook_signal_cb,
- (char *)function));
+ function));
LUA_RETURN_STRING_FREE(result);
}
@@ -2779,22 +2779,20 @@ weechat_lua_api_hook_signal_send (lua_State *L)
if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_STRING) == 0)
{
signal_data = lua_tostring (lua_current_interpreter, -1);
- weechat_hook_signal_send ((char *)signal, (char *)type_data,
- (char *)signal_data);
+ weechat_hook_signal_send (signal, type_data, (void *)signal_data);
LUA_RETURN_OK;
}
else if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_INT) == 0)
{
number = lua_tonumber (lua_current_interpreter, -1);
- weechat_hook_signal_send ((char *)signal, (char *)type_data,
- &number);
+ weechat_hook_signal_send (signal, type_data, &number);
LUA_RETURN_OK;
}
else if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_POINTER) == 0)
{
signal_data = lua_tostring (lua_current_interpreter, -1);
- weechat_hook_signal_send ((char *)signal, (char *)type_data,
- script_str2ptr ((char *)signal_data));
+ weechat_hook_signal_send (signal, type_data,
+ script_str2ptr (signal_data));
LUA_RETURN_OK;
}
@@ -2806,7 +2804,8 @@ weechat_lua_api_hook_signal_send (lua_State *L)
*/
int
-weechat_lua_api_hook_config_cb (void *data, char *option, char *value)
+weechat_lua_api_hook_config_cb (void *data, const char *option,
+ const char *value)
{
struct t_script_callback *script_callback;
char *lua_argv[3];
@@ -2814,8 +2813,8 @@ weechat_lua_api_hook_config_cb (void *data, char *option, char *value)
script_callback = (struct t_script_callback *)data;
- lua_argv[0] = option;
- lua_argv[1] = value;
+ lua_argv[0] = (char *)option;
+ lua_argv[1] = (char *)value;
lua_argv[2] = NULL;
rc = (int *) weechat_lua_exec (script_callback->script,
@@ -2871,9 +2870,9 @@ weechat_lua_api_hook_config (lua_State *L)
result = script_ptr2str (script_api_hook_config (weechat_lua_plugin,
lua_current_script,
- (char *)option,
+ option,
&weechat_lua_api_hook_config_cb,
- (char *)function));
+ function));
LUA_RETURN_STRING_FREE(result);
}
@@ -2883,7 +2882,7 @@ weechat_lua_api_hook_config (lua_State *L)
*/
int
-weechat_lua_api_hook_completion_cb (void *data, char *completion,
+weechat_lua_api_hook_completion_cb (void *data, const char *completion,
struct t_gui_buffer *buffer,
struct t_weelist *list)
{
@@ -2893,7 +2892,7 @@ weechat_lua_api_hook_completion_cb (void *data, char *completion,
script_callback = (struct t_script_callback *)data;
- lua_argv[0] = completion;
+ lua_argv[0] = (char *)completion;
lua_argv[1] = script_ptr2str (buffer);
lua_argv[2] = script_ptr2str (list);
lua_argv[3] = NULL;
@@ -2954,9 +2953,9 @@ weechat_lua_api_hook_completion (lua_State *L)
result = script_ptr2str (script_api_hook_completion (weechat_lua_plugin,
lua_current_script,
- (char *)completion,
+ completion,
&weechat_lua_api_hook_completion_cb,
- (char *)function));
+ function));
LUA_RETURN_STRING_FREE(result);
}
@@ -2966,17 +2965,18 @@ weechat_lua_api_hook_completion (lua_State *L)
*/
char *
-weechat_lua_api_hook_modifier_cb (void *data, char *modifier,
- char *modifier_data, char *string)
+weechat_lua_api_hook_modifier_cb (void *data, const char *modifier,
+ const char *modifier_data,
+ const char *string)
{
struct t_script_callback *script_callback;
char *lua_argv[4];
script_callback = (struct t_script_callback *)data;
- lua_argv[0] = modifier;
- lua_argv[1] = modifier_data;
- lua_argv[2] = string;
+ lua_argv[0] = (char *)modifier;
+ lua_argv[1] = (char *)modifier_data;
+ lua_argv[2] = (char *)string;
lua_argv[3] = NULL;
return (char *)weechat_lua_exec (script_callback->script,
@@ -3021,9 +3021,9 @@ weechat_lua_api_hook_modifier (lua_State *L)
result = script_ptr2str (script_api_hook_modifier (weechat_lua_plugin,
lua_current_script,
- (char *)modifier,
+ modifier,
&weechat_lua_api_hook_modifier_cb,
- (char *)function));
+ function));
LUA_RETURN_STRING_FREE(result);
}
@@ -3064,9 +3064,7 @@ weechat_lua_api_hook_modifier_exec (lua_State *L)
modifier_data = lua_tostring (lua_current_interpreter, -2);
string = lua_tostring (lua_current_interpreter, -1);
- result = weechat_hook_modifier_exec ((char *)modifier,
- (char *)modifier_data,
- (char *)string);
+ result = weechat_hook_modifier_exec (modifier, modifier_data, string);
LUA_RETURN_STRING_FREE(result);
}
@@ -3104,7 +3102,7 @@ weechat_lua_api_unhook (lua_State *L)
script_api_unhook (weechat_lua_plugin,
lua_current_script,
- script_str2ptr ((char *)hook));
+ script_str2ptr (hook));
LUA_RETURN_OK;
}
@@ -3136,7 +3134,7 @@ weechat_lua_api_unhook_all (lua_State *L)
int
weechat_lua_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
- char *input_data)
+ const char *input_data)
{
struct t_script_callback *script_callback;
char *lua_argv[3];
@@ -3145,7 +3143,7 @@ weechat_lua_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
script_callback = (struct t_script_callback *)data;
lua_argv[0] = script_ptr2str (buffer);
- lua_argv[1] = input_data;
+ lua_argv[1] = (char *)input_data;
lua_argv[2] = NULL;
rc = (int *) weechat_lua_exec (script_callback->script,
@@ -3240,12 +3238,12 @@ weechat_lua_api_buffer_new (lua_State *L)
result = script_ptr2str (script_api_buffer_new (weechat_lua_plugin,
lua_current_script,
- (char *)category,
- (char *)name,
+ category,
+ name,
&weechat_lua_api_buffer_input_data_cb,
- (char *)function_input,
+ function_input,
&weechat_lua_api_buffer_close_cb,
- (char *)function_close));
+ function_close));
LUA_RETURN_STRING_FREE(result);
}
@@ -3284,8 +3282,8 @@ weechat_lua_api_buffer_search (lua_State *L)
category = lua_tostring (lua_current_interpreter, -2);
name = lua_tostring (lua_current_interpreter, -1);
- result = script_ptr2str (weechat_buffer_search ((char *)category,
- (char *)name));
+ result = script_ptr2str (weechat_buffer_search (category,
+ name));
LUA_RETURN_STRING_FREE(result);
}
@@ -3321,7 +3319,7 @@ weechat_lua_api_buffer_clear (lua_State *L)
buffer = lua_tostring (lua_current_interpreter, -1);
- weechat_buffer_clear (script_str2ptr ((char *)buffer));
+ weechat_buffer_clear (script_str2ptr (buffer));
LUA_RETURN_OK;
}
@@ -3361,7 +3359,7 @@ weechat_lua_api_buffer_close (lua_State *L)
script_api_buffer_close (weechat_lua_plugin,
lua_current_script,
- script_str2ptr ((char *)buffer),
+ script_str2ptr (buffer),
switch_to_another);
LUA_RETURN_OK;
@@ -3401,8 +3399,8 @@ weechat_lua_api_buffer_get_string (lua_State *L)
buffer = lua_tostring (lua_current_interpreter, -2);
property = lua_tostring (lua_current_interpreter, -1);
- value = weechat_buffer_get_string (script_str2ptr ((char *)buffer),
- (char *)property);
+ value = weechat_buffer_get_string (script_str2ptr (buffer),
+ property);
LUA_RETURN_STRING(value);
}
@@ -3441,8 +3439,8 @@ weechat_lua_api_buffer_get_pointer (lua_State *L)
buffer = lua_tostring (lua_current_interpreter, -2);
property = lua_tostring (lua_current_interpreter, -1);
- value = script_ptr2str (weechat_buffer_get_string (script_str2ptr ((char *)buffer),
- (char *)property));
+ value = script_ptr2str (weechat_buffer_get_string (script_str2ptr (buffer),
+ property));
LUA_RETURN_STRING_FREE(value);
}
@@ -3481,9 +3479,7 @@ weechat_lua_api_buffer_set (lua_State *L)
property = lua_tostring (lua_current_interpreter, -2);
value = lua_tostring (lua_current_interpreter, -1);
- weechat_buffer_set (script_str2ptr ((char *)buffer),
- (char *)property,
- (char *)value);
+ weechat_buffer_set (script_str2ptr (buffer), property, value);
LUA_RETURN_OK;
}
@@ -3528,10 +3524,10 @@ weechat_lua_api_nicklist_add_group (lua_State *L)
color = lua_tostring (lua_current_interpreter, -2);
visible = lua_tonumber (lua_current_interpreter, -1);
- result = script_ptr2str (weechat_nicklist_add_group (script_str2ptr ((char *)buffer),
- script_str2ptr ((char *)parent_group),
- (char *)name,
- (char *)color,
+ result = script_ptr2str (weechat_nicklist_add_group (script_str2ptr (buffer),
+ script_str2ptr (parent_group),
+ name,
+ color,
visible));
LUA_RETURN_STRING_FREE(result);
@@ -3573,9 +3569,9 @@ weechat_lua_api_nicklist_search_group (lua_State *L)
from_group = lua_tostring (lua_current_interpreter, -2);
name = lua_tostring (lua_current_interpreter, -1);
- result = script_ptr2str (weechat_nicklist_search_group (script_str2ptr ((char *)buffer),
- script_str2ptr ((char *)from_group),
- (char *)name));
+ result = script_ptr2str (weechat_nicklist_search_group (script_str2ptr (buffer),
+ script_str2ptr (from_group),
+ name));
LUA_RETURN_STRING_FREE(result);
}
@@ -3629,12 +3625,12 @@ weechat_lua_api_nicklist_add_nick (lua_State *L)
else
char_prefix = ' ';
- result = script_ptr2str (weechat_nicklist_add_nick (script_str2ptr ((char *)buffer),
- script_str2ptr ((char *)group),
- (char *)name,
- (char *)color,
+ result = script_ptr2str (weechat_nicklist_add_nick (script_str2ptr (buffer),
+ script_str2ptr (group),
+ name,
+ color,
char_prefix,
- (char *)prefix_color,
+ prefix_color,
visible));
LUA_RETURN_STRING_FREE(result);
@@ -3676,9 +3672,9 @@ weechat_lua_api_nicklist_search_nick (lua_State *L)
from_group = lua_tostring (lua_current_interpreter, -2);
name = lua_tostring (lua_current_interpreter, -1);
- result = script_ptr2str (weechat_nicklist_search_nick (script_str2ptr ((char *)buffer),
- script_str2ptr ((char *)from_group),
- (char *)name));
+ result = script_ptr2str (weechat_nicklist_search_nick (script_str2ptr (buffer),
+ script_str2ptr (from_group),
+ name));
LUA_RETURN_STRING_FREE(result);
}
@@ -3716,8 +3712,8 @@ weechat_lua_api_nicklist_remove_group (lua_State *L)
buffer = lua_tostring (lua_current_interpreter, -3);
group = lua_tostring (lua_current_interpreter, -2);
- weechat_nicklist_remove_group (script_str2ptr ((char *)buffer),
- script_str2ptr ((char *)group));
+ weechat_nicklist_remove_group (script_str2ptr (buffer),
+ script_str2ptr (group));
LUA_RETURN_OK;
}
@@ -3755,8 +3751,8 @@ weechat_lua_api_nicklist_remove_nick (lua_State *L)
buffer = lua_tostring (lua_current_interpreter, -3);
nick = lua_tostring (lua_current_interpreter, -2);
- weechat_nicklist_remove_nick (script_str2ptr ((char *)buffer),
- script_str2ptr ((char *)nick));
+ weechat_nicklist_remove_nick (script_str2ptr (buffer),
+ script_str2ptr (nick));
LUA_RETURN_OK;
}
@@ -3792,7 +3788,7 @@ weechat_lua_api_nicklist_remove_all (lua_State *L)
buffer = lua_tostring (lua_current_interpreter, -3);
- weechat_nicklist_remove_all (script_str2ptr ((char *)buffer));
+ weechat_nicklist_remove_all (script_str2ptr (buffer));
LUA_RETURN_OK;
}
@@ -3829,7 +3825,7 @@ weechat_lua_api_bar_item_search (lua_State *L)
name = lua_tostring (lua_current_interpreter, -1);
- result = script_ptr2str (weechat_bar_item_search ((char *)name));
+ result = script_ptr2str (weechat_bar_item_search (name));
LUA_RETURN_STRING_FREE(result);
}
@@ -3907,9 +3903,9 @@ weechat_lua_api_bar_item_new (lua_State *L)
result = script_ptr2str (script_api_bar_item_new (weechat_lua_plugin,
lua_current_script,
- (char *)name,
+ name,
&weechat_lua_api_bar_item_build_cb,
- (char *)function));
+ function));
LUA_RETURN_STRING_FREE(result);
}
@@ -3945,7 +3941,7 @@ weechat_lua_api_bar_item_update (lua_State *L)
name = lua_tostring (lua_current_interpreter, -1);
- weechat_bar_item_update ((char *)name);
+ weechat_bar_item_update (name);
LUA_RETURN_OK;
}
@@ -3983,7 +3979,7 @@ weechat_lua_api_bar_item_remove (lua_State *L)
script_api_bar_item_remove (weechat_lua_plugin,
lua_current_script,
- script_str2ptr ((char *)item));
+ script_str2ptr (item));
LUA_RETURN_OK;
}
@@ -4020,7 +4016,7 @@ weechat_lua_api_bar_search (lua_State *L)
name = lua_tostring (lua_current_interpreter, -1);
- result = script_ptr2str (weechat_bar_search ((char *)name));
+ result = script_ptr2str (weechat_bar_search (name));
LUA_RETURN_STRING_FREE(result);
}
@@ -4080,18 +4076,18 @@ weechat_lua_api_bar_new (lua_State *L)
separator = lua_tostring (lua_current_interpreter, -2);
items = lua_tostring (lua_current_interpreter, -1);
- result = script_ptr2str (weechat_bar_new ((char *)name,
- (char *)priority,
- (char *)type,
- (char *)conditions,
- (char *)position,
- (char *)filling,
- (char *)size,
- (char *)size_max,
- (char *)color_fg,
- (char *)color_bg,
- (char *)separator,
- (char *)items));
+ result = script_ptr2str (weechat_bar_new (name,
+ priority,
+ type,
+ conditions,
+ position,
+ filling,
+ size,
+ size_max,
+ color_fg,
+ color_bg,
+ separator,
+ items));
LUA_RETURN_STRING_FREE(result);
}
@@ -4130,9 +4126,9 @@ weechat_lua_api_bar_set (lua_State *L)
property = lua_tostring (lua_current_interpreter, -2);
value = lua_tostring (lua_current_interpreter, -1);
- weechat_buffer_set (script_str2ptr ((char *)bar),
- (char *)property,
- (char *)value);
+ weechat_buffer_set (script_str2ptr (bar),
+ property,
+ value);
LUA_RETURN_OK;
}
@@ -4168,7 +4164,7 @@ weechat_lua_api_bar_update (lua_State *L)
name = lua_tostring (lua_current_interpreter, -1);
- weechat_bar_update ((char *)name);
+ weechat_bar_update (name);
LUA_RETURN_OK;
}
@@ -4204,7 +4200,7 @@ weechat_lua_api_bar_remove (lua_State *L)
bar = lua_tostring (lua_current_interpreter, -1);
- weechat_bar_remove (script_str2ptr ((char *)bar));
+ weechat_bar_remove (script_str2ptr (bar));
LUA_RETURN_OK;
}
@@ -4244,8 +4240,8 @@ weechat_lua_api_command (lua_State *L)
script_api_command (weechat_lua_plugin,
lua_current_script,
- script_str2ptr ((char *)buffer),
- (char *)command);
+ script_str2ptr (buffer),
+ command);
LUA_RETURN_OK;
}
@@ -4282,7 +4278,7 @@ weechat_lua_api_info_get (lua_State *L)
info = lua_tostring (lua_current_interpreter, -1);
- value = weechat_info_get ((char *)info);
+ value = weechat_info_get (info);
LUA_RETURN_STRING(value);
}
@@ -4323,9 +4319,9 @@ weechat_lua_api_infolist_get (lua_State *L)
pointer = lua_tostring (lua_current_interpreter, -2);
arguments = lua_tostring (lua_current_interpreter, -1);
- value = script_ptr2str (weechat_infolist_get ((char *)name,
- script_str2ptr ((char *)pointer),
- (char *)arguments));
+ value = script_ptr2str (weechat_infolist_get (name,
+ script_str2ptr (pointer),
+ arguments));
LUA_RETURN_STRING_FREE(value);
}
@@ -4361,7 +4357,7 @@ weechat_lua_api_infolist_next (lua_State *L)
infolist = lua_tostring (lua_current_interpreter, -1);
- value = weechat_infolist_next (script_str2ptr ((char *)infolist));
+ value = weechat_infolist_next (script_str2ptr (infolist));
LUA_RETURN_INT(value);
}
@@ -4397,7 +4393,7 @@ weechat_lua_api_infolist_prev (lua_State *L)
infolist = lua_tostring (lua_current_interpreter, -1);
- value = weechat_infolist_prev (script_str2ptr ((char *)infolist));
+ value = weechat_infolist_prev (script_str2ptr (infolist));
LUA_RETURN_INT(value);
}
@@ -4434,7 +4430,7 @@ weechat_lua_api_infolist_fields (lua_State *L)
infolist = lua_tostring (lua_current_interpreter, -1);
- value = weechat_infolist_fields (script_str2ptr ((char *)infolist));
+ value = weechat_infolist_fields (script_str2ptr (infolist));
LUA_RETURN_STRING(value);
}
@@ -4472,8 +4468,8 @@ weechat_lua_api_infolist_integer (lua_State *L)
infolist = lua_tostring (lua_current_interpreter, -2);
variable = lua_tostring (lua_current_interpreter, -1);
- value = weechat_infolist_integer (script_str2ptr ((char *)infolist),
- (char *)variable);
+ value = weechat_infolist_integer (script_str2ptr (infolist),
+ variable);
LUA_RETURN_INT(value);
}
@@ -4512,8 +4508,8 @@ weechat_lua_api_infolist_string (lua_State *L)
infolist = lua_tostring (lua_current_interpreter, -2);
variable = lua_tostring (lua_current_interpreter, -1);
- value = weechat_infolist_string (script_str2ptr ((char *)infolist),
- (char *)variable);
+ value = weechat_infolist_string (script_str2ptr (infolist),
+ variable);
LUA_RETURN_STRING(value);
}
@@ -4552,8 +4548,8 @@ weechat_lua_api_infolist_pointer (lua_State *L)
infolist = lua_tostring (lua_current_interpreter, -2);
variable = lua_tostring (lua_current_interpreter, -1);
- value = script_ptr2str (weechat_infolist_pointer (script_str2ptr ((char *)infolist),
- (char *)variable));
+ value = script_ptr2str (weechat_infolist_pointer (script_str2ptr (infolist),
+ variable));
LUA_RETURN_STRING_FREE(value);
}
@@ -4593,8 +4589,8 @@ weechat_lua_api_infolist_time (lua_State *L)
infolist = lua_tostring (lua_current_interpreter, -2);
variable = lua_tostring (lua_current_interpreter, -1);
- time = weechat_infolist_time (script_str2ptr ((char *)infolist),
- (char *)variable);
+ time = weechat_infolist_time (script_str2ptr (infolist),
+ variable);
strftime (timebuffer, sizeof (timebuffer), "%F %T", localtime (&time));
value = strdup (timebuffer);
@@ -4632,7 +4628,7 @@ weechat_lua_api_infolist_free (lua_State *L)
infolist = lua_tostring (lua_current_interpreter, -1);
- weechat_infolist_free (script_str2ptr ((char *)infolist));
+ weechat_infolist_free (script_str2ptr (infolist));
LUA_RETURN_OK;
}
diff --git a/src/plugins/scripts/lua/weechat-lua.c b/src/plugins/scripts/lua/weechat-lua.c
index f6ca6a6e9..6759dbe87 100644
--- a/src/plugins/scripts/lua/weechat-lua.c
+++ b/src/plugins/scripts/lua/weechat-lua.c
@@ -43,7 +43,7 @@ struct t_weechat_plugin *weechat_lua_plugin;
struct t_plugin_script *lua_scripts = NULL;
struct t_plugin_script *lua_current_script = NULL;
-char *lua_current_script_filename = NULL;
+const char *lua_current_script_filename = NULL;
lua_State *lua_current_interpreter = NULL;
@@ -53,7 +53,7 @@ lua_State *lua_current_interpreter = NULL;
void *
weechat_lua_exec (struct t_plugin_script *script,
- int ret_type, char *function, char **argv)
+ int ret_type, const char *function, char **argv)
{
void *ret_value;
int argc, *ret_i;
@@ -127,7 +127,7 @@ weechat_lua_exec (struct t_plugin_script *script,
}
int
-weechat_lua_load (char *filename)
+weechat_lua_load (const char *filename)
{
FILE *fp;
char *weechat_lua_code = {
@@ -247,7 +247,7 @@ weechat_lua_load (char *filename)
*/
int
-weechat_lua_load_cb (void *data, char *filename)
+weechat_lua_load_cb (void *data, const char *filename)
{
/* make C compiler happy */
(void) data;
@@ -292,7 +292,7 @@ weechat_lua_unload (struct t_plugin_script *script)
*/
void
-weechat_lua_unload_name (char *name)
+weechat_lua_unload_name (const char *name)
{
struct t_plugin_script *ptr_script;
@@ -413,7 +413,7 @@ weechat_lua_command_cb (void *data, struct t_gui_buffer *buffer,
*/
int
-weechat_lua_completion_cb (void *data, char *completion,
+weechat_lua_completion_cb (void *data, const char *completion,
struct t_gui_buffer *buffer,
struct t_weelist *list)
{
@@ -432,7 +432,7 @@ weechat_lua_completion_cb (void *data, char *completion,
*/
int
-weechat_lua_debug_dump_cb (void *data, char *signal, char *type_data,
+weechat_lua_debug_dump_cb (void *data, const char *signal, const char *type_data,
void *signal_data)
{
/* make C compiler happy */
@@ -451,7 +451,7 @@ weechat_lua_debug_dump_cb (void *data, char *signal, char *type_data,
*/
int
-weechat_lua_buffer_closed_cb (void *data, char *signal, char *type_data,
+weechat_lua_buffer_closed_cb (void *data, const char *signal, const char *type_data,
void *signal_data)
{
/* make C compiler happy */
diff --git a/src/plugins/scripts/lua/weechat-lua.h b/src/plugins/scripts/lua/weechat-lua.h
index 2630fa99d..020ef5a5f 100644
--- a/src/plugins/scripts/lua/weechat-lua.h
+++ b/src/plugins/scripts/lua/weechat-lua.h
@@ -26,10 +26,11 @@ extern struct t_weechat_plugin *weechat_lua_plugin;
extern struct t_plugin_script *lua_scripts;
extern struct t_plugin_script *lua_current_script;
-extern char *lua_current_script_filename;
+extern const char *lua_current_script_filename;
extern lua_State *lua_current_interpreter;
-extern void * weechat_lua_exec (struct t_plugin_script *script,
- int ret_type, char *function, char **argv);
+extern void *weechat_lua_exec (struct t_plugin_script *script,
+ int ret_type, const char *function,
+ char **argv);
#endif /* weechat-lua.h */
diff --git a/src/plugins/scripts/perl/weechat-perl-api.c b/src/plugins/scripts/perl/weechat-perl-api.c
index d985e9854..1a429bd08 100644
--- a/src/plugins/scripts/perl/weechat-perl-api.c
+++ b/src/plugins/scripts/perl/weechat-perl-api.c
@@ -803,7 +803,7 @@ static XS (XS_weechat_config_new)
void
weechat_perl_api_config_section_read_cb (void *data,
struct t_config_file *config_file,
- char *option_name, char *value)
+ const char *option_name, const char *value)
{
struct t_script_callback *script_callback;
char *perl_argv[4];
@@ -814,8 +814,8 @@ weechat_perl_api_config_section_read_cb (void *data,
if (script_callback->function && script_callback->function[0])
{
perl_argv[0] = script_ptr2str (config_file);
- perl_argv[1] = option_name;
- perl_argv[2] = value;
+ perl_argv[1] = (char *)option_name;
+ perl_argv[2] = (char *)value;
perl_argv[3] = NULL;
rc = (int *) weechat_perl_exec (script_callback->script,
@@ -837,7 +837,7 @@ weechat_perl_api_config_section_read_cb (void *data,
void
weechat_perl_api_config_section_write_cb (void *data,
struct t_config_file *config_file,
- char *section_name)
+ const char *section_name)
{
struct t_script_callback *script_callback;
char *perl_argv[3];
@@ -848,7 +848,7 @@ weechat_perl_api_config_section_write_cb (void *data,
if (script_callback->function && script_callback->function[0])
{
perl_argv[0] = script_ptr2str (config_file);
- perl_argv[1] = section_name;
+ perl_argv[1] = (char *)section_name;
perl_argv[2] = NULL;
rc = (int *) weechat_perl_exec (script_callback->script,
@@ -871,7 +871,7 @@ weechat_perl_api_config_section_write_cb (void *data,
void
weechat_perl_api_config_section_write_default_cb (void *data,
struct t_config_file *config_file,
- char *section_name)
+ const char *section_name)
{
struct t_script_callback *script_callback;
char *perl_argv[3];
@@ -882,7 +882,7 @@ weechat_perl_api_config_section_write_default_cb (void *data,
if (script_callback->function && script_callback->function[0])
{
perl_argv[0] = script_ptr2str (config_file);
- perl_argv[1] = section_name;
+ perl_argv[1] = (char *)section_name;
perl_argv[2] = NULL;
rc = (int *) weechat_perl_exec (script_callback->script,
@@ -905,8 +905,8 @@ int
weechat_perl_api_config_section_create_option_cb (void *data,
struct t_config_file *config_file,
struct t_config_section *section,
- char *option_name,
- char *value)
+ const char *option_name,
+ const char *value)
{
struct t_script_callback *script_callback;
char *perl_argv[5];
@@ -918,8 +918,8 @@ weechat_perl_api_config_section_create_option_cb (void *data,
{
perl_argv[0] = script_ptr2str (config_file);
perl_argv[1] = script_ptr2str (section);
- perl_argv[2] = option_name;
- perl_argv[3] = value;
+ perl_argv[2] = (char *)option_name;
+ perl_argv[3] = (char *)value;
perl_argv[4] = NULL;
rc = (int *) weechat_perl_exec (script_callback->script,
@@ -2101,7 +2101,7 @@ static XS (XS_weechat_hook_fd)
int
weechat_perl_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
time_t date, int tags_count, char **tags,
- char *prefix, char *message)
+ const char *prefix, const char *message)
{
struct t_script_callback *script_callback;
char *perl_argv[6];
@@ -2118,8 +2118,8 @@ weechat_perl_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
perl_argv[0] = script_ptr2str (buffer);
perl_argv[1] = timebuffer;
perl_argv[2] = weechat_string_build_with_exploded (tags, ",");
- perl_argv[3] = prefix;
- perl_argv[4] = message;
+ perl_argv[3] = (char *)prefix;
+ perl_argv[4] = (char *)message;
perl_argv[5] = NULL;
rc = (int *) weechat_perl_exec (script_callback->script,
@@ -2187,7 +2187,7 @@ static XS (XS_weechat_hook_print)
*/
int
-weechat_perl_api_hook_signal_cb (void *data, char *signal, char *type_data,
+weechat_perl_api_hook_signal_cb (void *data, const char *signal, const char *type_data,
void *signal_data)
{
struct t_script_callback *script_callback;
@@ -2197,7 +2197,7 @@ weechat_perl_api_hook_signal_cb (void *data, char *signal, char *type_data,
script_callback = (struct t_script_callback *)data;
- perl_argv[0] = signal;
+ perl_argv[0] = (char *)signal;
free_needed = 0;
if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_STRING) == 0)
{
@@ -2329,7 +2329,7 @@ static XS (XS_weechat_hook_signal_send)
*/
int
-weechat_perl_api_hook_config_cb (void *data, char *option, char *value)
+weechat_perl_api_hook_config_cb (void *data, const char *option, const char *value)
{
struct t_script_callback *script_callback;
char *perl_argv[3];
@@ -2337,8 +2337,8 @@ weechat_perl_api_hook_config_cb (void *data, char *option, char *value)
script_callback = (struct t_script_callback *)data;
- perl_argv[0] = option;
- perl_argv[1] = value;
+ perl_argv[0] = (char *)option;
+ perl_argv[1] = (char *)value;
perl_argv[2] = NULL;
rc = (int *) weechat_perl_exec (script_callback->script,
@@ -2397,7 +2397,7 @@ static XS (XS_weechat_hook_config)
*/
int
-weechat_perl_api_hook_completion_cb (void *data, char *completion,
+weechat_perl_api_hook_completion_cb (void *data, const char *completion,
struct t_gui_buffer *buffer,
struct t_weelist *list)
{
@@ -2407,7 +2407,7 @@ weechat_perl_api_hook_completion_cb (void *data, char *completion,
script_callback = (struct t_script_callback *)data;
- perl_argv[0] = completion;
+ perl_argv[0] = (char *)completion;
perl_argv[1] = script_ptr2str (buffer);
perl_argv[2] = script_ptr2str (list);
perl_argv[3] = NULL;
@@ -2472,17 +2472,17 @@ static XS (XS_weechat_hook_completion)
*/
char *
-weechat_perl_api_hook_modifier_cb (void *data, char *modifier,
- char *modifier_data, char *string)
+weechat_perl_api_hook_modifier_cb (void *data, const char *modifier,
+ const char *modifier_data, const char *string)
{
struct t_script_callback *script_callback;
char *perl_argv[4];
script_callback = (struct t_script_callback *)data;
- perl_argv[0] = modifier;
- perl_argv[1] = modifier_data;
- perl_argv[2] = string;
+ perl_argv[0] = (char *)modifier;
+ perl_argv[1] = (char *)modifier_data;
+ perl_argv[2] = (char *)string;
perl_argv[3] = NULL;
return (char *)weechat_perl_exec (script_callback->script,
@@ -2617,7 +2617,7 @@ static XS (XS_weechat_unhook_all)
int
weechat_perl_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
- char *input_data)
+ const char *input_data)
{
struct t_script_callback *script_callback;
char *perl_argv[3];
@@ -2626,7 +2626,7 @@ weechat_perl_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
script_callback = (struct t_script_callback *)data;
perl_argv[0] = script_ptr2str (buffer);
- perl_argv[1] = input_data;
+ perl_argv[1] = (char *)input_data;
perl_argv[2] = NULL;
rc = (int *) weechat_perl_exec (script_callback->script,
diff --git a/src/plugins/scripts/perl/weechat-perl.c b/src/plugins/scripts/perl/weechat-perl.c
index ec65da636..f76cf337e 100644
--- a/src/plugins/scripts/perl/weechat-perl.c
+++ b/src/plugins/scripts/perl/weechat-perl.c
@@ -41,7 +41,7 @@ struct t_weechat_plugin *weechat_perl_plugin = NULL;
struct t_plugin_script *perl_scripts = NULL;
struct t_plugin_script *perl_current_script = NULL;
-char *perl_current_script_filename = NULL;
+const char *perl_current_script_filename = NULL;
#ifdef NO_PERL_MULTIPLICITY
#undef MULTIPLICITY
@@ -106,9 +106,9 @@ char *perl_weechat_code =
void *
weechat_perl_exec (struct t_plugin_script *script,
- int ret_type, char *function, char **argv)
+ int ret_type, const char *function, char **argv)
{
- char *func;
+ const char *func;
unsigned int count;
void *ret_value;
int *ret_i, mem_err, length;
@@ -224,7 +224,7 @@ weechat_perl_exec (struct t_plugin_script *script,
*/
int
-weechat_perl_load (char *filename)
+weechat_perl_load (const char *filename)
{
STRLEN len;
struct t_plugin_script tempscript;
@@ -274,13 +274,13 @@ weechat_perl_load (char *filename)
NULL);
eval_pv (perl_weechat_code, TRUE);
- perl_argv[0] = filename;
+ perl_argv[0] = (char *)filename;
perl_argv[1] = NULL;
#else
snprintf (pkgname, sizeof(pkgname), "%s%d", PKG_NAME_PREFIX, perl_num);
perl_num++;
tempscript.interpreter = "WeechatPerlScriptLoader";
- perl_argv[0] = filename;
+ perl_argv[0] = (char *)filename;
perl_argv[1] = pkgname;
perl_argv[2] = NULL;
#endif
@@ -376,7 +376,7 @@ weechat_perl_load (char *filename)
*/
int
-weechat_perl_load_cb (void *data, char *filename)
+weechat_perl_load_cb (void *data, const char *filename)
{
/* make C compiler happy */
(void) data;
@@ -433,7 +433,7 @@ weechat_perl_unload (struct t_plugin_script *script)
*/
void
-weechat_perl_unload_name (char *name)
+weechat_perl_unload_name (const char *name)
{
struct t_plugin_script *ptr_script;
@@ -554,7 +554,7 @@ weechat_perl_command_cb (void *data, struct t_gui_buffer *buffer,
*/
int
-weechat_perl_completion_cb (void *data, char *completion,
+weechat_perl_completion_cb (void *data, const char *completion,
struct t_gui_buffer *buffer,
struct t_weelist *list)
{
@@ -573,7 +573,7 @@ weechat_perl_completion_cb (void *data, char *completion,
*/
int
-weechat_perl_debug_dump_cb (void *data, char *signal, char *type_data,
+weechat_perl_debug_dump_cb (void *data, const char *signal, const char *type_data,
void *signal_data)
{
/* make C compiler happy */
@@ -592,7 +592,7 @@ weechat_perl_debug_dump_cb (void *data, char *signal, char *type_data,
*/
int
-weechat_perl_buffer_closed_cb (void *data, char *signal, char *type_data,
+weechat_perl_buffer_closed_cb (void *data, const char *signal, const char *type_data,
void *signal_data)
{
/* make C compiler happy */
diff --git a/src/plugins/scripts/perl/weechat-perl.h b/src/plugins/scripts/perl/weechat-perl.h
index 7f4a7edbb..a9bba24ac 100644
--- a/src/plugins/scripts/perl/weechat-perl.h
+++ b/src/plugins/scripts/perl/weechat-perl.h
@@ -26,9 +26,10 @@ extern struct t_weechat_plugin *weechat_perl_plugin;
extern struct t_plugin_script *perl_scripts;
extern struct t_plugin_script *perl_current_script;
-extern char *perl_current_script_filename;
+extern const char *perl_current_script_filename;
-extern void * weechat_perl_exec (struct t_plugin_script *script,
- int ret_type, char *function, char **argv);
+extern void *weechat_perl_exec (struct t_plugin_script *script,
+ int ret_type, const char *function,
+ char **argv);
#endif /* weechat-perl.h */
diff --git a/src/plugins/scripts/python/weechat-python-api.c b/src/plugins/scripts/python/weechat-python-api.c
index 07598b143..713b608cc 100644
--- a/src/plugins/scripts/python/weechat-python-api.c
+++ b/src/plugins/scripts/python/weechat-python-api.c
@@ -847,7 +847,7 @@ weechat_python_api_config_new (PyObject *self, PyObject *args)
void
weechat_python_api_config_read_cb (void *data,
struct t_config_file *config_file,
- char *option_name, char *value)
+ const char *option_name, const char *value)
{
struct t_script_callback *script_callback;
char *python_argv[4];
@@ -858,8 +858,8 @@ weechat_python_api_config_read_cb (void *data,
if (script_callback->function && script_callback->function[0])
{
python_argv[0] = script_ptr2str (config_file);
- python_argv[1] = option_name;
- python_argv[2] = value;
+ python_argv[1] = (char *)option_name;
+ python_argv[2] = (char *)value;
python_argv[3] = NULL;
rc = (int *) weechat_python_exec (script_callback->script,
@@ -881,7 +881,7 @@ weechat_python_api_config_read_cb (void *data,
void
weechat_python_api_config_section_write_cb (void *data,
struct t_config_file *config_file,
- char *section_name)
+ const char *section_name)
{
struct t_script_callback *script_callback;
char *python_argv[3];
@@ -892,7 +892,7 @@ weechat_python_api_config_section_write_cb (void *data,
if (script_callback->function && script_callback->function[0])
{
python_argv[0] = script_ptr2str (config_file);
- python_argv[1] = section_name;
+ python_argv[1] = (char *)section_name;
python_argv[2] = NULL;
rc = (int *) weechat_python_exec (script_callback->script,
@@ -915,7 +915,7 @@ weechat_python_api_config_section_write_cb (void *data,
void
weechat_python_api_config_section_write_default_cb (void *data,
struct t_config_file *config_file,
- char *section_name)
+ const char *section_name)
{
struct t_script_callback *script_callback;
char *python_argv[3];
@@ -926,7 +926,7 @@ weechat_python_api_config_section_write_default_cb (void *data,
if (script_callback->function && script_callback->function[0])
{
python_argv[0] = script_ptr2str (config_file);
- python_argv[1] = section_name;
+ python_argv[1] = (char *)section_name;
python_argv[2] = NULL;
rc = (int *) weechat_python_exec (script_callback->script,
@@ -949,8 +949,8 @@ int
weechat_python_api_config_section_create_option_cb (void *data,
struct t_config_file *config_file,
struct t_config_section *section,
- char *option_name,
- char *value)
+ const char *option_name,
+ const char *value)
{
struct t_script_callback *script_callback;
char *python_argv[5];
@@ -962,8 +962,8 @@ weechat_python_api_config_section_create_option_cb (void *data,
{
python_argv[0] = script_ptr2str (config_file);
python_argv[1] = script_ptr2str (section);
- python_argv[2] = option_name;
- python_argv[3] = value;
+ python_argv[2] = (char *)option_name;
+ python_argv[3] = (char *)value;
python_argv[4] = NULL;
rc = (int *) weechat_python_exec (script_callback->script,
@@ -2245,7 +2245,7 @@ weechat_python_api_hook_fd (PyObject *self, PyObject *args)
int
weechat_python_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
time_t date, int tags_count, char **tags,
- char *prefix, char *message)
+ const char *prefix, const char *message)
{
struct t_script_callback *script_callback;
char *python_argv[6];
@@ -2262,8 +2262,8 @@ weechat_python_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
python_argv[0] = script_ptr2str (buffer);
python_argv[1] = timebuffer;
python_argv[2] = weechat_string_build_with_exploded (tags, ",");
- python_argv[3] = prefix;
- python_argv[4] = message;
+ python_argv[3] = (char *)prefix;
+ python_argv[4] = (char *)message;
python_argv[5] = NULL;
rc = (int *) weechat_python_exec (script_callback->script,
@@ -2336,7 +2336,7 @@ weechat_python_api_hook_print (PyObject *self, PyObject *args)
*/
int
-weechat_python_api_hook_signal_cb (void *data, char *signal, char *type_data,
+weechat_python_api_hook_signal_cb (void *data, const char *signal, const char *type_data,
void *signal_data)
{
struct t_script_callback *script_callback;
@@ -2346,7 +2346,7 @@ weechat_python_api_hook_signal_cb (void *data, char *signal, char *type_data,
script_callback = (struct t_script_callback *)data;
- python_argv[0] = signal;
+ python_argv[0] = (char *)signal;
free_needed = 0;
if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_STRING) == 0)
{
@@ -2481,7 +2481,7 @@ weechat_python_api_hook_signal_send (PyObject *self, PyObject *args)
*/
int
-weechat_python_api_hook_config_cb (void *data, char *option, char *value)
+weechat_python_api_hook_config_cb (void *data, const char *option, const char *value)
{
struct t_script_callback *script_callback;
char *python_argv[3];
@@ -2489,8 +2489,8 @@ weechat_python_api_hook_config_cb (void *data, char *option, char *value)
script_callback = (struct t_script_callback *)data;
- python_argv[0] = option;
- python_argv[1] = value;
+ python_argv[0] = (char *)option;
+ python_argv[1] = (char *)value;
python_argv[2] = NULL;
rc = (int *) weechat_python_exec (script_callback->script,
@@ -2551,7 +2551,7 @@ weechat_python_api_hook_config (PyObject *self, PyObject *args)
*/
int
-weechat_python_api_hook_completion_cb (void *data, char *completion,
+weechat_python_api_hook_completion_cb (void *data, const char *completion,
struct t_gui_buffer *buffer,
struct t_weelist *list)
{
@@ -2561,7 +2561,7 @@ weechat_python_api_hook_completion_cb (void *data, char *completion,
script_callback = (struct t_script_callback *)data;
- python_argv[0] = completion;
+ python_argv[0] = (char *)completion;
python_argv[1] = script_ptr2str (buffer);
python_argv[2] = script_ptr2str (list);
python_argv[3] = NULL;
@@ -2628,17 +2628,17 @@ weechat_python_api_hook_completion (PyObject *self, PyObject *args)
*/
char *
-weechat_python_api_hook_modifier_cb (void *data, char *modifier,
- char *modifier_data, char *string)
+weechat_python_api_hook_modifier_cb (void *data, const char *modifier,
+ const char *modifier_data, const char *string)
{
struct t_script_callback *script_callback;
char *python_argv[4];
script_callback = (struct t_script_callback *)data;
- python_argv[0] = modifier;
- python_argv[1] = modifier_data;
- python_argv[2] = string;
+ python_argv[0] = (char *)modifier;
+ python_argv[1] = (char *)modifier_data;
+ python_argv[2] = (char *)string;
python_argv[3] = NULL;
return (char *)weechat_python_exec (script_callback->script,
@@ -2779,7 +2779,7 @@ weechat_python_api_unhook_all (PyObject *self, PyObject *args)
int
weechat_python_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
- char *input_data)
+ const char *input_data)
{
struct t_script_callback *script_callback;
char *python_argv[3];
@@ -2788,7 +2788,7 @@ weechat_python_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer
script_callback = (struct t_script_callback *)data;
python_argv[0] = script_ptr2str (buffer);
- python_argv[1] = input_data;
+ python_argv[1] = (char *)input_data;
python_argv[2] = NULL;
r = (int *) weechat_python_exec (script_callback->script,
diff --git a/src/plugins/scripts/python/weechat-python.c b/src/plugins/scripts/python/weechat-python.c
index 621e8b1f0..784df538e 100644
--- a/src/plugins/scripts/python/weechat-python.c
+++ b/src/plugins/scripts/python/weechat-python.c
@@ -39,7 +39,7 @@ struct t_weechat_plugin *weechat_python_plugin = NULL;
struct t_plugin_script *python_scripts = NULL;
struct t_plugin_script *python_current_script = NULL;
-char *python_current_script_filename = NULL;
+const char *python_current_script_filename = NULL;
PyThreadState *python_mainThreadState = NULL;
char python_buffer_output[128];
@@ -51,7 +51,7 @@ char python_buffer_output[128];
void *
weechat_python_exec (struct t_plugin_script *script,
- int ret_type, char *function, char **argv)
+ int ret_type, const char *function, char **argv)
{
PyObject *evMain;
PyObject *evDict;
@@ -255,7 +255,7 @@ PyMethodDef weechat_python_output_funcs[] = {
*/
int
-weechat_python_load (char *filename)
+weechat_python_load (const char *filename)
{
char *argv[] = { "__weechat_plugin__" , NULL };
FILE *fp;
@@ -441,7 +441,7 @@ weechat_python_load (char *filename)
*/
int
-weechat_python_load_cb (void *data, char *filename)
+weechat_python_load_cb (void *data, const char *filename)
{
/* make C compiler happy */
(void) data;
@@ -484,7 +484,7 @@ weechat_python_unload (struct t_plugin_script *script)
*/
void
-weechat_python_unload_name (char *name)
+weechat_python_unload_name (const char *name)
{
struct t_plugin_script *ptr_script;
@@ -605,7 +605,7 @@ weechat_python_command_cb (void *data, struct t_gui_buffer *buffer,
*/
int
-weechat_python_completion_cb (void *data, char *completion,
+weechat_python_completion_cb (void *data, const char *completion,
struct t_gui_buffer *buffer,
struct t_weelist *list)
{
@@ -624,7 +624,7 @@ weechat_python_completion_cb (void *data, char *completion,
*/
int
-weechat_python_debug_dump_cb (void *data, char *signal, char *type_data,
+weechat_python_debug_dump_cb (void *data, const char *signal, const char *type_data,
void *signal_data)
{
/* make C compiler happy */
@@ -643,7 +643,7 @@ weechat_python_debug_dump_cb (void *data, char *signal, char *type_data,
*/
int
-weechat_python_buffer_closed_cb (void *data, char *signal, char *type_data,
+weechat_python_buffer_closed_cb (void *data, const char *signal, const char *type_data,
void *signal_data)
{
/* make C compiler happy */
diff --git a/src/plugins/scripts/python/weechat-python.h b/src/plugins/scripts/python/weechat-python.h
index 62833e76d..16a659664 100644
--- a/src/plugins/scripts/python/weechat-python.h
+++ b/src/plugins/scripts/python/weechat-python.h
@@ -26,9 +26,10 @@ extern struct t_weechat_plugin *weechat_python_plugin;
extern struct t_plugin_script *python_scripts;
extern struct t_plugin_script *python_current_script;
-extern char *python_current_script_filename;
+extern const char *python_current_script_filename;
-extern void * weechat_python_exec (struct t_plugin_script *script,
- int ret_type, char *function, char **argv);
+extern void *weechat_python_exec (struct t_plugin_script *script,
+ int ret_type, const char *function,
+ char **argv);
#endif /* weechat-perl.h */
diff --git a/src/plugins/scripts/ruby/weechat-ruby-api.c b/src/plugins/scripts/ruby/weechat-ruby-api.c
index 76bf4b9b1..8507e9d41 100644
--- a/src/plugins/scripts/ruby/weechat-ruby-api.c
+++ b/src/plugins/scripts/ruby/weechat-ruby-api.c
@@ -966,7 +966,7 @@ weechat_ruby_api_config_new (VALUE class, VALUE name, VALUE function)
void
weechat_ruby_api_config_read_cb (void *data,
struct t_config_file *config_file,
- char *option_name, char *value)
+ const char *option_name, const char *value)
{
struct t_script_callback *script_callback;
char *ruby_argv[4];
@@ -977,8 +977,8 @@ weechat_ruby_api_config_read_cb (void *data,
if (script_callback->function && script_callback->function[0])
{
ruby_argv[0] = script_ptr2str (config_file);
- ruby_argv[1] = option_name;
- ruby_argv[2] = value;
+ ruby_argv[1] = (char *)option_name;
+ ruby_argv[2] = (char *)value;
ruby_argv[3] = NULL;
rc = (int *) weechat_ruby_exec (script_callback->script,
@@ -1000,7 +1000,7 @@ weechat_ruby_api_config_read_cb (void *data,
void
weechat_ruby_api_config_section_write_cb (void *data,
struct t_config_file *config_file,
- char *section_name)
+ const char *section_name)
{
struct t_script_callback *script_callback;
char *ruby_argv[3];
@@ -1011,7 +1011,7 @@ weechat_ruby_api_config_section_write_cb (void *data,
if (script_callback->function && script_callback->function[0])
{
ruby_argv[0] = script_ptr2str (config_file);
- ruby_argv[1] = section_name;
+ ruby_argv[1] = (char *)section_name;
ruby_argv[2] = NULL;
rc = (int *) weechat_ruby_exec (script_callback->script,
@@ -1034,7 +1034,7 @@ weechat_ruby_api_config_section_write_cb (void *data,
void
weechat_ruby_api_config_section_write_default_cb (void *data,
struct t_config_file *config_file,
- char *section_name)
+ const char *section_name)
{
struct t_script_callback *script_callback;
char *ruby_argv[3];
@@ -1045,7 +1045,7 @@ weechat_ruby_api_config_section_write_default_cb (void *data,
if (script_callback->function && script_callback->function[0])
{
ruby_argv[0] = script_ptr2str (config_file);
- ruby_argv[1] = section_name;
+ ruby_argv[1] = (char *)section_name;
ruby_argv[2] = NULL;
rc = (int *) weechat_ruby_exec (script_callback->script,
@@ -1068,8 +1068,8 @@ int
weechat_ruby_api_config_section_create_option_cb (void *data,
struct t_config_file *config_file,
struct t_config_section *section,
- char *option_name,
- char *value)
+ const char *option_name,
+ const char *value)
{
struct t_script_callback *script_callback;
char *ruby_argv[5];
@@ -1081,8 +1081,8 @@ weechat_ruby_api_config_section_create_option_cb (void *data,
{
ruby_argv[0] = script_ptr2str (config_file);
ruby_argv[1] = script_ptr2str (section);
- ruby_argv[2] = option_name;
- ruby_argv[3] = value;
+ ruby_argv[2] = (char *)option_name;
+ ruby_argv[3] = (char *)value;
ruby_argv[4] = NULL;
rc = (int *) weechat_ruby_exec (script_callback->script,
@@ -2599,7 +2599,7 @@ weechat_ruby_api_hook_fd (VALUE class, VALUE fd, VALUE read, VALUE write,
int
weechat_ruby_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
time_t date, int tags_count, char **tags,
- char *prefix, char *message)
+ const char *prefix, const char *message)
{
struct t_script_callback *script_callback;
char *ruby_argv[6];
@@ -2616,8 +2616,8 @@ weechat_ruby_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
ruby_argv[0] = script_ptr2str (buffer);
ruby_argv[1] = timebuffer;
ruby_argv[2] = weechat_string_build_with_exploded (tags, ",");
- ruby_argv[3] = prefix;
- ruby_argv[4] = message;
+ ruby_argv[3] = (char *)prefix;
+ ruby_argv[4] = (char *)message;
ruby_argv[5] = NULL;
rc = (int *) weechat_ruby_exec (script_callback->script,
@@ -2703,7 +2703,7 @@ weechat_ruby_api_hook_print (VALUE class, VALUE buffer, VALUE tags,
*/
int
-weechat_ruby_api_hook_signal_cb (void *data, char *signal, char *type_data,
+weechat_ruby_api_hook_signal_cb (void *data, const char *signal, const char *type_data,
void *signal_data)
{
struct t_script_callback *script_callback;
@@ -2713,7 +2713,7 @@ weechat_ruby_api_hook_signal_cb (void *data, char *signal, char *type_data,
script_callback = (struct t_script_callback *)data;
- ruby_argv[0] = signal;
+ ruby_argv[0] = (char *)signal;
free_needed = 0;
if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_STRING) == 0)
{
@@ -2862,7 +2862,7 @@ weechat_ruby_api_hook_signal_send (VALUE class, VALUE signal, VALUE type_data,
*/
int
-weechat_ruby_api_hook_config_cb (void *data, char *option, char *value)
+weechat_ruby_api_hook_config_cb (void *data, const char *option, const char *value)
{
struct t_script_callback *script_callback;
char *ruby_argv[3];
@@ -2870,8 +2870,8 @@ weechat_ruby_api_hook_config_cb (void *data, char *option, char *value)
script_callback = (struct t_script_callback *)data;
- ruby_argv[0] = option;
- ruby_argv[1] = value;
+ ruby_argv[0] = (char *)option;
+ ruby_argv[1] = (char *)value;
ruby_argv[2] = NULL;
rc = (int *) weechat_ruby_exec (script_callback->script,
@@ -2938,7 +2938,7 @@ weechat_ruby_api_hook_config (VALUE class, VALUE option, VALUE function)
*/
int
-weechat_ruby_api_hook_completion_cb (void *data, char *completion,
+weechat_ruby_api_hook_completion_cb (void *data, const char *completion,
struct t_gui_buffer *buffer,
struct t_weelist *list)
{
@@ -2948,7 +2948,7 @@ weechat_ruby_api_hook_completion_cb (void *data, char *completion,
script_callback = (struct t_script_callback *)data;
- ruby_argv[0] = completion;
+ ruby_argv[0] = (char *)completion;
ruby_argv[1] = script_ptr2str (buffer);
ruby_argv[2] = script_ptr2str (list);
ruby_argv[3] = NULL;
@@ -3022,17 +3022,17 @@ weechat_ruby_api_hook_completion (VALUE class, VALUE completion,
*/
char *
-weechat_ruby_api_hook_modifier_cb (void *data, char *modifier,
- char *modifier_data, char *string)
+weechat_ruby_api_hook_modifier_cb (void *data, const char *modifier,
+ const char *modifier_data, const char *string)
{
struct t_script_callback *script_callback;
char *ruby_argv[4];
script_callback = (struct t_script_callback *)data;
- ruby_argv[0] = modifier;
- ruby_argv[1] = modifier_data;
- ruby_argv[2] = string;
+ ruby_argv[0] = (char *)modifier;
+ ruby_argv[1] = (char *)modifier_data;
+ ruby_argv[2] = (char *)string;
ruby_argv[3] = NULL;
return (char *)weechat_ruby_exec (script_callback->script,
@@ -3191,7 +3191,7 @@ weechat_ruby_api_unhook_all (VALUE class)
int
weechat_ruby_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
- char *input_data)
+ const char *input_data)
{
struct t_script_callback *script_callback;
char *ruby_argv[3];
@@ -3200,7 +3200,7 @@ weechat_ruby_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
script_callback = (struct t_script_callback *)data;
ruby_argv[0] = script_ptr2str (buffer);
- ruby_argv[1] = input_data;
+ ruby_argv[1] = (char *)input_data;
ruby_argv[2] = NULL;
rc = (int *) weechat_ruby_exec (script_callback->script,
diff --git a/src/plugins/scripts/ruby/weechat-ruby.c b/src/plugins/scripts/ruby/weechat-ruby.c
index 190aab498..1b2e4ed3f 100644
--- a/src/plugins/scripts/ruby/weechat-ruby.c
+++ b/src/plugins/scripts/ruby/weechat-ruby.c
@@ -42,7 +42,7 @@ struct t_weechat_plugin *weechat_ruby_plugin = NULL;
struct t_plugin_script *ruby_scripts = NULL;
struct t_plugin_script *ruby_current_script = NULL;
-char *ruby_current_script_filename = NULL;
+const char *ruby_current_script_filename = NULL;
VALUE ruby_mWeechat, ruby_mWeechatOutputs;
@@ -107,7 +107,7 @@ rb_protect_funcall (VALUE recv, ID mid, int *state, int argc, ...)
void *
weechat_ruby_exec (struct t_plugin_script *script,
- int ret_type, char *function, char **argv)
+ int ret_type, const char *function, char **argv)
{
VALUE rc, err;
int ruby_error, *ret_i;
@@ -296,7 +296,7 @@ weechat_ruby_output_flush (VALUE self)
*/
int
-weechat_ruby_load (char *filename)
+weechat_ruby_load (const char *filename)
{
char modname[64];
VALUE curModule, ruby_retcode, err;
@@ -422,7 +422,7 @@ weechat_ruby_load (char *filename)
*/
int
-weechat_ruby_load_cb (void *data, char *filename)
+weechat_ruby_load_cb (void *data, const char *filename)
{
/* make C compiler happy */
(void) data;
@@ -468,7 +468,7 @@ weechat_ruby_unload (struct t_plugin_script *script)
*/
void
-weechat_ruby_unload_name (char *name)
+weechat_ruby_unload_name (const char *name)
{
struct t_plugin_script *ptr_script;
@@ -589,7 +589,7 @@ weechat_ruby_command_cb (void *data, struct t_gui_buffer *buffer,
*/
int
-weechat_ruby_completion_cb (void *data, char *completion,
+weechat_ruby_completion_cb (void *data, const char *completion,
struct t_gui_buffer *buffer,
struct t_weelist *list)
{
@@ -608,7 +608,7 @@ weechat_ruby_completion_cb (void *data, char *completion,
*/
int
-weechat_ruby_debug_dump_cb (void *data, char *signal, char *type_data,
+weechat_ruby_debug_dump_cb (void *data, const char *signal, const char *type_data,
void *signal_data)
{
/* make C compiler happy */
@@ -627,7 +627,7 @@ weechat_ruby_debug_dump_cb (void *data, char *signal, char *type_data,
*/
int
-weechat_ruby_buffer_closed_cb (void *data, char *signal, char *type_data,
+weechat_ruby_buffer_closed_cb (void *data, const char *signal, const char *type_data,
void *signal_data)
{
/* make C compiler happy */
diff --git a/src/plugins/scripts/ruby/weechat-ruby.h b/src/plugins/scripts/ruby/weechat-ruby.h
index db07bd5be..02f514c0f 100644
--- a/src/plugins/scripts/ruby/weechat-ruby.h
+++ b/src/plugins/scripts/ruby/weechat-ruby.h
@@ -26,9 +26,10 @@ extern struct t_weechat_plugin *weechat_ruby_plugin;
extern struct t_plugin_script *ruby_scripts;
extern struct t_plugin_script *ruby_current_script;
-extern char *ruby_current_script_filename;
+extern const char *ruby_current_script_filename;
-extern void * weechat_ruby_exec (struct t_plugin_script *script,
- int ret_type, char *function, char **argv);
+extern void *weechat_ruby_exec (struct t_plugin_script *script,
+ int ret_type, const char *function,
+ char **argv);
#endif /* weechat-perl.h */
diff --git a/src/plugins/scripts/script-api.c b/src/plugins/scripts/script-api.c
index e074b5115..55f877f78 100644
--- a/src/plugins/scripts/script-api.c
+++ b/src/plugins/scripts/script-api.c
@@ -35,7 +35,7 @@
void
script_api_charset_set (struct t_plugin_script *script,
- char *charset)
+ const char *charset)
{
if (script->charset)
free (script->charset);
@@ -51,10 +51,10 @@ script_api_charset_set (struct t_plugin_script *script,
struct t_config_file *
script_api_config_new (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
- char *name,
+ const char *name,
int (*callback_reload)(void *data,
struct t_config_file *config_file),
- char *function)
+ const char *function)
{
struct t_script_callback *new_script_callback;
struct t_config_file *new_config_file;
@@ -97,28 +97,28 @@ struct t_config_section *
script_api_config_new_section (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
struct t_config_file *config_file,
- char *name,
+ const char *name,
int user_can_add_options,
int user_can_delete_options,
void (*callback_read)(void *data,
struct t_config_file *config_file,
- char *option_name,
- char *value),
+ const char *option_name,
+ const char *value),
char *function_read,
void (*callback_write)(void *data,
struct t_config_file *config_file,
- char *section_name),
+ const char *section_name),
char *function_write,
void (*callback_write_default)(void *data,
struct t_config_file *config_file,
- char *section_name),
+ const char *section_name),
char *function_write_default,
int (*callback_create_option)(void *data,
struct t_config_file *config_file,
struct t_config_section *section,
- char *option_name,
- char *value),
- char *function_create_option)
+ const char *option_name,
+ const char *value),
+ const char *function_create_option)
{
struct t_script_callback *new_script_callback1, *new_script_callback2;
struct t_script_callback *new_script_callback3, *new_script_callback4;
@@ -288,19 +288,19 @@ script_api_config_new_option (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
struct t_config_file *config_file,
struct t_config_section *section,
- char *name, char *type,
- char *description, char *string_values,
- int min, int max, char *default_value,
+ const char *name, const char *type,
+ const char *description, const char *string_values,
+ int min, int max, const char *default_value,
void (*callback_check_value)(void *data,
struct t_config_option *option,
- char *value),
- char *function_check_value,
+ const char *value),
+ const char *function_check_value,
void (*callback_change)(void *data,
struct t_config_option *option),
- char *function_change,
+ const char *function_change,
void (*callback_delete)(void *data,
struct t_config_option *option),
- char *function_delete)
+ const char *function_delete)
{
struct t_script_callback *new_script_callback1, *new_script_callback2;
struct t_script_callback *new_script_callback3;
@@ -451,7 +451,7 @@ script_api_config_free (struct t_weechat_plugin *weechat_plugin,
void
script_api_printf (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
- struct t_gui_buffer *buffer, char *format, ...)
+ struct t_gui_buffer *buffer, const char *format, ...)
{
va_list argptr;
char *buf, *buf2;
@@ -481,7 +481,8 @@ void
script_api_printf_date_tags (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
struct t_gui_buffer *buffer,
- time_t date, char *tags, char *format, ...)
+ time_t date, const char *tags,
+ const char *format, ...)
{
va_list argptr;
char *buf, *buf2;
@@ -512,7 +513,7 @@ void
script_api_printf_y (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
struct t_gui_buffer *buffer, int y,
- char *format, ...)
+ const char *format, ...)
{
va_list argptr;
char *buf, *buf2;
@@ -541,8 +542,8 @@ script_api_printf_y (struct t_weechat_plugin *weechat_plugin,
void
script_api_infobar_printf (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
- int delay, char *color_name,
- char *format, ...)
+ int delay, const char *color_name,
+ const char *format, ...)
{
va_list argptr;
char buf[1024];
@@ -566,7 +567,7 @@ script_api_infobar_printf (struct t_weechat_plugin *weechat_plugin,
void
script_api_log_printf (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
- char *format, ...)
+ const char *format, ...)
{
va_list argptr;
char *buf, *buf2;
@@ -594,14 +595,14 @@ script_api_log_printf (struct t_weechat_plugin *weechat_plugin,
struct t_hook *
script_api_hook_command (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
- char *command, char *description,
- char *args, char *args_description,
- char *completion,
+ const char *command, const char *description,
+ const char *args, const char *args_description,
+ const char *completion,
int (*callback)(void *data,
struct t_gui_buffer *buffer,
int argc, char **argv,
char **argv_eol),
- char *function)
+ const char *function)
{
struct t_script_callback *new_script_callback;
struct t_hook *new_hook;
@@ -639,7 +640,7 @@ script_api_hook_timer (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
int interval, int align_second, int max_calls,
int (*callback)(void *data),
- char *function)
+ const char *function)
{
struct t_script_callback *new_script_callback;
struct t_hook *new_hook;
@@ -677,7 +678,7 @@ script_api_hook_fd (struct t_weechat_plugin *weechat_plugin,
int fd, int flag_read, int flag_write,
int flag_exception,
int (*callback)(void *data),
- char *function)
+ const char *function)
{
struct t_script_callback *new_script_callback;
struct t_hook *new_hook;
@@ -713,13 +714,14 @@ struct t_hook *
script_api_hook_print (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
struct t_gui_buffer *buffer,
- char *tags, char *message, int strip_colors,
+ const char *tags, const char *message, int strip_colors,
int (*callback)(void *data,
struct t_gui_buffer *buffer,
time_t date,
int tags_count, char **tags,
- char *prefix, char *message),
- char *function)
+ const char *prefix,
+ const char *message),
+ const char *function)
{
struct t_script_callback *new_script_callback;
struct t_hook *new_hook;
@@ -754,11 +756,11 @@ script_api_hook_print (struct t_weechat_plugin *weechat_plugin,
struct t_hook *
script_api_hook_signal (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
- char *signal,
- int (*callback)(void *data, char *signal,
- char *type_data,
+ const char *signal,
+ int (*callback)(void *data, const char *signal,
+ const char *type_data,
void *signal_data),
- char *function)
+ const char *function)
{
struct t_script_callback *new_script_callback;
struct t_hook *new_hook;
@@ -792,10 +794,10 @@ script_api_hook_signal (struct t_weechat_plugin *weechat_plugin,
struct t_hook *
script_api_hook_config (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
- char *option,
- int (*callback)(void *data, char *option,
- char *value),
- char *function)
+ const char *option,
+ int (*callback)(void *data, const char *option,
+ const char *value),
+ const char *function)
{
struct t_script_callback *new_script_callback;
struct t_hook *new_hook;
@@ -829,11 +831,11 @@ script_api_hook_config (struct t_weechat_plugin *weechat_plugin,
struct t_hook *
script_api_hook_completion (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
- char *completion,
- int (*callback)(void *data, char *completion,
+ const char *completion,
+ int (*callback)(void *data, const char *completion,
struct t_gui_buffer *buffer,
struct t_weelist *list),
- char *function)
+ const char *function)
{
struct t_script_callback *new_script_callback;
struct t_hook *new_hook;
@@ -867,10 +869,11 @@ script_api_hook_completion (struct t_weechat_plugin *weechat_plugin,
struct t_hook *
script_api_hook_modifier (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
- char *modifier,
- char *(*callback)(void *data, char *modifier,
- char *modifier_data, char *string),
- char *function)
+ const char *modifier,
+ char *(*callback)(void *data, const char *modifier,
+ const char *modifier_data,
+ const char *string),
+ const char *function)
{
struct t_script_callback *new_script_callback;
struct t_hook *new_hook;
@@ -951,14 +954,14 @@ script_api_unhook_all (struct t_plugin_script *script)
struct t_gui_buffer *
script_api_buffer_new (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
- char *category, char *name,
+ const char *category, const char *name,
int (*input_callback)(void *data,
struct t_gui_buffer *buffer,
- char *input_data),
- char *function_input,
+ const char *input_data),
+ const char *function_input,
int (*close_callback)(void *data,
struct t_gui_buffer *buffer),
- char *function_close)
+ const char *function_close)
{
struct t_script_callback *new_script_callback_input;
struct t_script_callback *new_script_callback_close;
@@ -1071,13 +1074,13 @@ script_api_buffer_close (struct t_weechat_plugin *weechat_plugin,
struct t_gui_bar_item *
script_api_bar_item_new (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
- char *name,
+ const char *name,
char *(*build_callback)(void *data,
struct t_gui_bar_item *item,
struct t_gui_window *window,
int max_width,
int max_height),
- char *function_build)
+ const char *function_build)
{
struct t_script_callback *new_script_callback;
struct t_gui_bar_item *new_item;
@@ -1143,7 +1146,7 @@ script_api_bar_item_remove (struct t_weechat_plugin *weechat_plugin,
void
script_api_command (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
- struct t_gui_buffer *buffer, char *command)
+ struct t_gui_buffer *buffer, const char *command)
{
char *command2;
@@ -1164,7 +1167,7 @@ script_api_command (struct t_weechat_plugin *weechat_plugin,
char *
script_api_config_get_plugin (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
- char *option)
+ const char *option)
{
char *option_fullname, *return_value;
@@ -1191,7 +1194,7 @@ script_api_config_get_plugin (struct t_weechat_plugin *weechat_plugin,
int
script_api_config_set_plugin (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
- char *option, char *value)
+ const char *option, const char *value)
{
char *option_fullname;
int return_code;
diff --git a/src/plugins/scripts/script-api.h b/src/plugins/scripts/script-api.h
index 9ba42c049..f9bc3dc2c 100644
--- a/src/plugins/scripts/script-api.h
+++ b/src/plugins/scripts/script-api.h
@@ -20,179 +20,179 @@
#define __WEECHAT_SCRIPT_API_H 1
extern void script_api_charset_set (struct t_plugin_script *script,
- char *charset);
+ const char *charset);
extern struct t_config_file *script_api_config_new (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
- char *name,
+ const char *name,
int (*callback_reload)(void *data,
struct t_config_file *config_file),
- char *function);
+ const char *function);
extern struct t_config_section *script_api_config_new_section (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
struct t_config_file *config_file,
- char *name,
+ const char *name,
int user_can_add_options,
int user_can_delete_options,
void (*callback_read)(void *data,
struct t_config_file *config_file,
- char *option_name,
- char *value),
- char *function_read,
+ const char *option_name,
+ const char *value),
+ const char *function_read,
void (*callback_write)(void *data,
struct t_config_file *config_file,
- char *section_name),
- char *function_write,
+ const char *section_name),
+ const char *function_write,
void (*callback_write_default)(void *data,
struct t_config_file *config_file,
- char *section_name),
- char *function_write_default,
+ const char *section_name),
+ const char *function_write_default,
int (*callback_create_option)(void *data,
struct t_config_file *config_file,
struct t_config_section *section,
- char *option_name,
- char *value),
- char *function_create_option);
+ const char *option_name,
+ const char *value),
+ const char *function_create_option);
extern struct t_config_option *script_api_config_new_option (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
struct t_config_file *config_file,
struct t_config_section *section,
- char *name,
- char *type,
- char *description,
- char *string_values,
+ const char *name,
+ const char *type,
+ const char *description,
+ const char *string_values,
int min, int max,
- char *default_value,
+ const char *default_value,
void (*callback_change)(void *data),
- char *function);
+ const char *function);
extern void script_api_config_free (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
struct t_config_file *config_file);
extern void script_api_printf (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
struct t_gui_buffer *buffer,
- char *format, ...);
+ const char *format, ...);
extern void script_api_printf_date_tags (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
struct t_gui_buffer *buffer,
- time_t date, char *tags,
- char *format, ...);
+ time_t date, const char *tags,
+ const char *format, ...);
extern void script_api_printf_y (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
struct t_gui_buffer *buffer,
- int y, char *format, ...);
+ int y, const char *format, ...);
extern void script_api_infobar_printf (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
- int delay, char *color_name,
- char *format, ...);
+ int delay, const char *color_name,
+ const char *format, ...);
extern void script_api_log_printf (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
- char *format, ...);
+ const char *format, ...);
extern struct t_hook *script_api_hook_command (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
- char *command, char *description,
- char *args, char *args_description,
- char *completion,
+ const char *command, const char *description,
+ const char *args, const char *args_description,
+ const char *completion,
int (*callback)(void *data,
struct t_gui_buffer *buffer,
int argc, char **argv,
char **argv_eol),
- char *function);
+ const char *function);
extern struct t_hook *script_api_hook_timer (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
int interval, int align_second,
int max_calls,
int (*callback)(void *data),
- char *function);
+ const char *function);
extern struct t_hook *script_api_hook_fd (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
int fd, int flag_read,
int flag_write, int flag_exception,
int (*callback)(void *data),
- char *function);
+ const char *function);
extern struct t_hook *script_api_hook_print (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
struct t_gui_buffer *buffer,
- char *tags,
- char *message,
+ const char *tags,
+ const char *message,
int strip_colors,
int (*callback)(void *data,
struct t_gui_buffer *buffer,
time_t date,
int tags_count,
char **tags,
- char *prefix,
- char *message),
- char *function);
+ const char *prefix,
+ const char *message),
+ const char *function);
extern struct t_hook *script_api_hook_signal (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
- char *signal,
+ const char *signal,
int (*callback)(void *data,
- char *signal,
- char *type_data,
+ const char *signal,
+ const char *type_data,
void *signal_data),
- char *function);
+ const char *function);
extern struct t_hook *script_api_hook_config (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
- char *option,
+ const char *option,
int (*callback)(void *data,
- char *option,
- char *value),
- char *function);
+ const char *option,
+ const char *value),
+ const char *function);
extern struct t_hook *script_api_hook_completion (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
- char *completion,
+ const char *completion,
int (*callback)(void *data,
- char *completion,
+ const char *completion,
struct t_gui_buffer *buffer,
struct t_weelist *list),
- char *function);
+ const char *function);
extern struct t_hook *script_api_hook_modifier (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
- char *modifier,
+ const char *modifier,
char *(*callback)(void *data,
- char *modifier,
- char *modifier_data,
- char *string),
- char *function);
+ const char *modifier,
+ const char *modifier_data,
+ const char *string),
+ const char *function);
extern void script_api_unhook (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
struct t_hook *hook);
extern void script_api_unhook_all (struct t_plugin_script *script);
extern struct t_gui_buffer *script_api_buffer_new (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
- char *category, char *name,
+ const char *category, const char *name,
int (*input_callback)(void *data,
struct t_gui_buffer *buffer,
- char *input_data),
- char *function_input,
+ const char *input_data),
+ const char *function_input,
int (*close_callback)(void *data,
struct t_gui_buffer *buffer),
- char *function_close);
+ const char *function_close);
extern void script_api_buffer_close (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
struct t_gui_buffer *buffer,
int switch_to_another);
extern struct t_gui_bar_item *script_api_bar_item_new (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
- char *name,
+ const char *name,
char *(*build_callback)(void *data,
struct t_gui_bar_item *item,
struct t_gui_window *window,
int max_width,
int max_height),
- char *function_build);
+ const char *function_build);
extern void script_api_bar_item_remove (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
struct t_gui_bar_item *item);
extern void script_api_command (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
struct t_gui_buffer *buffer,
- char *command);
+ const char *command);
extern char *script_api_config_get_plugin (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
- char *option);
+ const char *option);
extern int script_api_config_set_plugin (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
- char *option, char *value);
+ const char *option, const char *value);
#endif /* script-api.h */
diff --git a/src/plugins/scripts/script.c b/src/plugins/scripts/script.c
index 12dc1ec9d..869d95e55 100644
--- a/src/plugins/scripts/script.c
+++ b/src/plugins/scripts/script.c
@@ -63,7 +63,7 @@ script_config_read (struct t_weechat_plugin *weechat_plugin)
*/
int
-script_config_cb (void *data, char *option, char *value)
+script_config_cb (void *data, const char *option, const char *value)
{
/* make C compiler happy */
(void) option;
@@ -84,16 +84,16 @@ script_init (struct t_weechat_plugin *weechat_plugin,
struct t_gui_buffer *buffer,
int argc, char **argv,
char **argv_eol),
- int (*callback_completion)(void *data, char *completion,
+ int (*callback_completion)(void *data, const char *completion,
struct t_gui_buffer *buffer,
struct t_weelist *list),
- int (*callback_signal_debug_dump)(void *data, char *signal,
- char *type_data,
+ int (*callback_signal_debug_dump)(void *data, const char *signal,
+ const char *type_data,
void *signal_data),
- int (*callback_signal_buffer_closed)(void *data, char *signal,
- char *type_data,
+ int (*callback_signal_buffer_closed)(void *data, const char *signal,
+ const char *type_data,
void *signal_data),
- int (*callback_load_file)(void *data, char *filename))
+ int (*callback_load_file)(void *data, const char *filename))
{
char *string, *completion = "list|listfull|load|autoload|reload|unload %f";
int length;
@@ -190,7 +190,7 @@ script_ptr2str (void *pointer)
*/
void *
-script_str2ptr (char *pointer_str)
+script_str2ptr (const char *pointer_str)
{
unsigned int value;
@@ -208,7 +208,7 @@ script_str2ptr (char *pointer_str)
void
script_auto_load (struct t_weechat_plugin *weechat_plugin,
- int (*callback)(void *data, char *filename))
+ int (*callback)(void *data, const char *filename))
{
char *dir_home, *dir_name;
int dir_length;
@@ -235,7 +235,7 @@ script_auto_load (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *
script_search (struct t_weechat_plugin *weechat_plugin,
- struct t_plugin_script *scripts, char *name)
+ struct t_plugin_script *scripts, const char *name)
{
struct t_plugin_script *ptr_script;
@@ -256,7 +256,7 @@ script_search (struct t_weechat_plugin *weechat_plugin,
char *
script_search_full_name (struct t_weechat_plugin *weechat_plugin,
- char *filename)
+ const char *filename)
{
char *final_name, *dir_home, *dir_system;
int length;
@@ -347,9 +347,9 @@ script_search_full_name (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *
script_add (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script **scripts,
- char *filename, char *name, char *author, char *version,
- char *license, char *description, char *shutdown_func,
- char *charset)
+ const char *filename, const char *name, const char *author, const char *version,
+ const char *license, const char *description, const char *shutdown_func,
+ const char *charset)
{
struct t_plugin_script *new_script;
@@ -544,7 +544,7 @@ script_completion (struct t_weechat_plugin *weechat_plugin,
void
script_display_list (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *scripts,
- char *name, int full)
+ const char *name, int full)
{
struct t_plugin_script *ptr_script;
diff --git a/src/plugins/scripts/script.h b/src/plugins/scripts/script.h
index e189929d1..0ff89b541 100644
--- a/src/plugins/scripts/script.h
+++ b/src/plugins/scripts/script.h
@@ -61,33 +61,33 @@ extern void script_init (struct t_weechat_plugin *weechat_plugin,
struct t_gui_buffer *buffer,
int argc, char **argv,
char **argv_eol),
- int (*callback_completion)(void *data, char *completion,
+ int (*callback_completion)(void *data, const char *completion,
struct t_gui_buffer *buffer,
struct t_weelist *list),
int (*callback_signal_debug_dump)(void *data,
- char *signal,
- char *type_data,
+ const char *signal,
+ const char *type_data,
void *signal_data),
int (*callback_signal_buffer_closed)(void *data,
- char *signal,
- char *type_data,
+ const char *signal,
+ const char *type_data,
void *signal_data),
- int (*callback_load_file)(void *data, char *filename));
+ int (*callback_load_file)(void *data, const char *filename));
extern char *script_ptr2str (void *pointer);
-extern void *script_str2ptr (char *pointer_str);
+extern void *script_str2ptr (const char *pointer_str);
extern void script_auto_load (struct t_weechat_plugin *weechat_plugin,
- int (*callback)(void *data, char *filename));
+ int (*callback)(void *data, const char *filename));
extern struct t_plugin_script *script_search (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *scripts,
- char *name);
+ const char *name);
extern char *script_search_full_name (struct t_weechat_plugin *weechat_plugin,
- char *filename);
+ const char *filename);
extern struct t_plugin_script *script_add (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script **scripts,
- char *filename, char *name,
- char *author, char *version,
- char *license, char *description,
- char *shutdown_func, char *charset);
+ const char *filename, const char *name,
+ const char *author, const char *version,
+ const char *license, const char *description,
+ const char *shutdown_func, const char *charset);
extern void script_remove_buffer_callbacks (struct t_plugin_script *scripts,
struct t_gui_buffer *buffer);
extern void script_remove (struct t_weechat_plugin *weechat_plugin,
@@ -98,7 +98,7 @@ extern void script_completion (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *scripts);
extern void script_display_list (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *scripts,
- char *name, int full);
+ const char *name, int full);
extern void script_print_log (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *scripts);
diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h
index fe0232ef8..b60f62751 100644
--- a/src/plugins/weechat-plugin.h
+++ b/src/plugins/weechat-plugin.h
@@ -118,53 +118,57 @@ struct t_weechat_plugin
existing plugins */
/* strings */
- void (*charset_set) (struct t_weechat_plugin *plugin, char *charset);
- char *(*iconv_to_internal) (char *charset, char *string);
- char *(*iconv_from_internal) (char *charset, char *string);
- char *(*gettext) (char *string);
- char *(*ngettext) (char *single, char *plural, int count);
- char *(*strndup) (char *string, int length);
+ void (*charset_set) (struct t_weechat_plugin *plugin, const char *charset);
+ char *(*iconv_to_internal) (const char *charset, const char *string);
+ char *(*iconv_from_internal) (const char *charset, const char *string);
+ char *(*gettext) (const char *string);
+ char *(*ngettext) (const char *single, const char *plural, int count);
+ char *(*strndup) (const char *string, int length);
void (*string_tolower) (char *string);
void (*string_toupper) (char *string);
- int (*strcasecmp) (char *string1, char *string2);
- int (*strncasecmp) (char *string1, char *string2, int max);
- int (*strcmp_ignore_chars) (char *string1, char *string2,
- char *chars_ignored, int case_sensitive);
- char *(*strcasestr) (char *string1, char *string2);
- int (*string_match) (char *string, char *mask, int case_sensitive);
- char *(*string_replace) (char *string, char *search, char *replace);
- char *(*string_remove_quotes) (char *string, char *quotes);
- char *(*string_strip) (char *string, int left, int right, char *chars);
- int (*string_has_highlight) (char *string, char *highlight_words);
- char **(*string_explode) (char *string, char *separators, int keep_eol,
- int num_items_max, int *num_items);
+ int (*strcasecmp) (const char *string1, const char *string2);
+ int (*strncasecmp) (const char *string1, const char *string2, int max);
+ int (*strcmp_ignore_chars) (const char *string1, const char *string2,
+ const char *chars_ignored, int case_sensitive);
+ char *(*strcasestr) (const char *string1, const char *string2);
+ int (*string_match) (const char *string, const char *mask,
+ int case_sensitive);
+ char *(*string_replace) (const char *string, const char *search,
+ const char *replace);
+ char *(*string_remove_quotes) (const char *string, const char *quotes);
+ char *(*string_strip) (const char *string, int left, int right,
+ const char *chars);
+ int (*string_has_highlight) (const char *string,
+ const char *highlight_words);
+ char **(*string_explode) (const char *string, const char *separators,
+ int keep_eol, int num_items_max, int *num_items);
void (*string_free_exploded) (char **exploded_string);
char *(*string_build_with_exploded) (char **exploded_string,
- char *separator);
- char **(*string_split_command) (char *command, char separator);
+ const char *separator);
+ char **(*string_split_command) (const char *command, char separator);
void (*string_free_splitted_command) (char **splitted_command);
/* UTF-8 strings */
- int (*utf8_has_8bits) (char *string);
- int (*utf8_is_valid) (char *string, char **error);
- void (*utf8_normalize) (char *string, char replacement);
- char *(*utf8_prev_char) (char *string_start, char *string);
- char *(*utf8_next_char) (char *string);
- int (*utf8_char_size) (char *string);
- int (*utf8_strlen) (char *string);
- int (*utf8_strnlen) (char *string, int bytes);
- int (*utf8_strlen_screen) (char *string);
- int (*utf8_charcasecmp) (char *string1, char *string2);
- int (*utf8_char_size_screen) (char *string);
- char *(*utf8_add_offset) (char *string, int offset);
- int (*utf8_real_pos) (char *string, int pos);
- int (*utf8_pos) (char *string, int real_pos);
+ int (*utf8_has_8bits) (const char *string);
+ int (*utf8_is_valid) (const char *string, char **error);
+ void (*utf8_normalize) (const char *string, char replacement);
+ char *(*utf8_prev_char) (const char *string_start, const char *string);
+ char *(*utf8_next_char) (const char *string);
+ int (*utf8_char_size) (const char *string);
+ int (*utf8_strlen) (const char *string);
+ int (*utf8_strnlen) (const char *string, int bytes);
+ int (*utf8_strlen_screen) (const char *string);
+ int (*utf8_charcasecmp) (const char *string1, const char *string2);
+ int (*utf8_char_size_screen) (const char *string);
+ char *(*utf8_add_offset) (const char *string, int offset);
+ int (*utf8_real_pos) (const char *string, int pos);
+ int (*utf8_pos) (const char *string, int real_pos);
/* directories */
- int (*mkdir_home) (char *directory, int mode);
- int (*mkdir) (char *directory, int mode);
- void (*exec_on_files) (char *directory, void *data,
- int (*callback)(void *data, char *filename));
+ int (*mkdir_home) (const char *directory, int mode);
+ int (*mkdir) (const char *directory, int mode);
+ void (*exec_on_files) (const char *directory, void *data,
+ int (*callback)(void *data, const char *filename));
/* util */
int (*timeval_cmp) (struct timeval *tv1, struct timeval *tv2);
@@ -173,15 +177,15 @@ struct t_weechat_plugin
/* sorted list */
struct t_weelist *(*list_new) ();
- struct t_weelist_item *(*list_add) (struct t_weelist *weelist, char *data,
- char *where);
+ struct t_weelist_item *(*list_add) (struct t_weelist *weelist, const char *data,
+ const char *where);
struct t_weelist_item *(*list_search) (struct t_weelist *weelist,
- char *data);
+ const char *data);
struct t_weelist_item *(*list_casesearch) (struct t_weelist *weelist,
- char *data);
+ const char *data);
struct t_weelist_item *(*list_get) (struct t_weelist *weelist,
int position);
- void (*list_set) (struct t_weelist_item *item, char *value);
+ void (*list_set) (struct t_weelist_item *item, const char *value);
struct t_weelist_item *(*list_next) (struct t_weelist_item *item);
struct t_weelist_item *(*list_prev) (struct t_weelist_item *item);
char *(*list_string) (struct t_weelist_item *item);
@@ -193,46 +197,46 @@ struct t_weechat_plugin
/* config files */
struct t_config_file *(*config_new) (struct t_weechat_plugin *plugin,
- char *name,
+ const char *name,
int (*callback_reload)(void *data,
struct t_config_file *config_file),
void *callback_reload_data);
struct t_config_section *(*config_new_section) (struct t_config_file *config_file,
- char *name,
+ const char *name,
int user_can_add_options,
int user_can_delete_options,
int (*callback_read)(void *data,
struct t_config_file *config_file,
struct t_config_section *section,
- char *option_name,
- char *value),
+ const char *option_name,
+ const char *value),
void *callback_read_data,
void (*callback_write)(void *data,
struct t_config_file *config_file,
- char *section_name),
+ const char *section_name),
void *callback_write_data,
void (*callback_write_default)(void *data,
struct t_config_file *config_file,
- char *section_name),
+ const char *section_name),
void *callback_write_default_data,
int (*callback_create_option)(void *data,
struct t_config_file *config_file,
struct t_config_section *section,
- char *option_name,
- char *value),
+ const char *option_name,
+ const char *value),
void *callback_create_option_data);
struct t_config_section *(*config_search_section) (struct t_config_file *config_file,
- char *section_name);
+ const char *section_name);
struct t_config_option *(*config_new_option) (struct t_config_file *config_file,
struct t_config_section *section,
- char *name, char *type,
- char *description,
- char *string_values,
+ const char *name, const char *type,
+ const char *description,
+ const char *string_values,
int min, int max,
- char *default_value,
+ const char *default_value,
int (*callback_check_value)(void *data,
struct t_config_option *option,
- char *value),
+ const char *value),
void *callback_check_value_data,
void (*callback_change)(void *data,
struct t_config_option *option),
@@ -242,32 +246,32 @@ struct t_weechat_plugin
void *callback_delete_data);
struct t_config_option *(*config_search_option) (struct t_config_file *config_file,
struct t_config_section *section,
- char *option_name);
+ const char *option_name);
void (*config_search_section_option) (struct t_config_file *config_file,
struct t_config_section *section,
- char *option_name,
+ const char *option_name,
struct t_config_section **section_found,
struct t_config_option **option_found);
- void (*config_search_with_string) (char *option_name,
+ void (*config_search_with_string) (const char *option_name,
struct t_config_file **config_file,
struct t_config_section **section,
struct t_config_option **option,
char **pos_option_name);
- int (*config_string_to_boolean) (char *text);
+ int (*config_string_to_boolean) (const char *text);
int (*config_option_reset) (struct t_config_option *option,
int run_callback);
- int (*config_option_set) (struct t_config_option *option, char *value,
+ int (*config_option_set) (struct t_config_option *option, const char *value,
int run_callback);
void (*config_option_rename) (struct t_config_option *option,
- char *new_name);
+ const char *new_name);
void *(*config_option_get_pointer) (struct t_config_option *option,
- char *property);
+ const char *property);
int (*config_boolean) (struct t_config_option *option);
int (*config_integer) (struct t_config_option *option);
char *(*config_string) (struct t_config_option *option);
int (*config_color) (struct t_config_option *option);
void (*config_write_line) (struct t_config_file *config_file,
- char *option_name, char *value, ...);
+ const char *option_name, const char *value, ...);
int (*config_write) (struct t_config_file *config_file);
int (*config_read) (struct t_config_file *config_file);
int (*config_reload) (struct t_config_file *config_file);
@@ -276,29 +280,29 @@ struct t_weechat_plugin
void (*config_section_free) (struct t_config_file *config_file,
struct t_config_section *section);
void (*config_free) (struct t_config_file *config_file);
- struct t_config_option *(*config_get) (char *option_name);
+ struct t_config_option *(*config_get) (const char *option_name);
char *(*config_get_plugin) (struct t_weechat_plugin *plugin,
- char *option_name);
+ const char *option_name);
int (*config_set_plugin) (struct t_weechat_plugin *plugin,
- char *option_name, char *value);
+ const char *option_name, const char *value);
/* display */
- char *(*prefix) (char *prefix);
- char *(*color) (char *color_name);
+ char *(*prefix) (const char *prefix);
+ char *(*color) (const char *color_name);
void (*printf_date_tags) (struct t_gui_buffer *buffer, time_t date,
- char *tags, char *message, ...);
+ const char *tags, const char *message, ...);
void (*printf_y) (struct t_gui_buffer *buffer, int y,
- char *message, ...);
+ const char *message, ...);
void (*infobar_printf) (struct t_weechat_plugin *plugin, int delay,
- char *color_name, char *format, ...);
+ const char *color_name, const char *format, ...);
void (*infobar_remove) (int how_many);
- void (*log_printf) (char *message, ...);
+ void (*log_printf) (const char *message, ...);
/* hooks */
struct t_hook *(*hook_command) (struct t_weechat_plugin *plugin,
- char *command, char *description,
- char *args, char *args_description,
- char *completion,
+ const char *command, const char *description,
+ const char *args, const char *args_description,
+ const char *completion,
int (*callback)(void *data,
struct t_gui_buffer *buffer,
int argc, char **argv,
@@ -315,89 +319,89 @@ struct t_weechat_plugin
int (*callback)(void *data),
void *callback_data);
struct t_hook *(*hook_connect) (struct t_weechat_plugin *plugin,
- char *address, int port,
+ const char *address, int port,
int sock, int ipv6, void *gnutls_sess,
- char *local_hostname,
+ const char *local_hostname,
int (*callback)(void *data, int status),
void *callback_data);
struct t_hook *(*hook_print) (struct t_weechat_plugin *plugin,
struct t_gui_buffer *buffer,
- char *tags, char *message,
+ const char *tags, const char *message,
int strip_colors,
int (*callback)(void *data,
struct t_gui_buffer *buffer,
time_t date,
int tags_count,
char **tags,
- char *prefix, char *message),
+ const char *prefix, const char *message),
void *callback_data);
struct t_hook *(*hook_signal) (struct t_weechat_plugin *plugin,
- char *signal,
- int (*callback)(void *data, char *signal,
- char *type_data,
+ const char *signal,
+ int (*callback)(void *data, const char *signal,
+ const char *type_data,
void *signal_data),
void *callback_data);
- void (*hook_signal_send) (char *signal, char *type_data,
+ void (*hook_signal_send) (const char *signal, const char *type_data,
void *signal_data);
struct t_hook *(*hook_config) (struct t_weechat_plugin *plugin,
- char *option,
- int (*callback)(void *data, char *option,
- char *value),
+ const char *option,
+ int (*callback)(void *data, const char *option,
+ const char *value),
void *callback_data);
struct t_hook *(*hook_completion) (struct t_weechat_plugin *plugin,
- char *completion,
+ const char *completion,
int (*callback)(void *data,
- char *completion,
+ const char *completion,
struct t_gui_buffer *buffer,
struct t_weelist *list),
void *callback_data);
struct t_hook *(*hook_modifier) (struct t_weechat_plugin *plugin,
- char *modifier,
+ const char *modifier,
char *(*callback)(void *data,
- char *modifier,
- char *modifier_data,
- char *string),
+ const char *modifier,
+ const char *modifier_data,
+ const char *string),
void *callback_data);
char *(*hook_modifier_exec) (struct t_weechat_plugin *plugin,
- char *modifier, char *modifier_data,
- char *string);
+ const char *modifier, const char *modifier_data,
+ const char *string);
void (*unhook) (struct t_hook *hook);
void (*unhook_all) (struct t_weechat_plugin *plugin);
/* buffers */
struct t_gui_buffer *(*buffer_new) (struct t_weechat_plugin *plugin,
- char *category, char *name,
+ const char *category, const char *name,
int (*input_callback)(void *data,
struct t_gui_buffer *buffer,
- char *input_data),
+ const char *input_data),
void *input_callback_data,
int (*close_callback)(void *data,
struct t_gui_buffer *buffer),
void *close_callback_data);
- struct t_gui_buffer *(*buffer_search) (char *category, char *name);
+ struct t_gui_buffer *(*buffer_search) (const char *category, const char *name);
void (*buffer_clear) (struct t_gui_buffer *buffer);
void (*buffer_close) (struct t_gui_buffer *buffer, int switch_to_another);
- char *(*buffer_get_string) (struct t_gui_buffer *buffer, char *property);
- void *(*buffer_get_pointer) (struct t_gui_buffer *buffer, char *property);
- void (*buffer_set) (struct t_gui_buffer *buffer, char *property,
- char *value);
+ char *(*buffer_get_string) (struct t_gui_buffer *buffer, const char *property);
+ void *(*buffer_get_pointer) (struct t_gui_buffer *buffer, const char *property);
+ void (*buffer_set) (struct t_gui_buffer *buffer, const char *property,
+ const char *value);
/* nicklist */
struct t_gui_nick_group *(*nicklist_add_group) (struct t_gui_buffer *buffer,
struct t_gui_nick_group *parent_group,
- char *name, char *color,
+ const char *name, const char *color,
int visible);
struct t_gui_nick_group *(*nicklist_search_group) (struct t_gui_buffer *buffer,
struct t_gui_nick_group *from_group,
- char *name);
+ const char *name);
struct t_gui_nick *(*nicklist_add_nick) (struct t_gui_buffer *buffer,
struct t_gui_nick_group *group,
- char *name, char *color,
- char prefix, char *prefix_color,
+ const char *name, const char *color,
+ char prefix, const char *prefix_color,
int visible);
struct t_gui_nick *(*nicklist_search_nick) (struct t_gui_buffer *buffer,
struct t_gui_nick_group *from_group,
- char *name);
+ const char *name);
void (*nicklist_remove_group) (struct t_gui_buffer *buffer,
struct t_gui_nick_group *group);
void (*nicklist_remove_nick) (struct t_gui_buffer *buffer,
@@ -405,62 +409,62 @@ struct t_weechat_plugin
void (*nicklist_remove_all) (struct t_gui_buffer *buffer);
/* bars */
- struct t_gui_bar_item *(*bar_item_search) (char *name);
+ struct t_gui_bar_item *(*bar_item_search) (const char *name);
struct t_gui_bar_item *(*bar_item_new) (struct t_weechat_plugin *plugin,
- char *name,
+ const char *name,
char *(*build_callback)(void *data,
struct t_gui_bar_item *item,
struct t_gui_window *window,
int max_width, int max_height),
void *build_callback_data);
- void (*bar_item_update) (char *name);
+ void (*bar_item_update) (const char *name);
void (*bar_item_remove) (struct t_gui_bar_item *item);
- struct t_gui_bar *(*bar_search) (char *name);
- struct t_gui_bar *(*bar_new) (struct t_weechat_plugin *plugin, char *name,
- char *priority, char *type, char *condition,
- char *position, char *filling, char *size,
- char *size_max, char *color_fg,
- char *color_bg, char *separator,
- char *items);
- int (*bar_set) (struct t_gui_bar *bar, char *property, char *value);
- void (*bar_update) (char *name);
+ struct t_gui_bar *(*bar_search) (const char *name);
+ struct t_gui_bar *(*bar_new) (struct t_weechat_plugin *plugin, const char *name,
+ const char *priority, const char *type, const char *condition,
+ const char *position, const char *filling, const char *size,
+ const char *size_max, const char *color_fg,
+ const char *color_bg, const char *separator,
+ const char *items);
+ int (*bar_set) (struct t_gui_bar *bar, const char *property, const char *value);
+ void (*bar_update) (const char *name);
void (*bar_remove) (struct t_gui_bar *bar);
/* command */
void (*command) (struct t_weechat_plugin *plugin,
- struct t_gui_buffer *buffer, char *command);
+ struct t_gui_buffer *buffer, const char *command);
/* network */
- int (*network_pass_proxy) (int sock, char *address, int port);
+ int (*network_pass_proxy) (int sock, const char *address, int port);
int (*network_connect_to) (int sock, unsigned long address, int port);
/* infos */
- char *(*info_get) (struct t_weechat_plugin *plugin, char *info);
+ char *(*info_get) (struct t_weechat_plugin *plugin, const char *info);
/* infolists */
struct t_plugin_infolist *(*infolist_new) ();
struct t_plugin_infolist_item *(*infolist_new_item) (struct t_plugin_infolist *list);
struct t_plugin_infolist_var *(*infolist_new_var_integer) (struct t_plugin_infolist_item *item,
- char *name,
+ const char *name,
int value);
struct t_plugin_infolist_var *(*infolist_new_var_string) (struct t_plugin_infolist_item *item,
- char *name,
- char *value);
+ const char *name,
+ const char *value);
struct t_plugin_infolist_var *(*infolist_new_var_pointer) (struct t_plugin_infolist_item *item,
- char *name,
+ const char *name,
void *pointer);
struct t_plugin_infolist_var *(*infolist_new_var_time) (struct t_plugin_infolist_item *item,
- char *name,
+ const char *name,
time_t time);
- struct t_plugin_infolist *(*infolist_get) (char *name, void *pointer,
- char *arguments);
+ struct t_plugin_infolist *(*infolist_get) (const char *name, void *pointer,
+ const char *arguments);
int (*infolist_next) (struct t_plugin_infolist *infolist);
int (*infolist_prev) (struct t_plugin_infolist *infolist);
char *(*infolist_fields) (struct t_plugin_infolist *infolist);
- int (*infolist_integer) (struct t_plugin_infolist *infolist, char *var);
- char *(*infolist_string) (struct t_plugin_infolist *infolist, char *var);
- void *(*infolist_pointer) (struct t_plugin_infolist *infolist, char *var);
- time_t (*infolist_time) (struct t_plugin_infolist *infolist, char *var);
+ int (*infolist_integer) (struct t_plugin_infolist *infolist, const char *var);
+ char *(*infolist_string) (struct t_plugin_infolist *infolist, const char *var);
+ void *(*infolist_pointer) (struct t_plugin_infolist *infolist, const char *var);
+ time_t (*infolist_time) (struct t_plugin_infolist *infolist, const char *var);
void (*infolist_free) (struct t_plugin_infolist *infolist);
/* WeeChat developers: ALWAYS add new functions at the end */
diff --git a/src/plugins/xfer/xfer-buffer.c b/src/plugins/xfer/xfer-buffer.c
index ab43e52bf..6e7869e0d 100644
--- a/src/plugins/xfer/xfer-buffer.c
+++ b/src/plugins/xfer/xfer-buffer.c
@@ -39,7 +39,7 @@ int xfer_buffer_selected_line = 0;
*/
void
-xfer_buffer_refresh (char *hotlist)
+xfer_buffer_refresh (const char *hotlist)
{
struct t_xfer *ptr_xfer, *xfer_selected;
char str_color[256], suffix[32], status[64], date[128], *progress_bar;
@@ -256,7 +256,7 @@ xfer_buffer_refresh (char *hotlist)
int
xfer_buffer_input_cb (void *data, struct t_gui_buffer *buffer,
- char *input_data)
+ const char *input_data)
{
struct t_xfer *xfer, *ptr_xfer, *next_xfer;
diff --git a/src/plugins/xfer/xfer-buffer.h b/src/plugins/xfer/xfer-buffer.h
index 22f26ce76..de4cc7cfd 100644
--- a/src/plugins/xfer/xfer-buffer.h
+++ b/src/plugins/xfer/xfer-buffer.h
@@ -23,7 +23,7 @@
extern struct t_gui_buffer *xfer_buffer;
extern int xfer_buffer_selected_line;
-extern void xfer_buffer_refresh (char *hotlist);
+extern void xfer_buffer_refresh (const char *hotlist);
extern void xfer_buffer_open ();
#endif /* xfer-buffer.h */
diff --git a/src/plugins/xfer/xfer-chat.c b/src/plugins/xfer/xfer-chat.c
index 2dab0a2c8..6e77829fe 100644
--- a/src/plugins/xfer/xfer-chat.c
+++ b/src/plugins/xfer/xfer-chat.c
@@ -37,7 +37,7 @@
*/
int
-xfer_chat_send (struct t_xfer *xfer, char *buffer, int size_buf)
+xfer_chat_send (struct t_xfer *xfer, const char *buffer, int size_buf)
{
if (!xfer)
return -1;
@@ -50,7 +50,7 @@ xfer_chat_send (struct t_xfer *xfer, char *buffer, int size_buf)
*/
void
-xfer_chat_sendf (struct t_xfer *xfer, char *format, ...)
+xfer_chat_sendf (struct t_xfer *xfer, const char *format, ...)
{
va_list args;
static char buffer[4096];
@@ -157,7 +157,7 @@ xfer_chat_recv_cb (void *arg_xfer)
int
xfer_chat_buffer_input_cb (void *data, struct t_gui_buffer *buffer,
- char *input_data)
+ const char *input_data)
{
struct t_xfer *xfer;
diff --git a/src/plugins/xfer/xfer-file.c b/src/plugins/xfer/xfer-file.c
index 5e4841c54..625013e94 100644
--- a/src/plugins/xfer/xfer-file.c
+++ b/src/plugins/xfer/xfer-file.c
@@ -42,7 +42,7 @@
*/
int
-xfer_file_resume (struct t_xfer *xfer, char *filename)
+xfer_file_resume (struct t_xfer *xfer, const char *filename)
{
struct stat st;
diff --git a/src/plugins/xfer/xfer-file.h b/src/plugins/xfer/xfer-file.h
index 3158507a5..78d0eeaa7 100644
--- a/src/plugins/xfer/xfer-file.h
+++ b/src/plugins/xfer/xfer-file.h
@@ -20,7 +20,7 @@
#ifndef __WEECHAT_XFER_FILE_H
#define __WEECHAT_XFER_FILE_H 1
-extern int xfer_file_resume (struct t_xfer *xfer, char *filename);
+extern int xfer_file_resume (struct t_xfer *xfer, const char *filename);
extern void xfer_file_find_filename (struct t_xfer *xfer);
extern void xfer_file_calculate_speed (struct t_xfer *xfer, int ended);
diff --git a/src/plugins/xfer/xfer.c b/src/plugins/xfer/xfer.c
index a6d558773..6452827f4 100644
--- a/src/plugins/xfer/xfer.c
+++ b/src/plugins/xfer/xfer.c
@@ -102,7 +102,7 @@ xfer_create_directories ()
*/
int
-xfer_search_type (char *type)
+xfer_search_type (const char *type)
{
int i;
@@ -122,7 +122,7 @@ xfer_search_type (char *type)
*/
int
-xfer_search_protocol (char *protocol)
+xfer_search_protocol (const char *protocol)
{
int i;
@@ -141,7 +141,7 @@ xfer_search_protocol (char *protocol)
*/
struct t_xfer *
-xfer_search (char *plugin_name, char *plugin_id, enum t_xfer_type type,
+xfer_search (const char *plugin_name, const char *plugin_id, enum t_xfer_type type,
enum t_xfer_status status, int port)
{
struct t_xfer *ptr_xfer;
@@ -294,7 +294,7 @@ xfer_port_in_use (int port)
*/
void
-xfer_send_signal (struct t_xfer *xfer, char *signal)
+xfer_send_signal (struct t_xfer *xfer, const char *signal)
{
struct t_plugin_infolist *infolist;
struct t_plugin_infolist_item *item;
@@ -408,11 +408,11 @@ xfer_alloc ()
*/
struct t_xfer *
-xfer_new (char *plugin_name, char *plugin_id, enum t_xfer_type type,
- enum t_xfer_protocol protocol, char *remote_nick, char *local_nick,
- char *filename,
+xfer_new (const char *plugin_name, const char *plugin_id, enum t_xfer_type type,
+ enum t_xfer_protocol protocol, const char *remote_nick, const char *local_nick,
+ const char *filename,
unsigned long size, unsigned long address, int port, int sock,
- char *local_filename)
+ const char *local_filename)
{
struct t_xfer *new_xfer;
@@ -605,7 +605,7 @@ xfer_free (struct t_xfer *xfer)
*/
int
-xfer_add_cb (void *data, char *signal, char *type_data, void *signal_data)
+xfer_add_cb (void *data, const char *signal, const char *type_data, void *signal_data)
{
struct t_plugin_infolist *infolist;
char *plugin_name, *plugin_id, *str_type, *str_protocol;
@@ -953,7 +953,7 @@ xfer_add_cb (void *data, char *signal, char *type_data, void *signal_data)
*/
int
-xfer_start_resume_cb (void *data, char *signal, char *type_data,
+xfer_start_resume_cb (void *data, const char *signal, const char *type_data,
void *signal_data)
{
struct t_plugin_infolist *infolist;
@@ -1030,7 +1030,7 @@ xfer_start_resume_cb (void *data, char *signal, char *type_data,
*/
int
-xfer_accept_resume_cb (void *data, char *signal, char *type_data,
+xfer_accept_resume_cb (void *data, const char *signal, const char *type_data,
void *signal_data)
{
struct t_plugin_infolist *infolist;
@@ -1167,7 +1167,7 @@ xfer_print_log ()
*/
int
-xfer_debug_dump_cb (void *data, char *signal, char *type_data,
+xfer_debug_dump_cb (void *data, const char *signal, const char *type_data,
void *signal_data)
{
/* make C compiler happy */
diff --git a/src/plugins/xfer/xfer.h b/src/plugins/xfer/xfer.h
index a357fbefa..228f7f3fa 100644
--- a/src/plugins/xfer/xfer.h
+++ b/src/plugins/xfer/xfer.h
@@ -156,7 +156,7 @@ extern int xfer_debug;
extern struct t_xfer *xfer_search_by_number (int number);
extern void xfer_close (struct t_xfer *xfer, enum t_xfer_status status);
-extern void xfer_send_signal (struct t_xfer *xfer, char *signal);
+extern void xfer_send_signal (struct t_xfer *xfer, const char *signal);
extern void xfer_free (struct t_xfer *xfer);
#endif /* xfer.h */