diff options
| author | 2026-12-03 09:47:42 +0100 | |
|---|---|---|
| committer | 2026-12-03 09:47:42 +0100 | |
| commit | 1e04e19a4d3832cfadd3aaaefdba1531fa212b27 (patch) | |
| tree | 431a4a8d3606a1819788a2347cc2dceb05c90395 /src | |
| parent | 749ec61b5c2f94af0ab2b5e09579fe0ea6fdd27f (diff) | |
| download | idevicerestore-master.tar.gz idevicerestore-master.tar.bz2 | |
Diffstat (limited to 'src')
| -rw-r--r-- | src/idevicerestore.c | 12 | ||||
| -rw-r--r-- | src/ipsw.c | 15 | ||||
| -rw-r--r-- | src/locking.c | 4 | ||||
| -rw-r--r-- | src/mbn.c | 2 | ||||
| -rw-r--r-- | src/restore.c | 4 |
5 files changed, 17 insertions, 20 deletions
diff --git a/src/idevicerestore.c b/src/idevicerestore.c index 825e24c..e2a9f03 100644 --- a/src/idevicerestore.c +++ b/src/idevicerestore.c @@ -493,20 +493,20 @@ int idevicerestore_start(struct idevicerestore_client_t* client) load_version_data(client); // Download WTF IPSW - char* s_wtfurl = NULL; + const char* s_wtfurl = NULL; plist_t wtfurl = plist_access_path(client->version_data, 7, "MobileDeviceSoftwareVersionsByVersion", "5", "RecoverySoftwareVersions", "WTF", "304218112", "5", "FirmwareURL"); - if (wtfurl && (plist_get_node_type(wtfurl) == PLIST_STRING)) { - plist_get_string_val(wtfurl, &s_wtfurl); + if (PLIST_IS_STRING(wtfurl)) { + s_wtfurl = plist_get_string_ptr(wtfurl, NULL); } if (!s_wtfurl) { logger(LL_INFO, "Using hardcoded x12220000_5_Recovery.ipsw URL\n"); - s_wtfurl = strdup("http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iPhone/061-6618.20090617.Xse7Y/x12220000_5_Recovery.ipsw"); + s_wtfurl = "http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iPhone/061-6618.20090617.Xse7Y/x12220000_5_Recovery.ipsw"; } // make a local file name - char* fnpart = strrchr(s_wtfurl, '/'); + const char* fnpart = strrchr(s_wtfurl, '/'); if (!fnpart) { - fnpart = (char*)"x12220000_5_Recovery.ipsw"; + fnpart = "x12220000_5_Recovery.ipsw"; } else { fnpart++; } @@ -467,10 +467,8 @@ int ipsw_extract_to_file_with_progress(ipsw_archive_t ipsw, const char* infile, size = i; count = zip_fread(zfile, buffer, size); if (count < 0) { - int zep = 0; - int sep = 0; - zip_file_error_get(zfile, &zep, &sep); - logger(LL_ERROR, "zip_fread: %s %d %d\n", infile, zep, sep); + zip_error_t *zerr = zip_file_get_error(zfile); + logger(LL_ERROR, "zip_fread: %s %d %d\n", infile, zip_error_code_zip(zerr), zip_error_code_system(zerr)); ret = -1; break; } @@ -683,16 +681,15 @@ int ipsw_extract_to_memory(ipsw_archive_t ipsw, const char* infile, void** pbuff } zip_int64_t zr = zip_fread(zfile, buffer, size); - int zep = 0; - int sep = 0; + zip_error_t *zerr = NULL; if (zr < 0) { - zip_file_error_get(zfile, &zep, &sep); + zerr = zip_file_get_error(zfile); } zip_fclose(zfile); zip_unchange_all(zip); zip_close(zip); if (zr < 0) { - logger(LL_ERROR, "zip_fread: %s %d %d\n", infile, zep, sep); + logger(LL_ERROR, "zip_fread: %s %d %d\n", infile, zip_error_code_zip(zerr), zip_error_code_system(zerr)); free(buffer); return -1; } else if (zr != size) { @@ -1302,7 +1299,7 @@ static int sha1_verify_fp(FILE* f, unsigned char* expected_sha1) int ipsw_download_fw(const char *fwurl, unsigned char* isha1, const char* todir, char** ipswfile) { - char* fwfn = strrchr(fwurl, '/'); + const char* fwfn = strrchr(fwurl, '/'); if (!fwfn) { logger(LL_ERROR, "can't get local filename for firmware ipsw\n"); return -2; diff --git a/src/locking.c b/src/locking.c index 05f0e4f..ec4be8d 100644 --- a/src/locking.c +++ b/src/locking.c @@ -43,7 +43,7 @@ int lock_file(const char* filename, lock_info_t* lockinfo) lockinfo->ldata.OffsetHigh = 0; if (!LockFileEx(lockinfo->fp, LOCKFILE_EXCLUSIVE_LOCK, 0, 1, 0, &lockinfo->ldata)) { - logger(LL_DEBUG, "ERROR: can't lock file, error %d\n", GetLastError()); + logger(LL_DEBUG, "ERROR: can't lock file, error %ld\n", (long)GetLastError()); CloseHandle(lockinfo->fp); lockinfo->fp = INVALID_HANDLE_VALUE; return -1; @@ -85,7 +85,7 @@ int unlock_file(lock_info_t* lockinfo) lockinfo->ldata.OffsetHigh = 0; if (!UnlockFileEx(lockinfo->fp, 0, 1, 0, &lockinfo->ldata)) { - logger(LL_DEBUG, "ERROR: can't unlock file, error %d\n", GetLastError()); + logger(LL_DEBUG, "ERROR: can't unlock file, error %ld\n", (long)GetLastError()); CloseHandle(lockinfo->fp); lockinfo->fp = INVALID_HANDLE_VALUE; return -1; @@ -275,7 +275,7 @@ void* mbn_stitch(const void* data, size_t data_size, const void* blob, size_t bl } memcpy(buf, data, data_size); - logger(LL_DEBUG, "%s: stitching mbn at 0x%llx, size 0x%zx\n", __func__, stitch_offset, blob_size); + logger(LL_DEBUG, "%s: stitching mbn at 0x%llx, size 0x%zx\n", __func__, (uint64_t)stitch_offset, blob_size); memcpy(buf + stitch_offset, blob, blob_size); return buf; diff --git a/src/restore.c b/src/restore.c index e220598..cec70ce 100644 --- a/src/restore.c +++ b/src/restore.c @@ -2085,7 +2085,7 @@ static int restore_sign_bbfw(const char* bbfwtmp, plist_t bbtss, const unsigned logger(LL_ERROR, "can't match element name '%s' to baseband firmware file name.\n", key); goto leave; } - char* ext = strrchr(signfn, '.'); + const char* ext = strrchr(signfn, '.'); if (!strcmp(ext, ".fls")) { is_fls = 1; } @@ -2211,7 +2211,7 @@ static int restore_sign_bbfw(const char* bbfwtmp, plist_t bbtss, const unsigned const char* fn = zip_get_name(za, i, 0); if (!keep) { if (fn) { - char* ext = strrchr(fn, '.'); + const char* ext = strrchr(fn, '.'); if (ext && (!strcmp(ext, ".fls") || !strcmp(ext, ".mbn") || !strcmp(ext, ".elf") || !strcmp(ext, ".bin"))) { keep = 1; } |
