summaryrefslogtreecommitdiffstats
path: root/tools/idevicebackup2.c
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2014-03-20 23:00:20 +0100
committerGravatar Martin Szulecki2014-03-20 23:00:20 +0100
commit88ce6113593158944630435678e689bf155d9a03 (patch)
tree0757287665b7e9c7263d77fd269b0777e8228d25 /tools/idevicebackup2.c
parenta34a537d1408f8692daeadd5e1f5859ff13a3473 (diff)
downloadlibimobiledevice-88ce6113593158944630435678e689bf155d9a03.tar.gz
libimobiledevice-88ce6113593158944630435678e689bf155d9a03.tar.bz2
Bump dependency to libplist 1.11 and remove use of "plist_dict_insert_item()"
Diffstat (limited to 'tools/idevicebackup2.c')
-rw-r--r--tools/idevicebackup2.c76
1 files changed, 38 insertions, 38 deletions
diff --git a/tools/idevicebackup2.c b/tools/idevicebackup2.c
index 8efc2c8..a9bf071 100644
--- a/tools/idevicebackup2.c
+++ b/tools/idevicebackup2.c
@@ -275,56 +275,56 @@ static plist_t mobilebackup_factory_info_plist_new(const char* udid, lockdownd_c
/* set fields we understand */
value_node = plist_dict_get_item(root_node, "BuildVersion");
- plist_dict_insert_item(ret, "Build Version", plist_copy(value_node));
+ plist_dict_set_item(ret, "Build Version", plist_copy(value_node));
value_node = plist_dict_get_item(root_node, "DeviceName");
- plist_dict_insert_item(ret, "Device Name", plist_copy(value_node));
- plist_dict_insert_item(ret, "Display Name", plist_copy(value_node));
+ plist_dict_set_item(ret, "Device Name", plist_copy(value_node));
+ plist_dict_set_item(ret, "Display Name", plist_copy(value_node));
/* FIXME: How is the GUID generated? */
- plist_dict_insert_item(ret, "GUID", plist_new_string("---"));
+ plist_dict_set_item(ret, "GUID", plist_new_string("---"));
value_node = plist_dict_get_item(root_node, "IntegratedCircuitCardIdentity");
if (value_node)
- plist_dict_insert_item(ret, "ICCID", plist_copy(value_node));
+ plist_dict_set_item(ret, "ICCID", plist_copy(value_node));
value_node = plist_dict_get_item(root_node, "InternationalMobileEquipmentIdentity");
if (value_node)
- plist_dict_insert_item(ret, "IMEI", plist_copy(value_node));
+ plist_dict_set_item(ret, "IMEI", plist_copy(value_node));
- plist_dict_insert_item(ret, "Last Backup Date", plist_new_date(time(NULL), 0));
+ plist_dict_set_item(ret, "Last Backup Date", plist_new_date(time(NULL), 0));
value_node = plist_dict_get_item(root_node, "PhoneNumber");
if (value_node && (plist_get_node_type(value_node) == PLIST_STRING)) {
- plist_dict_insert_item(ret, "Phone Number", plist_copy(value_node));
+ plist_dict_set_item(ret, "Phone Number", plist_copy(value_node));
}
value_node = plist_dict_get_item(root_node, "ProductType");
- plist_dict_insert_item(ret, "Product Type", plist_copy(value_node));
+ plist_dict_set_item(ret, "Product Type", plist_copy(value_node));
value_node = plist_dict_get_item(root_node, "ProductVersion");
- plist_dict_insert_item(ret, "Product Version", plist_copy(value_node));
+ plist_dict_set_item(ret, "Product Version", plist_copy(value_node));
value_node = plist_dict_get_item(root_node, "SerialNumber");
- plist_dict_insert_item(ret, "Serial Number", plist_copy(value_node));
+ plist_dict_set_item(ret, "Serial Number", plist_copy(value_node));
/* FIXME Sync Settings? */
value_node = plist_dict_get_item(root_node, "UniqueDeviceID");
- plist_dict_insert_item(ret, "Target Identifier", plist_new_string(udid));
+ plist_dict_set_item(ret, "Target Identifier", plist_new_string(udid));
- plist_dict_insert_item(ret, "Target Type", plist_new_string("Device"));
+ plist_dict_set_item(ret, "Target Type", plist_new_string("Device"));
/* uppercase */
udid_uppercase = str_toupper((char*)udid);
- plist_dict_insert_item(ret, "Unique Identifier", plist_new_string(udid_uppercase));
+ plist_dict_set_item(ret, "Unique Identifier", plist_new_string(udid_uppercase));
free(udid_uppercase);
char *data_buf = NULL;
uint64_t data_size = 0;
mobilebackup_afc_get_file_contents(afc, "/Books/iBooksData2.plist", &data_buf, &data_size);
if (data_buf) {
- plist_dict_insert_item(ret, "iBooks Data 2", plist_new_data(data_buf, data_size));
+ plist_dict_set_item(ret, "iBooks Data 2", plist_new_data(data_buf, data_size));
free(data_buf);
}
@@ -352,17 +352,17 @@ static plist_t mobilebackup_factory_info_plist_new(const char* udid, lockdownd_c
mobilebackup_afc_get_file_contents(afc, fname, &data_buf, &data_size);
free(fname);
if (data_buf) {
- plist_dict_insert_item(files, itunesfiles[i], plist_new_data(data_buf, data_size));
+ plist_dict_set_item(files, itunesfiles[i], plist_new_data(data_buf, data_size));
free(data_buf);
}
}
- plist_dict_insert_item(ret, "iTunes Files", files);
+ plist_dict_set_item(ret, "iTunes Files", files);
plist_t itunes_settings = NULL;
lockdownd_get_value(lockdown, "com.apple.iTunes", NULL, &itunes_settings);
- plist_dict_insert_item(ret, "iTunes Settings", itunes_settings ? itunes_settings : plist_new_dict());
+ plist_dict_set_item(ret, "iTunes Settings", itunes_settings ? itunes_settings : plist_new_dict());
- plist_dict_insert_item(ret, "iTunes Version", plist_new_string("10.0.1"));
+ plist_dict_set_item(ret, "iTunes Version", plist_new_string("10.0.1"));
plist_free(root_node);
@@ -589,9 +589,9 @@ static void mb2_multi_status_add_file_error(plist_t status_dict, const char *pat
{
if (!status_dict) return;
plist_t filedict = plist_new_dict();
- plist_dict_insert_item(filedict, "DLFileErrorString", plist_new_string(error_message));
- plist_dict_insert_item(filedict, "DLFileErrorCode", plist_new_uint(error_code));
- plist_dict_insert_item(status_dict, path, filedict);
+ plist_dict_set_item(filedict, "DLFileErrorString", plist_new_string(error_message));
+ plist_dict_set_item(filedict, "DLFileErrorCode", plist_new_uint(error_code));
+ plist_dict_set_item(status_dict, path, filedict);
}
static int errno_to_device_error(int errno_value)
@@ -1055,11 +1055,11 @@ static void mb2_handle_list_directory(mobilebackup2_client_t mobilebackup2, plis
} else if (S_ISREG(st.st_mode)) {
ftype = "DLFileTypeRegular";
}
- plist_dict_insert_item(fdict, "DLFileType", plist_new_string(ftype));
- plist_dict_insert_item(fdict, "DLFileSize", plist_new_uint(st.st_size));
- plist_dict_insert_item(fdict, "DLFileModificationDate", plist_new_date(st.st_mtime, 0));
+ plist_dict_set_item(fdict, "DLFileType", plist_new_string(ftype));
+ plist_dict_set_item(fdict, "DLFileSize", plist_new_uint(st.st_size));
+ plist_dict_set_item(fdict, "DLFileModificationDate", plist_new_date(st.st_mtime, 0));
- plist_dict_insert_item(dirlist, ep->d_name, fdict);
+ plist_dict_set_item(dirlist, ep->d_name, fdict);
free(fpath);
}
}
@@ -1719,7 +1719,7 @@ checkpoint:
switch(cmd) {
case CMD_CLOUD:
opts = plist_new_dict();
- plist_dict_insert_item(opts, "CloudBackupState", plist_new_bool(cmd_flags & CMD_FLAG_CLOUD_ENABLE ? 1: 0));
+ plist_dict_set_item(opts, "CloudBackupState", plist_new_bool(cmd_flags & CMD_FLAG_CLOUD_ENABLE ? 1: 0));
err = mobilebackup2_send_request(mobilebackup2, "EnableCloudBackup", udid, source_udid, opts);
plist_free(opts);
opts = NULL;
@@ -1767,7 +1767,7 @@ checkpoint:
if (cmd_flags & CMD_FLAG_FORCE_FULL_BACKUP) {
PRINT_VERBOSE(1, "Enforcing full backup from device.\n");
opts = plist_new_dict();
- plist_dict_insert_item(opts, "ForceFullBackup", plist_new_bool(1));
+ plist_dict_set_item(opts, "ForceFullBackup", plist_new_bool(1));
}
/* request backup from device with manifest from last backup */
if (willEncrypt) {
@@ -1809,21 +1809,21 @@ checkpoint:
PRINT_VERBOSE(1, "Starting Restore...\n");
opts = plist_new_dict();
- plist_dict_insert_item(opts, "RestoreSystemFiles", plist_new_bool(cmd_flags & CMD_FLAG_RESTORE_SYSTEM_FILES));
+ plist_dict_set_item(opts, "RestoreSystemFiles", plist_new_bool(cmd_flags & CMD_FLAG_RESTORE_SYSTEM_FILES));
PRINT_VERBOSE(1, "Restoring system files: %s\n", (cmd_flags & CMD_FLAG_RESTORE_SYSTEM_FILES ? "Yes":"No"));
if ((cmd_flags & CMD_FLAG_RESTORE_REBOOT) == 0)
- plist_dict_insert_item(opts, "RestoreShouldReboot", plist_new_bool(0));
+ plist_dict_set_item(opts, "RestoreShouldReboot", plist_new_bool(0));
PRINT_VERBOSE(1, "Rebooting after restore: %s\n", (cmd_flags & CMD_FLAG_RESTORE_REBOOT ? "Yes":"No"));
if ((cmd_flags & CMD_FLAG_RESTORE_COPY_BACKUP) == 0)
- plist_dict_insert_item(opts, "RestoreDontCopyBackup", plist_new_bool(1));
+ plist_dict_set_item(opts, "RestoreDontCopyBackup", plist_new_bool(1));
PRINT_VERBOSE(1, "Don't copy backup: %s\n", ((cmd_flags & CMD_FLAG_RESTORE_COPY_BACKUP) == 0 ? "Yes":"No"));
- plist_dict_insert_item(opts, "RestorePreserveSettings", plist_new_bool((cmd_flags & CMD_FLAG_RESTORE_SETTINGS) == 0));
+ plist_dict_set_item(opts, "RestorePreserveSettings", plist_new_bool((cmd_flags & CMD_FLAG_RESTORE_SETTINGS) == 0));
PRINT_VERBOSE(1, "Preserve settings of device: %s\n", ((cmd_flags & CMD_FLAG_RESTORE_SETTINGS) == 0 ? "Yes":"No"));
if (cmd_flags & CMD_FLAG_RESTORE_REMOVE_ITEMS)
- plist_dict_insert_item(opts, "RemoveItemsNotRestored", plist_new_bool(1));
+ plist_dict_set_item(opts, "RemoveItemsNotRestored", plist_new_bool(1));
PRINT_VERBOSE(1, "Remove items that are not restored: %s\n", ((cmd_flags & CMD_FLAG_RESTORE_REMOVE_ITEMS) ? "Yes":"No"));
if (backup_password != NULL) {
- plist_dict_insert_item(opts, "Password", plist_new_string(backup_password));
+ plist_dict_set_item(opts, "Password", plist_new_string(backup_password));
}
PRINT_VERBOSE(1, "Backup password: %s\n", (backup_password == NULL ? "No":"Yes"));
@@ -1860,7 +1860,7 @@ checkpoint:
PRINT_VERBOSE(1, "Starting to unpack backup...\n");
if (backup_password != NULL) {
opts = plist_new_dict();
- plist_dict_insert_item(opts, "Password", plist_new_string(backup_password));
+ plist_dict_set_item(opts, "Password", plist_new_string(backup_password));
}
PRINT_VERBOSE(1, "Backup password: %s\n", (backup_password == NULL ? "No":"Yes"));
err = mobilebackup2_send_request(mobilebackup2, "Unback", udid, source_udid, opts);
@@ -1874,7 +1874,7 @@ checkpoint:
break;
case CMD_CHANGEPW:
opts = plist_new_dict();
- plist_dict_insert_item(opts, "TargetIdentifier", plist_new_string(udid));
+ plist_dict_set_item(opts, "TargetIdentifier", plist_new_string(udid));
if (cmd_flags & CMD_FLAG_ENCRYPTION_ENABLE) {
if (!willEncrypt) {
if (!newpw) {
@@ -1924,10 +1924,10 @@ checkpoint:
}
}
if (newpw) {
- plist_dict_insert_item(opts, "NewPassword", plist_new_string(newpw));
+ plist_dict_set_item(opts, "NewPassword", plist_new_string(newpw));
}
if (backup_password) {
- plist_dict_insert_item(opts, "OldPassword", plist_new_string(backup_password));
+ plist_dict_set_item(opts, "OldPassword", plist_new_string(backup_password));
}
if (newpw || backup_password) {
mobilebackup2_send_message(mobilebackup2, "ChangePassword", opts);