summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/libirecovery.c15
-rw-r--r--tools/irecovery.c20
2 files changed, 15 insertions, 20 deletions
diff --git a/src/libirecovery.c b/src/libirecovery.c
index 56294a6..f932684 100644
--- a/src/libirecovery.c
+++ b/src/libirecovery.c
@@ -2,7 +2,7 @@
* libirecovery.c
* Communication to iBoot/iBSS on Apple iOS devices via USB
*
- * Copyright (c) 2011-2019 Nikias Bassen <nikias@gmx.li>
+ * Copyright (c) 2011-2020 Nikias Bassen <nikias@gmx.li>
* Copyright (c) 2012-2015 Martin Szulecki <martin.szulecki@libimobiledevice.org>
* Copyright (c) 2010 Chronic-Dev Team
* Copyright (c) 2010 Joshua Hill
@@ -27,6 +27,7 @@
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
+#include <inttypes.h>
#include <ctype.h>
#include <unistd.h>
#include <sys/stat.h>
@@ -45,14 +46,10 @@
#include <IOKit/IOCFPlugIn.h>
#include <pthread.h>
#endif
-#define _FMT_qX "%qX"
-#define _FMT_016llx "%016llx"
#else
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <setupapi.h>
-#define _FMT_qX "%I64X"
-#define _FMT_016llx "%016I64x"
#ifndef sleep
#define sleep(n) Sleep(1000 * n)
#endif
@@ -509,7 +506,7 @@ static void irecv_load_device_info_from_iboot_string(irecv_client_t client, cons
ptr = strstr(iboot_string, "ECID:");
if (ptr != NULL) {
- sscanf(ptr, "ECID:" _FMT_qX, &client->device_info.ecid);
+ sscanf(ptr, "ECID:%" SCNx64, &client->device_info.ecid);
}
ptr = strstr(iboot_string, "IBFL:");
@@ -739,7 +736,7 @@ irecv_error_t mobiledevice_connect(irecv_client_t* client, unsigned long long ec
mobiledevice_closepipes(_client);
continue;
}
- debug("found device with ECID " _FMT_016llx "\n", (unsigned long long)ecid);
+ debug("found device with ECID %016" PRIx64 "\n", (unsigned long long)ecid);
}
found = 1;
break;
@@ -821,7 +818,7 @@ irecv_error_t mobiledevice_connect(irecv_client_t* client, unsigned long long ec
mobiledevice_closepipes(_client);
continue;
}
- debug("found device with ECID " _FMT_016llx" \n", (unsigned long long)ecid);
+ debug("found device with ECID %016" PRIx64 "\n", (unsigned long long)ecid);
}
found = 1;
break;
@@ -1368,7 +1365,7 @@ IRECV_API irecv_error_t irecv_open_with_ecid(irecv_client_t* pclient, unsigned l
irecv_close(client);
continue;
}
- debug("found device with ECID " _FMT_016llx "\n", (unsigned long long)ecid);
+ debug("found device with ECID %016" PRIx64 "\n", (unsigned long long)ecid);
}
error = irecv_usb_set_configuration(client, 1);
diff --git a/tools/irecovery.c b/tools/irecovery.c
index 6ee89b0..91d1d48 100644
--- a/tools/irecovery.c
+++ b/tools/irecovery.c
@@ -2,7 +2,7 @@
* irecovery.c
* Software frontend for iBoot/iBSS communication with iOS devices
*
- * Copyright (c) 2012-2019 Nikias Bassen <nikias@gmx.li>
+ * Copyright (c) 2012-2020 Nikias Bassen <nikias@gmx.li>
* Copyright (c) 2012-2015 Martin Szulecki <martin.szulecki@libimobiledevice.org>
* Copyright (c) 2010-2011 Chronic-Dev Team
* Copyright (c) 2010-2011 Joshua Hill
@@ -27,6 +27,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
+#include <inttypes.h>
#include <libirecovery.h>
#include <readline/readline.h>
#include <readline/history.h>
@@ -36,9 +37,6 @@
#ifndef sleep
#define sleep(n) Sleep(1000 * n)
#endif
-#define _FMT_lld "%I64d"
-#else
-#define _FMT_lld "%lld"
#endif
#define FILE_HISTORY_PATH ".irecovery"
@@ -134,13 +132,13 @@ static void print_device_info(irecv_client_t client)
int ret, mode;
const struct irecv_device_info *devinfo = irecv_get_device_info(client);
if (devinfo) {
- printf("CPID: %04x\n", devinfo->cpid);
- printf("CPRV: %02x\n", devinfo->cprv);
- printf("BDID: %02x\n", devinfo->bdid);
- printf("ECID: " _FMT_lld "\n", devinfo->ecid);
- printf("CPFM: %02x\n", devinfo->cpfm);
- printf("SCEP: %02x\n", devinfo->scep);
- printf("IBFL: %02x\n", devinfo->ibfl);
+ printf("CPID: 0x%04x\n", devinfo->cpid);
+ printf("CPRV: 0x%02x\n", devinfo->cprv);
+ printf("BDID: 0x%02x\n", devinfo->bdid);
+ printf("ECID: 0x%016" PRIx64 "\n", devinfo->ecid);
+ printf("CPFM: 0x%02x\n", devinfo->cpfm);
+ printf("SCEP: 0x%02x\n", devinfo->scep);
+ printf("IBFL: 0x%02x\n", devinfo->ibfl);
printf("SRTG: %s\n", (devinfo->srtg) ? devinfo->srtg : "N/A");
printf("SRNM: %s\n", (devinfo->srnm) ? devinfo->srnm : "N/A");
printf("IMEI: %s\n", (devinfo->imei) ? devinfo->imei : "N/A");