From eda2c5ea71829f11d69342e6858d09aa53943938 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Fri, 21 Apr 2023 16:51:26 +0200 Subject: Updated to use latest libplist API changes --- tools/ideviceimagemounter.c | 41 ++++++----------------------------------- 1 file changed, 6 insertions(+), 35 deletions(-) (limited to 'tools/ideviceimagemounter.c') diff --git a/tools/ideviceimagemounter.c b/tools/ideviceimagemounter.c index 4ea38a9..f551b6c 100644 --- a/tools/ideviceimagemounter.c +++ b/tools/ideviceimagemounter.c @@ -46,7 +46,7 @@ #include #include #include -#include +#include static int list_mode = 0; static int use_network = 0; @@ -143,15 +143,6 @@ static void parse_opts(int argc, char **argv) } } -static void print_xml(plist_t node) -{ - char *xml = NULL; - uint32_t len = 0; - plist_to_xml(node, &xml, &len); - if (xml) - puts(xml); -} - static ssize_t mim_upload_cb(void* buf, size_t size, void* userdata) { return fread(buf, 1, size, (FILE*)userdata); @@ -297,11 +288,7 @@ int main(int argc, char **argv) err = mobile_image_mounter_lookup_image(mim, imagetype, &result); if (err == MOBILE_IMAGE_MOUNTER_E_SUCCESS) { res = 0; - if (xml_mode) { - print_xml(result); - } else { - plist_print_to_stream(result, stdout); - } + plist_write_to_stream(result, stdout, (xml_mode) ? PLIST_FORMAT_XML : PLIST_FORMAT_LIMD, 0); } else { printf("Error: lookup_image returned %d\n", err); } @@ -429,20 +416,12 @@ int main(int argc, char **argv) res = 0; } else { printf("unexpected status value:\n"); - if (xml_mode) { - print_xml(result); - } else { - plist_print_to_stream(result, stdout); - } + plist_write_to_stream(result, stdout, (xml_mode) ? PLIST_FORMAT_XML : PLIST_FORMAT_LIMD, 0); } free(status); } else { printf("unexpected result:\n"); - if (xml_mode) { - print_xml(result); - } else { - plist_print_to_stream(result, stdout); - } + plist_write_to_stream(result, stdout, (xml_mode) ? PLIST_FORMAT_XML : PLIST_FORMAT_LIMD, 0); } } node = plist_dict_get_item(result, "Error"); @@ -454,19 +433,11 @@ int main(int argc, char **argv) free(error); } else { printf("unexpected result:\n"); - if (xml_mode) { - print_xml(result); - } else { - plist_print_to_stream(result, stdout); - } + plist_write_to_stream(result, stdout, (xml_mode) ? PLIST_FORMAT_XML : PLIST_FORMAT_LIMD, 0); } } else { - if (xml_mode) { - print_xml(result); - } else { - plist_print_to_stream(result, stdout); - } + plist_write_to_stream(result, stdout, (xml_mode) ? PLIST_FORMAT_XML : PLIST_FORMAT_LIMD, 0); } } } else { -- cgit v1.1-32-gdbae