From 34758c22b98af364cf123a3f9260fe1cd9db6632 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sun, 17 Jul 2016 18:20:15 +0200 Subject: [PATCH] Add support for terabytes in sizes. Submitted by Wanderlei Huttel. Fixes bug #2223 --- bacula/src/lib/edit.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/bacula/src/lib/edit.c b/bacula/src/lib/edit.c index f419ab47f8..19290113f0 100644 --- a/bacula/src/lib/edit.c +++ b/bacula/src/lib/edit.c @@ -343,13 +343,15 @@ static bool strunit_to_uint64(char *str, int str_len, uint64_t *value, double val; char mod_str[20]; char num_str[50]; - const int64_t mult[] = {1, /* byte */ - 1024, /* kilobyte */ - 1000, /* kb kilobyte */ - 1048576, /* megabyte */ - 1000000, /* mb megabyte */ - 1073741824, /* gigabyte */ - 1000000000}; /* gb gigabyte */ + const int64_t mult[] = {1, /* byte */ + 1024, /* kilobyte */ + 1000, /* kb kilobyte */ + 1048576, /* megabyte */ + 1000000, /* mb megabyte */ + 1073741824, /* gigabyte */ + 1000000000, /* gb gigabyte */ + 1099511627776, /* terabyte */ + 1000000000000}; /* tb terabyte */ if (!get_modifier(str, num_str, sizeof(num_str), mod_str, sizeof(mod_str))) { return 0; @@ -386,7 +388,8 @@ static bool strunit_to_uint64(char *str, int str_len, uint64_t *value, bool size_to_uint64(char *str, int str_len, uint64_t *value) { /* first item * not used */ - static const char *mod[] = {"*", "k", "kb", "m", "mb", "g", "gb", NULL}; + static const char *mod[] = {"*", "k", "kb", "m", "mb", + "g", "gb", "t", "tb", NULL}; return strunit_to_uint64(str, str_len, value, mod); } -- 2.39.5