mirror of
https://github.com/weechat/weechat.git
synced 2026-06-30 14:56:39 +02:00
core: fix random integer number with large range in evaluation of expressions on GNU/Hurd
This commit is contained in:
@@ -29,6 +29,7 @@ New features::
|
||||
|
||||
Bug fixes::
|
||||
|
||||
* core: fix random integer number with large range in evaluation of expressions on GNU/Hurd
|
||||
* core: fix access to integer/long/time arrays in hdata
|
||||
* api: fix search of option when the section is not given in functions config_search_option and config_search_section_option
|
||||
* irc: fix join of channels with long name (issue #1717)
|
||||
|
||||
+4
-4
@@ -1008,7 +1008,7 @@ char *
|
||||
eval_string_random (const char *text)
|
||||
{
|
||||
char *pos, *error, *tmp, result[128];
|
||||
long min_number, max_number;
|
||||
long long min_number, max_number;
|
||||
|
||||
if (!text || !text[0])
|
||||
goto error;
|
||||
@@ -1020,7 +1020,7 @@ eval_string_random (const char *text)
|
||||
tmp = strndup (text, pos - text);
|
||||
if (!tmp)
|
||||
goto error;
|
||||
min_number = strtol (tmp, &error, 10);
|
||||
min_number = strtoll (tmp, &error, 10);
|
||||
if (!error || error[0])
|
||||
{
|
||||
free (tmp);
|
||||
@@ -1028,7 +1028,7 @@ eval_string_random (const char *text)
|
||||
}
|
||||
free (tmp);
|
||||
|
||||
max_number = strtol (pos + 1, &error, 10);
|
||||
max_number = strtoll (pos + 1, &error, 10);
|
||||
if (!error || error[0])
|
||||
goto error;
|
||||
|
||||
@@ -1042,7 +1042,7 @@ eval_string_random (const char *text)
|
||||
* but this is enough for our usage here
|
||||
*/
|
||||
snprintf (result, sizeof (result),
|
||||
"%ld", min_number + (random () % (max_number - min_number + 1)));
|
||||
"%lld", min_number + (random () % (max_number - min_number + 1)));
|
||||
return strdup (result);
|
||||
|
||||
error:
|
||||
|
||||
Reference in New Issue
Block a user