]> wimlib.net Git - wimlib/blobdiff - src/xml.c
win32_capture_streams(): Handle not implemented/supported
[wimlib] / src / xml.c
index 52cd441fe2ad38008c4f643b2020ef181a841c73..8d2b9106f3efb9d1ef3f971056ea4c44729a5c33 100644 (file)
--- a/src/xml.c
+++ b/src/xml.c
@@ -132,21 +132,37 @@ 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;
+}
+
+u64
+wim_info_get_image_hard_link_bytes(const struct wim_info *info, int image)
+{
+       if (info)
+               return info->images[image - 1].hard_link_bytes;
+       else
                return 0;
-       return info->total_bytes;
 }
 
 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;
 }
 
 /* Returns a statically allocated string that is a string representation of the
@@ -1270,6 +1286,7 @@ libxml_global_cleanup(void)
 int
 read_wim_xml_data(WIMStruct *wim)
 {
+       void *buf;
        u8 *xml_data;
        xmlDoc *doc;
        xmlNode *root;
@@ -1281,9 +1298,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);
@@ -1525,6 +1543,9 @@ wimlib_extract_xml_data(WIMStruct *wim, FILE *fp)
        void *buf;
        int ret;
 
+       if (!wim->filename)
+               return WIMLIB_ERR_INVALID_PARAM;
+
        ret = res_entry_to_data(&wim->hdr.xml_res_entry, wim, &buf);
        if (ret)
                goto out;