diff options
Diffstat (limited to 'tools/idevicebackup2.c')
| -rw-r--r-- | tools/idevicebackup2.c | 25 |
1 files changed, 3 insertions, 22 deletions
diff --git a/tools/idevicebackup2.c b/tools/idevicebackup2.c index 4fe5751..a43cbda 100644 --- a/tools/idevicebackup2.c +++ b/tools/idevicebackup2.c | |||
| @@ -189,25 +189,6 @@ static int mkdir_with_parents(const char *dir, int mode) | |||
| 189 | return res; | 189 | return res; |
| 190 | } | 190 | } |
| 191 | 191 | ||
| 192 | static char* format_size_for_display(uint64_t size) | ||
| 193 | { | ||
| 194 | char buf[32]; | ||
| 195 | double sz; | ||
| 196 | if (size >= 1000000000LL) { | ||
| 197 | sz = ((double)size / 1000000000.0f); | ||
| 198 | sprintf(buf, "%0.1f GB", sz); | ||
| 199 | } else if (size >= 1000000LL) { | ||
| 200 | sz = ((double)size / 1000000.0f); | ||
| 201 | sprintf(buf, "%0.1f MB", sz); | ||
| 202 | } else if (size >= 1000LL) { | ||
| 203 | sz = ((double)size / 1000.0f); | ||
| 204 | sprintf(buf, "%0.1f kB", sz); | ||
| 205 | } else { | ||
| 206 | sprintf(buf, "%d Bytes", (int)size); | ||
| 207 | } | ||
| 208 | return strdup(buf); | ||
| 209 | } | ||
| 210 | |||
| 211 | static plist_t mobilebackup_factory_info_plist_new(const char* udid, lockdownd_client_t lockdown, afc_client_t afc) | 192 | static plist_t mobilebackup_factory_info_plist_new(const char* udid, lockdownd_client_t lockdown, afc_client_t afc) |
| 212 | { | 193 | { |
| 213 | /* gather data from lockdown */ | 194 | /* gather data from lockdown */ |
| @@ -404,10 +385,10 @@ static void print_progress(uint64_t current, uint64_t total) | |||
| 404 | 385 | ||
| 405 | print_progress_real((double)progress, 0); | 386 | print_progress_real((double)progress, 0); |
| 406 | 387 | ||
| 407 | format_size = format_size_for_display(current); | 388 | format_size = string_format_size(current); |
| 408 | PRINT_VERBOSE(1, " (%s", format_size); | 389 | PRINT_VERBOSE(1, " (%s", format_size); |
| 409 | free(format_size); | 390 | free(format_size); |
| 410 | format_size = format_size_for_display(total); | 391 | format_size = string_format_size(total); |
| 411 | PRINT_VERBOSE(1, "/%s) ", format_size); | 392 | PRINT_VERBOSE(1, "/%s) ", format_size); |
| 412 | free(format_size); | 393 | free(format_size); |
| 413 | 394 | ||
| @@ -543,7 +524,7 @@ static int mb2_handle_send_file(mobilebackup2_client_t mobilebackup2, const char | |||
| 543 | 524 | ||
| 544 | total = fst.st_size; | 525 | total = fst.st_size; |
| 545 | 526 | ||
| 546 | char *format_size = format_size_for_display(total); | 527 | char *format_size = string_format_size(total); |
| 547 | PRINT_VERBOSE(1, "Sending '%s' (%s)\n", path, format_size); | 528 | PRINT_VERBOSE(1, "Sending '%s' (%s)\n", path, format_size); |
| 548 | free(format_size); | 529 | free(format_size); |
| 549 | 530 | ||
