api: fix function string_format_size on 32-bit systems

v2.8-utf8proc
Sébastien Helleu 2014-08-02 11:44:15 +02:00
parent f9b04635d3
commit d046315e8b
3 changed files with 9 additions and 8 deletions

View File

@ -100,6 +100,7 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
* core: display a warning in case of inconsistency between the options
weechat.look.save_{config|layout}_on_exit
* tests: add unit tests using CppUTest
* api: fix function string_format_size on 32-bit systems
* api: add argument "flags" in function hdata_new_list
* api: change type of arguments displayed/highlight in hook_print callback from
string to integer (in scripts)

View File

@ -2300,13 +2300,13 @@ string_format_size (unsigned long long size)
str_size[0] = '\0';
if (size < 10UL * 1000UL)
if (size < 10ULL * 1000ULL)
num_unit = 0;
else if (size < 1000UL * 1000UL)
else if (size < 1000ULL * 1000ULL)
num_unit = 1;
else if (size < 1000UL * 1000UL * 1000UL)
else if (size < 1000ULL * 1000ULL * 1000ULL)
num_unit = 2;
else if (size < 1000UL * 1000UL * 1000UL * 1000UL)
else if (size < 1000ULL * 1000ULL * 1000ULL * 1000ULL)
num_unit = 3;
else
num_unit = 4;

View File

@ -29,10 +29,10 @@ extern "C"
#include "../src/core/wee-string.h"
}
#define ONE_KB 1000UL
#define ONE_MB (ONE_KB * 1000UL)
#define ONE_GB (ONE_MB * 1000UL)
#define ONE_TB (ONE_GB * 1000UL)
#define ONE_KB 1000ULL
#define ONE_MB (ONE_KB * 1000ULL)
#define ONE_GB (ONE_MB * 1000ULL)
#define ONE_TB (ONE_GB * 1000ULL)
#define WEE_HAS_HL_STR(__result, __str, __words) \
LONGS_EQUAL(__result, string_has_highlight (__str, __words));