tchar *display_name;
tchar *display_description;
tchar *flags;
- struct wim_lookup_table *lookup_table; /* Temporary field only */
};
struct xml_string_spec {
calculate_dentry_statistics(struct wim_dentry *dentry, void *arg)
{
struct image_info *info = arg;
- struct wim_lookup_table *lookup_table = info->lookup_table;
const struct wim_inode *inode = dentry->d_inode;
struct wim_lookup_table_entry *lte;
* link bytes", and this size is multiplied by the link count (NOT one
* less than the link count).
*/
- lte = inode_unnamed_lte(inode, info->lookup_table);
+ lte = inode_unnamed_lte_resolved(inode);
if (lte) {
info->total_bytes += wim_resource_size(lte);
if (!dentry_is_first_in_inode(dentry))
if (inode->i_nlink >= 2 && dentry_is_first_in_inode(dentry)) {
for (unsigned i = 0; i < inode->i_num_ads; i++) {
if (inode->i_ads_entries[i].stream_name_nbytes) {
- lte = inode_stream_lte(inode, i + 1, lookup_table);
+ lte = inode_stream_lte_resolved(inode, i + 1);
if (lte) {
info->hard_link_bytes += inode->i_nlink *
wim_resource_size(lte);
image_info->dir_count = 0;
image_info->total_bytes = 0;
image_info->hard_link_bytes = 0;
- image_info->lookup_table = w->lookup_table;
for_dentry_in_tree(w->image_metadata[image - 1]->root_dentry,
calculate_dentry_statistics,
*/
int
read_xml_data(FILE *fp, const struct resource_entry *res_entry,
- utf16lechar **xml_data_ret, struct wim_info **info_ret)
+ struct wim_info **info_ret)
{
utf16lechar *xml_data;
xmlDoc *doc;
ret = read_uncompressed_resource(fp, res_entry->offset,
res_entry->size, xml_data);
- if (ret != 0)
+ if (ret)
goto out_free_xml_data;
/* Null-terminate just in case */
ret = WIMLIB_ERR_XML;
goto out_free_doc;
}
-
ret = xml_read_wim_info(root, info_ret);
- if (ret != 0)
- goto out_free_doc;
-
- *xml_data_ret = xml_data;
- xml_data = NULL;
out_free_doc:
DEBUG("Freeing XML tree.");
xmlFreeDoc(doc);
wimlib_extract_xml_data(WIMStruct *w, FILE *fp)
{
size_t bytes_written;
+ size_t size;
+ void *buf;
+ int ret;
- if (!w->xml_data)
- return WIMLIB_ERR_INVALID_PARAM;
- bytes_written = fwrite(w->xml_data, 1, w->hdr.xml_res_entry.size, fp);
- if (bytes_written != w->hdr.xml_res_entry.size) {
+ size = w->hdr.xml_res_entry.size;
+ if (sizeof(size_t) < sizeof(u64))
+ if (size != w->hdr.xml_res_entry.size)
+ return WIMLIB_ERR_INVALID_PARAM;
+
+ buf = MALLOC(size);
+ if (!buf)
+ return WIMLIB_ERR_NOMEM;
+
+ ret = read_uncompressed_resource(w->fp, w->hdr.xml_res_entry.offset,
+ size, buf);
+ if (ret)
+ goto out_free_buf;
+
+ if (fwrite(buf, 1, size, fp) != size) {
ERROR_WITH_ERRNO("Failed to extract XML data");
- return WIMLIB_ERR_WRITE;
+ ret = WIMLIB_ERR_WRITE;
+ } else {
+ ret = 0;
}
- return 0;
+out_free_buf:
+ FREE(buf);
+ return ret;
}
/* Sets the name of an image in the WIM. */