From 90b96f9cdd1131fd3dc453f435c1b45bbf4772bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Sun, 25 Feb 2024 17:07:11 +0100 Subject: [PATCH] python: fix truncation of unsigned long long integer returned by function string_parse_size --- ChangeLog.adoc | 1 + src/plugins/python/weechat-python-api.c | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ChangeLog.adoc b/ChangeLog.adoc index 480e0e1c5..24fc671e5 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -17,6 +17,7 @@ Bug fixes:: * core: add missing mouse events "alt-ctrl-button2" and "alt-ctrl-button3" * irc: add missing tags on self action messages when capability echo-message is enabled (issue #2074) + * python: fix truncation of unsigned long long integer returned by function string_parse_size * script: always display list of scripts when searching scripts with `/script search` (issue #2077) * script: fix default mouse keys (issue #2076) * scripts: fix crash on script unload when a hook is created in a buffer close callback (issue #2067) diff --git a/src/plugins/python/weechat-python-api.c b/src/plugins/python/weechat-python-api.c index 5cc1ac5f7..068981bdd 100644 --- a/src/plugins/python/weechat-python-api.c +++ b/src/plugins/python/weechat-python-api.c @@ -80,8 +80,8 @@ return PyLong_FromLong ((long)__int) #define API_RETURN_LONG(__long) \ return PyLong_FromLong (__long) -#define API_RETURN_LONGLONG(__longlong) \ - return PyLong_FromLongLong (__longlong) +#define API_RETURN_ULONGLONG(__ulonglong) \ + return PyLong_FromUnsignedLongLong (__ulonglong) /* @@ -376,14 +376,14 @@ API_FUNC(string_parse_size) char *size; unsigned long long value; - API_INIT_FUNC(1, "string_parse_size", API_RETURN_LONGLONG(0)); + API_INIT_FUNC(1, "string_parse_size", API_RETURN_ULONGLONG(0)); size = NULL; if (!PyArg_ParseTuple (args, "s", &size)) - API_WRONG_ARGS(API_RETURN_LONGLONG(0)); + API_WRONG_ARGS(API_RETURN_ULONGLONG(0)); value = weechat_string_parse_size (size); - API_RETURN_LONGLONG(value); + API_RETURN_ULONGLONG(value); } API_FUNC(string_color_code_size)