summaryrefslogtreecommitdiffstats
path: root/src/libirecovery.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2020-01-14 02:54:01 +0100
committerGravatar Nikias Bassen2020-01-14 02:54:01 +0100
commit1c2f7ad5e409a5ad38bf01a10501344f58a2d87b (patch)
tree2f5a10c4cd9596cfea48a1a0da5f7d726571876f /src/libirecovery.c
parentdb36196d8d9db5a1f92e6934cf931cd00a6ead2d (diff)
downloadlibirecovery-1c2f7ad5e409a5ad38bf01a10501344f58a2d87b.tar.gz
libirecovery-1c2f7ad5e409a5ad38bf01a10501344f58a2d87b.tar.bz2
Use PRI* and SCN* (inttypes.h) format string macros instead of self-defined ones
... also print all values in irecovery as hex with 0x prefix to make it clear they are hex
Diffstat (limited to 'src/libirecovery.c')
-rw-r--r--src/libirecovery.c15
1 files changed, 6 insertions, 9 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 @@
2 * libirecovery.c 2 * libirecovery.c
3 * Communication to iBoot/iBSS on Apple iOS devices via USB 3 * Communication to iBoot/iBSS on Apple iOS devices via USB
4 * 4 *
5 * Copyright (c) 2011-2019 Nikias Bassen <nikias@gmx.li> 5 * Copyright (c) 2011-2020 Nikias Bassen <nikias@gmx.li>
6 * Copyright (c) 2012-2015 Martin Szulecki <martin.szulecki@libimobiledevice.org> 6 * Copyright (c) 2012-2015 Martin Szulecki <martin.szulecki@libimobiledevice.org>
7 * Copyright (c) 2010 Chronic-Dev Team 7 * Copyright (c) 2010 Chronic-Dev Team
8 * Copyright (c) 2010 Joshua Hill 8 * Copyright (c) 2010 Joshua Hill
@@ -27,6 +27,7 @@
27#include <stdint.h> 27#include <stdint.h>
28#include <stdlib.h> 28#include <stdlib.h>
29#include <string.h> 29#include <string.h>
30#include <inttypes.h>
30#include <ctype.h> 31#include <ctype.h>
31#include <unistd.h> 32#include <unistd.h>
32#include <sys/stat.h> 33#include <sys/stat.h>
@@ -45,14 +46,10 @@
45#include <IOKit/IOCFPlugIn.h> 46#include <IOKit/IOCFPlugIn.h>
46#include <pthread.h> 47#include <pthread.h>
47#endif 48#endif
48#define _FMT_qX "%qX"
49#define _FMT_016llx "%016llx"
50#else 49#else
51#define WIN32_LEAN_AND_MEAN 50#define WIN32_LEAN_AND_MEAN
52#include <windows.h> 51#include <windows.h>
53#include <setupapi.h> 52#include <setupapi.h>
54#define _FMT_qX "%I64X"
55#define _FMT_016llx "%016I64x"
56#ifndef sleep 53#ifndef sleep
57#define sleep(n) Sleep(1000 * n) 54#define sleep(n) Sleep(1000 * n)
58#endif 55#endif
@@ -509,7 +506,7 @@ static void irecv_load_device_info_from_iboot_string(irecv_client_t client, cons
509 506
510 ptr = strstr(iboot_string, "ECID:"); 507 ptr = strstr(iboot_string, "ECID:");
511 if (ptr != NULL) { 508 if (ptr != NULL) {
512 sscanf(ptr, "ECID:" _FMT_qX, &client->device_info.ecid); 509 sscanf(ptr, "ECID:%" SCNx64, &client->device_info.ecid);
513 } 510 }
514 511
515 ptr = strstr(iboot_string, "IBFL:"); 512 ptr = strstr(iboot_string, "IBFL:");
@@ -739,7 +736,7 @@ irecv_error_t mobiledevice_connect(irecv_client_t* client, unsigned long long ec
739 mobiledevice_closepipes(_client); 736 mobiledevice_closepipes(_client);
740 continue; 737 continue;
741 } 738 }
742 debug("found device with ECID " _FMT_016llx "\n", (unsigned long long)ecid); 739 debug("found device with ECID %016" PRIx64 "\n", (unsigned long long)ecid);
743 } 740 }
744 found = 1; 741 found = 1;
745 break; 742 break;
@@ -821,7 +818,7 @@ irecv_error_t mobiledevice_connect(irecv_client_t* client, unsigned long long ec
821 mobiledevice_closepipes(_client); 818 mobiledevice_closepipes(_client);
822 continue; 819 continue;
823 } 820 }
824 debug("found device with ECID " _FMT_016llx" \n", (unsigned long long)ecid); 821 debug("found device with ECID %016" PRIx64 "\n", (unsigned long long)ecid);
825 } 822 }
826 found = 1; 823 found = 1;
827 break; 824 break;
@@ -1368,7 +1365,7 @@ IRECV_API irecv_error_t irecv_open_with_ecid(irecv_client_t* pclient, unsigned l
1368 irecv_close(client); 1365 irecv_close(client);
1369 continue; 1366 continue;
1370 } 1367 }
1371 debug("found device with ECID " _FMT_016llx "\n", (unsigned long long)ecid); 1368 debug("found device with ECID %016" PRIx64 "\n", (unsigned long long)ecid);
1372 } 1369 }
1373 1370
1374 error = irecv_usb_set_configuration(client, 1); 1371 error = irecv_usb_set_configuration(client, 1);