From 720a7e5a99a4cd1bfdcdf83e2e16c0934997b039 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 430cbcd58..df7e587d0 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -16,6 +16,7 @@ For a list of important changes that require manual actions, please look at rele Bug fixes:: * core: add missing mouse events "alt-ctrl-button2" and "alt-ctrl-button3" + * 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) * tcl: fix truncation of long integer returned by function hdata_long diff --git a/src/plugins/python/weechat-python-api.c b/src/plugins/python/weechat-python-api.c index 2cb87d55f..35c3424d3 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)