get_human_readable_size() formats all negative numbers as if they were small.
The previous two commits changed all callers to pass unsigned arguments. Change the parameter type to from int64_t to uint64_t. Also change the buffer size parameter from int (ahem!) to size_t. Signed-off-by: Markus Armbruster <arm...@redhat.com> --- block/qapi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/block/qapi.c b/block/qapi.c index 1c6123c..0f6620e 100644 --- a/block/qapi.c +++ b/block/qapi.c @@ -566,10 +566,11 @@ BlockStatsList *qmp_query_blockstats(bool has_query_nodes, #define NB_SUFFIXES 4 -static char *get_human_readable_size(char *buf, int buf_size, int64_t size) +static char *get_human_readable_size(char *buf, size_t buf_size, + uint64_t size) { static const char suffixes[NB_SUFFIXES] = {'K', 'M', 'G', 'T'}; - int64_t base; + uint64_t base; int i; if (size <= 999) { -- 2.7.5