X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=src%2Fxml.c;h=ffb25e1639e5ada69edc4f7ec14dcce15375f908;hb=926ff6c5ed956b96fcb521b2c20afcf9ac890b14;hp=419dfd8a82e8d5af38f057e7e0a337787a91c14f;hpb=e3689bfa91c108ea0f5c86160bd594f98cd541a6;p=wimlib diff --git a/src/xml.c b/src/xml.c index 419dfd8a..ffb25e16 100644 --- a/src/xml.c +++ b/src/xml.c @@ -132,42 +132,68 @@ windows_info_xml_string_specs[] = { u64 wim_info_get_total_bytes(const struct wim_info *info) { - if (!info) + if (info) + return info->total_bytes; + else return 0; - return info->total_bytes; } u64 wim_info_get_image_hard_link_bytes(const struct wim_info *info, int image) { - return info->images[image - 1].hard_link_bytes; + if (info) + return info->images[image - 1].hard_link_bytes; + else + return 0; } u64 wim_info_get_image_total_bytes(const struct wim_info *info, int image) { - return info->images[image - 1].total_bytes; + if (info) + return info->images[image - 1].total_bytes; + else + return 0; } unsigned wim_info_get_num_images(const struct wim_info *info) { - return info->num_images; + if (info) + return info->num_images; + else + return 0; } +/* Architecture constants are from w64 mingw winnt.h */ +#define PROCESSOR_ARCHITECTURE_INTEL 0 +#define PROCESSOR_ARCHITECTURE_MIPS 1 +#define PROCESSOR_ARCHITECTURE_ALPHA 2 +#define PROCESSOR_ARCHITECTURE_PPC 3 +#define PROCESSOR_ARCHITECTURE_SHX 4 +#define PROCESSOR_ARCHITECTURE_ARM 5 +#define PROCESSOR_ARCHITECTURE_IA64 6 +#define PROCESSOR_ARCHITECTURE_ALPHA64 7 +#define PROCESSOR_ARCHITECTURE_MSIL 8 +#define PROCESSOR_ARCHITECTURE_AMD64 9 +#define PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 10 + /* Returns a statically allocated string that is a string representation of the * architecture number. */ static const tchar * get_arch(int arch) { switch (arch) { - case 0: + case PROCESSOR_ARCHITECTURE_INTEL: return T("x86"); - case 6: + case PROCESSOR_ARCHITECTURE_MIPS: + return T("MIPS"); + case PROCESSOR_ARCHITECTURE_ARM: + return T("ARM"); + case PROCESSOR_ARCHITECTURE_IA64: return T("ia64"); - case 9: + case PROCESSOR_ARCHITECTURE_AMD64: return T("x86_64"); - /* XXX Are there other arch values? */ default: return T("unknown"); } @@ -1276,6 +1302,7 @@ libxml_global_cleanup(void) int read_wim_xml_data(WIMStruct *wim) { + void *buf; u8 *xml_data; xmlDoc *doc; xmlNode *root; @@ -1287,9 +1314,10 @@ read_wim_xml_data(WIMStruct *wim) DEBUG("Reading XML data: %"PRIu64" bytes at offset %"PRIu64"", (u64)res_entry->size, res_entry->offset); - ret = res_entry_to_data(res_entry, wim, (void**)&xml_data); + ret = res_entry_to_data(res_entry, wim, &buf); if (ret) goto out; + xml_data = buf; doc = xmlReadMemory((const char *)xml_data, res_entry->original_size, NULL, "UTF-16LE", 0);