mirror of
https://github.com/facebook/zstd.git
synced 2025-08-07 06:23:00 +03:00
human_size() should use size_t
This commit is contained in:
committed by
W. Felix Handte
parent
35576e63ce
commit
e5fc830795
@@ -121,7 +121,7 @@ int UTIL_requireUserConfirmation(const char* prompt, const char* abortMsg,
|
|||||||
* Functions
|
* Functions
|
||||||
***************************************/
|
***************************************/
|
||||||
|
|
||||||
char* humanSize(long size, char* str) {
|
char* humanSize(size_t size, char* str) {
|
||||||
if (size > 1125899906842624L) {
|
if (size > 1125899906842624L) {
|
||||||
snprintf(str, 7, "%.1fP", (float)size / 1125899906842624L);
|
snprintf(str, 7, "%.1fP", (float)size / 1125899906842624L);
|
||||||
} else if (size > 1099511627776L) {
|
} else if (size > 1099511627776L) {
|
||||||
@@ -132,8 +132,8 @@ char* humanSize(long size, char* str) {
|
|||||||
snprintf(str, 7, "%.1fM", (float)size / 1048576L);
|
snprintf(str, 7, "%.1fM", (float)size / 1048576L);
|
||||||
} else if (size > 1024) {
|
} else if (size > 1024) {
|
||||||
snprintf(str, 7, "%.1fK", (float)size / 1024);
|
snprintf(str, 7, "%.1fK", (float)size / 1024);
|
||||||
} else if (size >= 0) {
|
} else if (size <= 1024) {
|
||||||
snprintf(str, 7, "%dB", 0);
|
snprintf(str, 7, "%luB", size);
|
||||||
} else {
|
} else {
|
||||||
str[0] = '\0';
|
str[0] = '\0';
|
||||||
}
|
}
|
||||||
|
@@ -122,7 +122,7 @@ int UTIL_requireUserConfirmation(const char* prompt, const char* abortMsg, const
|
|||||||
#define STRDUP(s) strdup(s)
|
#define STRDUP(s) strdup(s)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char* humanSize(long size, char* str);
|
char* humanSize(size_t size, char* str);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calls platform's equivalent of stat() on filename and writes info to statbuf.
|
* Calls platform's equivalent of stat() on filename and writes info to statbuf.
|
||||||
|
Reference in New Issue
Block a user