summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Rosen Penev2019-12-10 20:42:15 -0800
committerGravatar Rosen Penev2020-04-12 16:05:01 -0700
commite29aef80350b5ee4bf989443acf553f5f295df4c (patch)
tree6db009f260e563a1c10ab79e89b32739a5f0a1dc
parentfc456a2fa763165453a6a46bbcd030d348b0820b (diff)
downloadidevicerestore-e29aef80350b5ee4bf989443acf553f5f295df4c.tar.gz
idevicerestore-e29aef80350b5ee4bf989443acf553f5f295df4c.tar.bz2
Fix format compiler warnings
This also allows the compiler to check these at compile time.
-rw-r--r--src/common.c5
-rw-r--r--src/common.h3
-rw-r--r--src/idevicerestore.c2
3 files changed, 7 insertions, 3 deletions
diff --git a/src/common.c b/src/common.c
index cc275f0..325ea2d 100644
--- a/src/common.c
+++ b/src/common.c
@@ -25,6 +25,7 @@
#include <config.h>
#endif
+#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -589,7 +590,7 @@ uint64_t _plist_dict_get_uint(plist_t dict, const char *key)
} else if (strsz == 1) {
uintval = strval[0];
} else {
- error("%s: ERROR: invalid size %d for data to integer conversion\n", __func__, strsz);
+ error("%s: ERROR: invalid size %" PRIu64 " for data to integer conversion\n", __func__, strsz);
}
free(strval);
}
@@ -635,7 +636,7 @@ uint8_t _plist_dict_get_bool(plist_t dict, const char *key)
if (strsz == 1) {
bval = strval[0];
} else {
- error("%s: ERROR: invalid size %d for data to boolean conversion\n", __func__, strsz);
+ error("%s: ERROR: invalid size %" PRIu64 " for data to boolean conversion\n", __func__, strsz);
}
free(strval);
}
diff --git a/src/common.h b/src/common.h
index d943568..af46737 100644
--- a/src/common.h
+++ b/src/common.h
@@ -118,8 +118,11 @@ extern struct idevicerestore_mode_t idevicerestore_modes[];
extern int idevicerestore_debug;
+__attribute__((format(printf, 1, 2)))
void info(const char* format, ...);
+__attribute__((format(printf, 1, 2)))
void error(const char* format, ...);
+__attribute__((format(printf, 1, 2)))
void debug(const char* format, ...);
void debug_plist(plist_t plist);
diff --git a/src/idevicerestore.c b/src/idevicerestore.c
index 03e4811..1ce642b 100644
--- a/src/idevicerestore.c
+++ b/src/idevicerestore.c
@@ -496,7 +496,7 @@ int idevicerestore_start(struct idevicerestore_client_t* client)
}
unsigned long selected = strtoul(input, NULL, 10);
if (selected == 0 || selected > count) {
- printf("Invalid input value. Must be in range: 1..%d\n", count);
+ printf("Invalid input value. Must be in range: 1..%u\n", count);
continue;
}
selected_fw = plist_array_get_item(signed_fws, (uint32_t)selected-1);