From 38595f0b7dac3d53033f93e9893d9be49996ba95 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Sat, 27 Nov 2021 00:02:16 +0100 Subject: Use macros for the different restore variant strings --- src/idevicerestore.c | 6 +++--- src/idevicerestore.h | 4 ++++ src/restore.c | 6 +++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/idevicerestore.c b/src/idevicerestore.c index 017b45c..f0dc8ad 100644 --- a/src/idevicerestore.c +++ b/src/idevicerestore.c @@ -816,20 +816,20 @@ int idevicerestore_start(struct idevicerestore_client_t* client) // add info inf = plist_new_dict(); plist_dict_set_item(inf, "RestoreBehavior", plist_new_string((client->flags & FLAG_ERASE) ? "Erase" : "Update")); - plist_dict_set_item(inf, "Variant", plist_new_string((client->flags & FLAG_ERASE) ? "Customer Erase Install (IPSW)" : "Customer Upgrade Install (IPSW)")); + plist_dict_set_item(inf, "Variant", plist_new_string((client->flags & FLAG_ERASE) ? RESTORE_VARIANT_CUSTOMER_ERASE : RESTORE_VARIANT_CUSTOMER_UPGRADE)); plist_dict_set_item(build_identity, "Info", inf); // finally add manifest plist_dict_set_item(build_identity, "Manifest", manifest); } } else if (client->flags & FLAG_ERASE) { - build_identity = build_manifest_get_build_identity_for_model_with_variant(client->build_manifest, client->device->hardware_model, "Customer Erase Install (IPSW)"); + build_identity = build_manifest_get_build_identity_for_model_with_variant(client->build_manifest, client->device->hardware_model, RESTORE_VARIANT_CUSTOMER_ERASE); if (build_identity == NULL) { error("ERROR: Unable to find any build identities\n"); return -1; } } else { - build_identity = build_manifest_get_build_identity_for_model_with_variant(client->build_manifest, client->device->hardware_model, "Customer Upgrade Install (IPSW)"); + build_identity = build_manifest_get_build_identity_for_model_with_variant(client->build_manifest, client->device->hardware_model, RESTORE_VARIANT_CUSTOMER_UPGRADE); if (!build_identity) { build_identity = build_manifest_get_build_identity_for_model(client->build_manifest, client->device->hardware_model); } diff --git a/src/idevicerestore.h b/src/idevicerestore.h index 880f9ee..f9ab18f 100644 --- a/src/idevicerestore.h +++ b/src/idevicerestore.h @@ -47,6 +47,10 @@ extern "C" { #define FLAG_NO_RESTORE (1 << 11) #define FLAG_IGNORE_ERRORS (1 << 12) +#define RESTORE_VARIANT_CUSTOMER_ERASE "Customer Erase Install (IPSW)" +#define RESTORE_VARIANT_CUSTOMER_UPGRADE "Customer Upgrade Install (IPSW)" +#define RESTORE_VARIANT_MACOS_RECOVERY_OS "macOS Customer" + struct idevicerestore_client_t; enum { diff --git a/src/restore.c b/src/restore.c index 7b61766..e29ae97 100644 --- a/src/restore.c +++ b/src/restore.c @@ -2955,11 +2955,11 @@ plist_t restore_get_build_identity(struct idevicerestore_client_t* client, uint8 const char *variant; if (is_recover_os) - variant = "macOS Customer"; + variant = RESTORE_VARIANT_MACOS_RECOVERY_OS; else if (client->flags & FLAG_ERASE) - variant = "Customer Erase Install (IPSW)"; + variant = RESTORE_VARIANT_CUSTOMER_ERASE; else - variant = "Customer Upgrade Install (IPSW)"; + variant = RESTORE_VARIANT_CUSTOMER_UPGRADE; plist_t build_identity = build_manifest_get_build_identity_for_model_with_variant( client->build_manifest, -- cgit v1.1-32-gdbae