diff options
-rw-r--r-- | ChangeLog.adoc | 1 | ||||
-rw-r--r-- | src/plugins/python/weechat-python-api.c | 8 | ||||
-rw-r--r-- | src/plugins/ruby/weechat-ruby-api.c | 8 | ||||
-rw-r--r-- | tests/scripts/python/testapi.py | 2 |
4 files changed, 12 insertions, 7 deletions
diff --git a/ChangeLog.adoc b/ChangeLog.adoc index ba98d3d36..d53c4ce2f 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -49,6 +49,7 @@ Bug fixes:: * relay: synchronize nick modes with IRC client upon connection (issue #1984) * script: fix cursor position after `/script list -i` or `/script list -il` * script: fix buffer used by command `/script list -i|-il|-o|-ol` + * scripts: fix function string_parse_size on 32-bit systems (python and ruby) (issue #1999) * xfer: fix conversion of string to IPv4 on 32-bit systems (issue #1999) Tests:: diff --git a/src/plugins/python/weechat-python-api.c b/src/plugins/python/weechat-python-api.c index 12cebcfcf..d0d241b36 100644 --- a/src/plugins/python/weechat-python-api.c +++ b/src/plugins/python/weechat-python-api.c @@ -80,6 +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) /* @@ -374,14 +376,14 @@ API_FUNC(string_parse_size) char *size; unsigned long long value; - API_INIT_FUNC(1, "string_parse_size", API_RETURN_LONG(0)); + API_INIT_FUNC(1, "string_parse_size", API_RETURN_LONGLONG(0)); size = NULL; if (!PyArg_ParseTuple (args, "s", &size)) - API_WRONG_ARGS(API_RETURN_LONG(0)); + API_WRONG_ARGS(API_RETURN_LONGLONG(0)); value = weechat_string_parse_size (size); - API_RETURN_LONG(value); + API_RETURN_LONGLONG(value); } API_FUNC(string_color_code_size) diff --git a/src/plugins/ruby/weechat-ruby-api.c b/src/plugins/ruby/weechat-ruby-api.c index 4db4d3326..ec6ba2e65 100644 --- a/src/plugins/ruby/weechat-ruby-api.c +++ b/src/plugins/ruby/weechat-ruby-api.c @@ -77,6 +77,8 @@ return INT2FIX (__int) #define API_RETURN_LONG(__long) \ return LONG2NUM (__long) +#define API_RETURN_LONGLONG(__longlong) \ + return LL2NUM (__longlong) /* @@ -454,9 +456,9 @@ weechat_ruby_api_string_parse_size (VALUE class, VALUE size) char *c_size; unsigned long long value; - API_INIT_FUNC(1, "string_parse_size", API_RETURN_LONG(0)); + API_INIT_FUNC(1, "string_parse_size", API_RETURN_LONGLONG(0)); if (NIL_P (size)) - API_WRONG_ARGS(API_RETURN_LONG(0)); + API_WRONG_ARGS(API_RETURN_LONGLONG(0)); Check_Type (size, T_STRING); @@ -464,7 +466,7 @@ weechat_ruby_api_string_parse_size (VALUE class, VALUE size) value = weechat_string_parse_size (c_size); - API_RETURN_LONG(value); + API_RETURN_LONGLONG(value); } static VALUE diff --git a/tests/scripts/python/testapi.py b/tests/scripts/python/testapi.py index 6e9bb22e1..f1b33a0e3 100644 --- a/tests/scripts/python/testapi.py +++ b/tests/scripts/python/testapi.py @@ -83,7 +83,7 @@ def test_strings(): check(weechat.string_parse_size('123 b') == 123) check(weechat.string_parse_size('120k') == 120000) check(weechat.string_parse_size('1500m') == 1500000000) - check(weechat.string_parse_size('3g') == 3000000000) + check(weechat.string_parse_size('2g') == 2000000000) check(weechat.string_color_code_size('') == 0) check(weechat.string_color_code_size('test') == 0) str_color = weechat.color('yellow,red') |