From 3a53257032a0df8aa5f3b31f14a8e6f4e1f07595 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Tue, 3 Jun 2008 10:56:51 +0200 Subject: Add "const" keyword for some "char *" function arguments (core and plugins API) --- src/plugins/scripts/lua/weechat-lua-api.c | 440 ++++++++++++------------ src/plugins/scripts/lua/weechat-lua.c | 16 +- src/plugins/scripts/lua/weechat-lua.h | 7 +- src/plugins/scripts/perl/weechat-perl-api.c | 56 +-- src/plugins/scripts/perl/weechat-perl.c | 22 +- src/plugins/scripts/perl/weechat-perl.h | 7 +- src/plugins/scripts/python/weechat-python-api.c | 56 +-- src/plugins/scripts/python/weechat-python.c | 16 +- src/plugins/scripts/python/weechat-python.h | 7 +- src/plugins/scripts/ruby/weechat-ruby-api.c | 56 +-- src/plugins/scripts/ruby/weechat-ruby.c | 16 +- src/plugins/scripts/ruby/weechat-ruby.h | 7 +- src/plugins/scripts/script-api.c | 117 ++++--- src/plugins/scripts/script-api.h | 126 +++---- src/plugins/scripts/script.c | 30 +- src/plugins/scripts/script.h | 30 +- 16 files changed, 506 insertions(+), 503 deletions(-) (limited to 'src/plugins/scripts') 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); -- cgit v1.2.3