mirror of
https://github.com/weechat/weechat.git
synced 2026-06-28 13:56:37 +02:00
scripts: fix issue with year ≥ 2038 in functions print_date_tags and print_y_date_tags
Affected plugins: python, lua, tcl, guile, javascript.
This commit is contained in:
@@ -1902,7 +1902,7 @@ weechat_guile_api_print_date_tags (SCM buffer, SCM date, SCM tags, SCM message)
|
||||
plugin_script_api_printf_date_tags (weechat_guile_plugin,
|
||||
guile_current_script,
|
||||
API_STR2PTR(API_SCM_TO_STRING(buffer)),
|
||||
scm_to_int (date),
|
||||
(time_t)scm_to_long (date),
|
||||
API_SCM_TO_STRING(tags),
|
||||
"%s", API_SCM_TO_STRING(message));
|
||||
|
||||
@@ -1940,7 +1940,7 @@ weechat_guile_api_print_y_date_tags (SCM buffer, SCM y, SCM date, SCM tags,
|
||||
guile_current_script,
|
||||
API_STR2PTR(API_SCM_TO_STRING(buffer)),
|
||||
scm_to_int (y),
|
||||
scm_to_int (date),
|
||||
(time_t)scm_to_long (date),
|
||||
API_SCM_TO_STRING(tags),
|
||||
"%s", API_SCM_TO_STRING(message));
|
||||
|
||||
|
||||
@@ -1787,9 +1787,9 @@ API_FUNC(print)
|
||||
|
||||
API_FUNC(print_date_tags)
|
||||
{
|
||||
int date;
|
||||
long date;
|
||||
|
||||
API_INIT_FUNC(1, "print_date_tags", "siss", API_RETURN_ERROR);
|
||||
API_INIT_FUNC(1, "print_date_tags", "snss", API_RETURN_ERROR);
|
||||
|
||||
v8::String::Utf8Value buffer(args[0]);
|
||||
date = args[1]->IntegerValue();
|
||||
@@ -1800,7 +1800,7 @@ API_FUNC(print_date_tags)
|
||||
weechat_js_plugin,
|
||||
js_current_script,
|
||||
(struct t_gui_buffer *)API_STR2PTR(*buffer),
|
||||
date,
|
||||
(time_t)date,
|
||||
*tags,
|
||||
"%s", *message);
|
||||
|
||||
@@ -1828,9 +1828,10 @@ API_FUNC(print_y)
|
||||
|
||||
API_FUNC(print_y_date_tags)
|
||||
{
|
||||
int y, date;
|
||||
int y;
|
||||
long date;
|
||||
|
||||
API_INIT_FUNC(1, "print_y_date_tags", "siiss", API_RETURN_ERROR);
|
||||
API_INIT_FUNC(1, "print_y_date_tags", "sinss", API_RETURN_ERROR);
|
||||
|
||||
v8::String::Utf8Value buffer(args[0]);
|
||||
y = args[1]->IntegerValue();
|
||||
@@ -1842,7 +1843,7 @@ API_FUNC(print_y_date_tags)
|
||||
js_current_script,
|
||||
(struct t_gui_buffer *)API_STR2PTR(*buffer),
|
||||
y,
|
||||
date,
|
||||
(time_t)date,
|
||||
*tags,
|
||||
"%s", *message);
|
||||
|
||||
|
||||
@@ -1981,7 +1981,7 @@ API_FUNC(print)
|
||||
API_FUNC(print_date_tags)
|
||||
{
|
||||
const char *buffer, *tags, *message;
|
||||
int date;
|
||||
long date;
|
||||
|
||||
API_INIT_FUNC(1, "print_date_tags", API_RETURN_ERROR);
|
||||
if (lua_gettop (L) < 4)
|
||||
@@ -1995,7 +1995,7 @@ API_FUNC(print_date_tags)
|
||||
plugin_script_api_printf_date_tags (weechat_lua_plugin,
|
||||
lua_current_script,
|
||||
API_STR2PTR(buffer),
|
||||
date,
|
||||
(time_t)date,
|
||||
tags,
|
||||
"%s", message);
|
||||
|
||||
@@ -2027,7 +2027,8 @@ API_FUNC(print_y)
|
||||
API_FUNC(print_y_date_tags)
|
||||
{
|
||||
const char *buffer, *tags, *message;
|
||||
int y, date;
|
||||
int y;
|
||||
long date;
|
||||
|
||||
API_INIT_FUNC(1, "print_y_date_tags", API_RETURN_ERROR);
|
||||
if (lua_gettop (L) < 5)
|
||||
@@ -2043,7 +2044,7 @@ API_FUNC(print_y_date_tags)
|
||||
lua_current_script,
|
||||
API_STR2PTR(buffer),
|
||||
y,
|
||||
date,
|
||||
(time_t)date,
|
||||
tags,
|
||||
"%s", message);
|
||||
|
||||
|
||||
@@ -1909,7 +1909,7 @@ API_FUNC(print_date_tags)
|
||||
plugin_script_api_printf_date_tags (weechat_perl_plugin,
|
||||
perl_current_script,
|
||||
API_STR2PTR(buffer),
|
||||
SvIV (ST (1)),
|
||||
(time_t)(SvIV (ST (1))), /* date */
|
||||
tags,
|
||||
"%s", message);
|
||||
|
||||
@@ -1953,8 +1953,8 @@ API_FUNC(print_y_date_tags)
|
||||
plugin_script_api_printf_y_date_tags (weechat_perl_plugin,
|
||||
perl_current_script,
|
||||
API_STR2PTR(buffer),
|
||||
SvIV (ST (1)),
|
||||
SvIV (ST (2)),
|
||||
SvIV (ST (1)), /* y */
|
||||
(time_t)(SvIV (ST (2))), /* date */
|
||||
tags,
|
||||
"%s", message);
|
||||
|
||||
@@ -4594,7 +4594,7 @@ API_FUNC(infolist_new_var_time)
|
||||
|
||||
result = API_PTR2STR(weechat_infolist_new_var_time (API_STR2PTR(item),
|
||||
name,
|
||||
(time_t)SvIV (ST (2)))); /* value */
|
||||
(time_t)(SvIV (ST (2))))); /* value */
|
||||
|
||||
API_RETURN_STRING(result);
|
||||
}
|
||||
|
||||
@@ -1889,20 +1889,20 @@ API_FUNC(prnt)
|
||||
API_FUNC(prnt_date_tags)
|
||||
{
|
||||
char *buffer, *tags, *message;
|
||||
int date;
|
||||
long date;
|
||||
|
||||
API_INIT_FUNC(1, "prnt_date_tags", API_RETURN_ERROR);
|
||||
buffer = NULL;
|
||||
date = 0;
|
||||
tags = NULL;
|
||||
message = NULL;
|
||||
if (!PyArg_ParseTuple (args, "siss", &buffer, &date, &tags, &message))
|
||||
if (!PyArg_ParseTuple (args, "slss", &buffer, &date, &tags, &message))
|
||||
API_WRONG_ARGS(API_RETURN_ERROR);
|
||||
|
||||
plugin_script_api_printf_date_tags (weechat_python_plugin,
|
||||
python_current_script,
|
||||
API_STR2PTR(buffer),
|
||||
date,
|
||||
(time_t)date,
|
||||
tags,
|
||||
"%s", message);
|
||||
|
||||
@@ -1933,7 +1933,8 @@ API_FUNC(prnt_y)
|
||||
API_FUNC(prnt_y_date_tags)
|
||||
{
|
||||
char *buffer, *tags, *message;
|
||||
int y, date;
|
||||
int y;
|
||||
long date;
|
||||
|
||||
API_INIT_FUNC(1, "prnt_y_date_tags", API_RETURN_ERROR);
|
||||
buffer = NULL;
|
||||
@@ -1941,14 +1942,14 @@ API_FUNC(prnt_y_date_tags)
|
||||
date = 0;
|
||||
tags = NULL;
|
||||
message = NULL;
|
||||
if (!PyArg_ParseTuple (args, "siiss", &buffer, &y, &date, &tags, &message))
|
||||
if (!PyArg_ParseTuple (args, "silss", &buffer, &y, &date, &tags, &message))
|
||||
API_WRONG_ARGS(API_RETURN_ERROR);
|
||||
|
||||
plugin_script_api_printf_y_date_tags (weechat_python_plugin,
|
||||
python_current_script,
|
||||
API_STR2PTR(buffer),
|
||||
y,
|
||||
date,
|
||||
(time_t)date,
|
||||
tags,
|
||||
"%s", message);
|
||||
|
||||
|
||||
@@ -2146,13 +2146,14 @@ API_FUNC(print_date_tags)
|
||||
{
|
||||
Tcl_Obj *objp;
|
||||
char *buffer, *tags, *message;
|
||||
int i, date;
|
||||
int i;
|
||||
long date;
|
||||
|
||||
API_INIT_FUNC(1, "print_date_tags", API_RETURN_ERROR);
|
||||
if (objc < 5)
|
||||
API_WRONG_ARGS(API_RETURN_ERROR);
|
||||
|
||||
if (Tcl_GetIntFromObj (interp, objv[2], &date) != TCL_OK)
|
||||
if (Tcl_GetLongFromObj (interp, objv[2], &date) != TCL_OK)
|
||||
API_WRONG_ARGS(API_RETURN_ERROR);
|
||||
|
||||
buffer = Tcl_GetStringFromObj (objv[1], &i);
|
||||
@@ -2162,7 +2163,7 @@ API_FUNC(print_date_tags)
|
||||
plugin_script_api_printf_date_tags (weechat_tcl_plugin,
|
||||
tcl_current_script,
|
||||
API_STR2PTR(buffer),
|
||||
date,
|
||||
(time_t)date,
|
||||
tags,
|
||||
"%s", message);
|
||||
|
||||
@@ -2198,7 +2199,8 @@ API_FUNC(print_y_date_tags)
|
||||
{
|
||||
Tcl_Obj *objp;
|
||||
char *buffer, *tags, *message;
|
||||
int i, y, date;
|
||||
int i, y;
|
||||
long date;
|
||||
|
||||
API_INIT_FUNC(1, "print_y_date_tags", API_RETURN_ERROR);
|
||||
if (objc < 6)
|
||||
@@ -2207,7 +2209,7 @@ API_FUNC(print_y_date_tags)
|
||||
if (Tcl_GetIntFromObj (interp, objv[2], &y) != TCL_OK)
|
||||
API_WRONG_ARGS(API_RETURN_ERROR);
|
||||
|
||||
if (Tcl_GetIntFromObj (interp, objv[3], &date) != TCL_OK)
|
||||
if (Tcl_GetLongFromObj (interp, objv[3], &date) != TCL_OK)
|
||||
API_WRONG_ARGS(API_RETURN_ERROR);
|
||||
|
||||
buffer = Tcl_GetStringFromObj (objv[1], &i);
|
||||
@@ -2218,7 +2220,7 @@ API_FUNC(print_y_date_tags)
|
||||
tcl_current_script,
|
||||
API_STR2PTR(buffer),
|
||||
y,
|
||||
date,
|
||||
(time_t)date,
|
||||
tags,
|
||||
"%s", message);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user