From 736d600aa7ea50dc79201be8b35c7e6767f12a6d Mon Sep 17 00:00:00 2001
From: Martin Szulecki
Date: Mon, 25 Jan 2010 02:55:16 +0100
Subject: Make sure to print accurate backup progress information; was wrong so
 far

---
 tools/iphonebackup.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

(limited to 'tools')

diff --git a/tools/iphonebackup.c b/tools/iphonebackup.c
index f7be8ca..28a8949 100644
--- a/tools/iphonebackup.c
+++ b/tools/iphonebackup.c
@@ -464,14 +464,15 @@ int main(int argc, char *argv[])
 					is_manifest = FALSE;
 
 				if (c == 2) {
-					node = plist_dict_get_item(node_tmp, "DLFileAttributesKey");
-					node = plist_dict_get_item(node, "FileSize");
-					plist_get_uint_val(node, &length);
-
 					/* increased received size for each completed file */
-					backup_real_size += length;
-
 					if (!is_manifest) {
+						node = plist_dict_get_item(node_tmp, "DLFileAttributesKey");
+						node = plist_dict_get_item(node, "FileSize");
+						plist_get_uint_val(node, &length);
+
+						backup_real_size += length;
+						file_index++;
+
 						format_size = g_format_size_for_display(backup_real_size);
 						printf("(%s", format_size);
 						g_free(format_size);
@@ -543,8 +544,6 @@ int main(int argc, char *argv[])
 
 				plist_free(message);
 				message = NULL;
-
-				file_index++;
 			} while (!plist_strcmp(node, "DLSendFile"));
 
 			printf("Received %d files from device.\n", file_index);
-- 
cgit v1.1-32-gdbae