From cb32e99dd4650a901c872187c124589f565d7fd8 Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Wed, 27 Apr 2011 22:41:43 +0200 Subject: idevicebackup2: Print progress after every operation, not only for copying --- tools/idevicebackup2.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/tools/idevicebackup2.c b/tools/idevicebackup2.c index ff31189..bfb84c6 100644 --- a/tools/idevicebackup2.c +++ b/tools/idevicebackup2.c @@ -671,20 +671,15 @@ static void mb2_handle_send_files(plist_t message, const char *backup_dir) uint32_t i = 0; uint32_t sent; plist_t errplist = NULL; - double progress = 0; - + if (!message || (plist_get_node_type(message) != PLIST_ARRAY) || (plist_array_get_size(message) < 2) || !backup_dir) return; plist_t files = plist_array_get_item(message, 1); cnt = plist_array_get_size(files); if (cnt == 0) return; - plist_t val = plist_array_get_item(message, 3); - plist_get_real_val(val, &progress); - val = NULL; - for (i = 0; i < cnt; i++) { - val = plist_array_get_item(files, i); + plist_t val = plist_array_get_item(files, i); if (plist_get_node_type(val) != PLIST_STRING) { continue; } @@ -710,11 +705,6 @@ static void mb2_handle_send_files(plist_t message, const char *backup_dir) mobilebackup2_send_status_response(mobilebackup2, -13, "Multi status", errplist); plist_free(errplist); } - - if (progress > 0) { - print_progress_real(progress, 1); - PRINT_VERBOSE(1, "\n"); - } } static int mb2_handle_receive_files(plist_t message, const char *backup_dir) @@ -1640,14 +1630,17 @@ checkpoint: } /* print status */ - /*if (plist_array_get_size(message) >= 4) { - plist_t pnode = plist_array_get_item(message, 4); + if (plist_array_get_size(message) >= 3) { + plist_t pnode = plist_array_get_item(message, 3); if (pnode && (plist_get_node_type(pnode) == PLIST_REAL)) { double progress = 0.0; plist_get_real_val(pnode, &progress); - printf("Progress: %f\n", progress); + if (progress > 0) { + print_progress_real(progress, 0); + PRINT_VERBOSE(1, " Finished\n"); + } } - }*/ + } if (message) plist_free(message); -- cgit v1.1-32-gdbae