mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 10:51:54 -04:00
Fix overflow in the TERA/TEBI definition
This commit is contained in:
parent
6f1fb3b397
commit
447b1fd067
2 changed files with 6 additions and 6 deletions
|
|
@ -1578,13 +1578,13 @@ const char* fmt_term(const struct snapraid_disk* disk, const char* str)
|
|||
|
||||
const char* fmt_size(uint64_t size, char* buffer, size_t buffer_size)
|
||||
{
|
||||
if (size >= 10UL * TERA)
|
||||
if (size >= 10ULL * TERA)
|
||||
snprintf(buffer, buffer_size, "%" PRIu64 " T", size / TERA);
|
||||
else if (size >= 10UL * GIGA)
|
||||
else if (size >= 10ULL * GIGA)
|
||||
snprintf(buffer, buffer_size, "%" PRIu64 " G", size / GIGA);
|
||||
else if (size >= 10UL * MEGA)
|
||||
else if (size >= 10 * MEGA)
|
||||
snprintf(buffer, buffer_size, "%" PRIu64 " M", size / MEGA);
|
||||
else if (size >= 10UL * KILO)
|
||||
else if (size >= 10 * KILO)
|
||||
snprintf(buffer, buffer_size, "%" PRIu64 " k", size / KILO);
|
||||
else
|
||||
snprintf(buffer, buffer_size, "%" PRIu64 " ", size);
|
||||
|
|
|
|||
|
|
@ -36,11 +36,11 @@ const char* lev_config_name(unsigned level);
|
|||
#define KILO (1000)
|
||||
#define MEGA (1000 * 1000)
|
||||
#define GIGA (1000 * 1000 * 1000)
|
||||
#define TERA (1000 * 1000 * 1000 * 1000UL)
|
||||
#define TERA (1000 * 1000 * 1000 * (uint64_t)1000)
|
||||
#define KIBI (1024)
|
||||
#define MEBI (1024 * 1024)
|
||||
#define GIBI (1024 * 1024 * 1024)
|
||||
#define TEBI (1024 * 1024 * 1024 * 1024UL)
|
||||
#define TEBI (1024 * 1024 * 1024 * (uint64_t)1024)
|
||||
|
||||
#define SORT_PHYSICAL 1 /**< Sort by physical order. */
|
||||
#define SORT_INODE 2 /**< Sort by inode. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue