summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2022-08-01 22:18:38 +0200
committerSébastien Helleu <flashcode@flashtux.org>2022-08-01 22:18:38 +0200
commitbcb8647aa47ae2213bedbdd3506d5af3a7c60c10 (patch)
treef21ee78d4c8c344c3d4155b3e31e1bca1d5d8bf2 /src/plugins
parentb1404b02777c58d5e104082f349dff201bd12ef8 (diff)
downloadweechat-bcb8647aa47ae2213bedbdd3506d5af3a7c60c10.zip
scripts: fix issue with long interval in function hook_timer
Affected plugins: python, ruby, lua, tcl, guile, javascript, php.
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/guile/weechat-guile-api.c2
-rw-r--r--src/plugins/javascript/weechat-js-api.cpp5
-rw-r--r--src/plugins/lua/weechat-lua-api.c3
-rw-r--r--src/plugins/php/weechat-php-api.c5
-rw-r--r--src/plugins/plugin-script-api.c2
-rw-r--r--src/plugins/plugin-script-api.h2
-rw-r--r--src/plugins/python/weechat-python-api.c5
-rw-r--r--src/plugins/ruby/weechat-ruby-api.c5
-rw-r--r--src/plugins/tcl/weechat-tcl-api.c5
9 files changed, 20 insertions, 14 deletions
diff --git a/src/plugins/guile/weechat-guile-api.c b/src/plugins/guile/weechat-guile-api.c
index c83577860..e56ea76af 100644
--- a/src/plugins/guile/weechat-guile-api.c
+++ b/src/plugins/guile/weechat-guile-api.c
@@ -2255,7 +2255,7 @@ weechat_guile_api_hook_timer (SCM interval, SCM align_second, SCM max_calls,
result = API_PTR2STR(plugin_script_api_hook_timer (weechat_guile_plugin,
guile_current_script,
- scm_to_int (interval),
+ scm_to_long (interval),
scm_to_int (align_second),
scm_to_int (max_calls),
&weechat_guile_api_hook_timer_cb,
diff --git a/src/plugins/javascript/weechat-js-api.cpp b/src/plugins/javascript/weechat-js-api.cpp
index 32a2d742a..829b31057 100644
--- a/src/plugins/javascript/weechat-js-api.cpp
+++ b/src/plugins/javascript/weechat-js-api.cpp
@@ -2148,10 +2148,11 @@ weechat_js_api_hook_timer_cb (const void *pointer, void *data,
API_FUNC(hook_timer)
{
- int interval, align_second, max_calls;
+ long interval;
+ int align_second, max_calls;
const char *result;
- API_INIT_FUNC(1, "hook_timer", "iiiss", API_RETURN_EMPTY);
+ API_INIT_FUNC(1, "hook_timer", "niiss", API_RETURN_EMPTY);
interval = args[0]->IntegerValue();
align_second = args[1]->IntegerValue();
diff --git a/src/plugins/lua/weechat-lua-api.c b/src/plugins/lua/weechat-lua-api.c
index 2e62804ff..e97d3a9e2 100644
--- a/src/plugins/lua/weechat-lua-api.c
+++ b/src/plugins/lua/weechat-lua-api.c
@@ -2361,7 +2361,8 @@ weechat_lua_api_hook_timer_cb (const void *pointer, void *data,
API_FUNC(hook_timer)
{
- int interval, align_second, max_calls;
+ long interval;
+ int align_second, max_calls;
const char *function, *data;
const char *result;
diff --git a/src/plugins/php/weechat-php-api.c b/src/plugins/php/weechat-php-api.c
index cfe2ffaca..b28561040 100644
--- a/src/plugins/php/weechat-php-api.c
+++ b/src/plugins/php/weechat-php-api.c
@@ -2376,7 +2376,8 @@ API_FUNC(hook_timer)
zend_long z_interval, z_align_second, z_max_calls;
zval *z_callback;
zend_string *z_data;
- int interval, align_second, max_calls;
+ long interval;
+ int align_second, max_calls;
char *data;
const char *result;
@@ -2386,7 +2387,7 @@ API_FUNC(hook_timer)
&z_data) == FAILURE)
API_WRONG_ARGS(API_RETURN_EMPTY);
- interval = (int)z_interval;
+ interval = (long)z_interval;
align_second = (int)z_align_second;
max_calls = (int)z_max_calls;
weechat_php_get_function_name (z_callback, callback_name);
diff --git a/src/plugins/plugin-script-api.c b/src/plugins/plugin-script-api.c
index 9ae37e4a0..e69ea56e3 100644
--- a/src/plugins/plugin-script-api.c
+++ b/src/plugins/plugin-script-api.c
@@ -523,7 +523,7 @@ plugin_script_api_hook_command_run (struct t_weechat_plugin *weechat_plugin,
struct t_hook *
plugin_script_api_hook_timer (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
- int interval, int align_second, int max_calls,
+ long interval, int align_second, int max_calls,
int (*callback)(const void *pointer,
void *data,
int remaining_calls),
diff --git a/src/plugins/plugin-script-api.h b/src/plugins/plugin-script-api.h
index b7a369dea..c7264d72e 100644
--- a/src/plugins/plugin-script-api.h
+++ b/src/plugins/plugin-script-api.h
@@ -151,7 +151,7 @@ extern struct t_hook *plugin_script_api_hook_command_run (struct t_weechat_plugi
const char *data);
extern struct t_hook *plugin_script_api_hook_timer (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
- int interval, int align_second,
+ long interval, int align_second,
int max_calls,
int (*callback)(const void *pointer,
void *data,
diff --git a/src/plugins/python/weechat-python-api.c b/src/plugins/python/weechat-python-api.c
index cab0040dc..b823f1967 100644
--- a/src/plugins/python/weechat-python-api.c
+++ b/src/plugins/python/weechat-python-api.c
@@ -2264,7 +2264,8 @@ weechat_python_api_hook_timer_cb (const void *pointer, void *data,
API_FUNC(hook_timer)
{
- int interval, align_second, max_calls;
+ long interval;
+ int align_second, max_calls;
char *function, *data;
const char *result;
@@ -2274,7 +2275,7 @@ API_FUNC(hook_timer)
max_calls = 0;
function = NULL;
data = NULL;
- if (!PyArg_ParseTuple (args, "iiiss", &interval, &align_second, &max_calls,
+ if (!PyArg_ParseTuple (args, "liiss", &interval, &align_second, &max_calls,
&function, &data))
API_WRONG_ARGS(API_RETURN_EMPTY);
diff --git a/src/plugins/ruby/weechat-ruby-api.c b/src/plugins/ruby/weechat-ruby-api.c
index 8bad2f8e2..efe097cc5 100644
--- a/src/plugins/ruby/weechat-ruby-api.c
+++ b/src/plugins/ruby/weechat-ruby-api.c
@@ -2782,7 +2782,8 @@ static VALUE
weechat_ruby_api_hook_timer (VALUE class, VALUE interval, VALUE align_second,
VALUE max_calls, VALUE function, VALUE data)
{
- int c_interval, c_align_second, c_max_calls;
+ long c_interval;
+ int c_align_second, c_max_calls;
char *c_function, *c_data;
const char *result;
@@ -2797,7 +2798,7 @@ weechat_ruby_api_hook_timer (VALUE class, VALUE interval, VALUE align_second,
Check_Type (function, T_STRING);
Check_Type (data, T_STRING);
- c_interval = NUM2INT (interval);
+ c_interval = NUM2LONG (interval);
c_align_second = NUM2INT (align_second);
c_max_calls = NUM2INT (max_calls);
c_function = StringValuePtr (function);
diff --git a/src/plugins/tcl/weechat-tcl-api.c b/src/plugins/tcl/weechat-tcl-api.c
index 4da40eec1..24cfc64e5 100644
--- a/src/plugins/tcl/weechat-tcl-api.c
+++ b/src/plugins/tcl/weechat-tcl-api.c
@@ -2554,13 +2554,14 @@ API_FUNC(hook_timer)
{
Tcl_Obj *objp;
const char *result;
- int i, interval, align_second, max_calls;
+ long interval;
+ int i, align_second, max_calls;
API_INIT_FUNC(1, "hook_timer", API_RETURN_EMPTY);
if (objc < 6)
API_WRONG_ARGS(API_RETURN_EMPTY);
- if ((Tcl_GetIntFromObj (interp, objv[1], &interval) != TCL_OK)
+ if ((Tcl_GetLongFromObj (interp, objv[1], &interval) != TCL_OK)
|| (Tcl_GetIntFromObj (interp, objv[2], &align_second) != TCL_OK)
|| (Tcl_GetIntFromObj (interp, objv[3], &max_calls) != TCL_OK))
API_WRONG_ARGS(API_RETURN_EMPTY);