diff options
author | Nikias Bassen | 2019-08-28 18:17:59 +0200 |
---|---|---|
committer | Nikias Bassen | 2019-08-28 18:17:59 +0200 |
commit | a56029b6d3c072579ee1da7a9f40ec6b1d1f6626 (patch) | |
tree | b0aab308aab70b085ad3f2cf1d19c4d52d979912 /src/common.c | |
parent | 9f43793b89b600d519e9e76581c1fe427c08baac (diff) | |
download | idevicerestore-a56029b6d3c072579ee1da7a9f40ec6b1d1f6626.tar.gz idevicerestore-a56029b6d3c072579ee1da7a9f40ec6b1d1f6626.tar.bz2 |
Add plist dictionary helper
Diffstat (limited to 'src/common.c')
-rw-r--r-- | src/common.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/common.c b/src/common.c index 79dc123..a00cc05 100644 --- a/src/common.c +++ b/src/common.c @@ -547,3 +547,25 @@ void get_user_input(char *buf, int maxlen, int secure) fputs("\n", stdout); buf[len] = 0; } + +uint64_t _plist_dict_get_uint(plist_t dict, const char *key) +{ + uint64_t uintval = 0; + plist_t node = plist_dict_get_item(dict, key); + if (!node) { + return (uint64_t)-1LL; + } + plist_get_uint_val(node, &uintval); + return uintval; +} + +uint8_t _plist_dict_get_bool(plist_t dict, const char *key) +{ + uint8_t bval = 0; + plist_t node = plist_dict_get_item(dict, key); + if (!node) { + return 0; + } + plist_get_bool_val(node, &bval); + return bval; +} |