/*
* wim.c
- *
- *
+ */
+
+/*
* Copyright (C) 2010 Carl Thijssen
* Copyright (C) 2012 Eric Biggers
*
* wimlib - Library for working with WIM files
*
- * This library is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by the Free
- * Software Foundation; either version 2.1 of the License, or (at your option) any
- * later version.
+ * This file is part of wimlib, a library for working with WIM files.
+ *
+ * wimlib is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
*
- * This library is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * wimlib is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
*
- * You should have received a copy of the GNU Lesser General Public License along
- * with this library; if not, write to the Free Software Foundation, Inc., 59
- * Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with wimlib; if not, see http://www.gnu.org/licenses/.
*/
#include "wimlib_internal.h"
static int print_metadata(WIMStruct *w)
{
-#if 0
+#ifdef ENABLE_SECURITY_DATA
print_security_data(wim_security_data(w));
#endif
return for_dentry_in_tree(wim_root_dentry(w), print_dentry,
w = CALLOC(1, sizeof(WIMStruct));
if (!w)
return NULL;
- w->link_type = WIM_LINK_TYPE_HARD;
- w->current_image = WIM_NO_IMAGE;
+ w->link_type = WIM_LINK_TYPE_NONE;
+ w->current_image = WIM_NO_IMAGE;
return w;
}
*/
int for_image(WIMStruct *w, int image, int (*visitor)(WIMStruct *))
{
- int ret;
+ int ret = 0;
int i;
int image_count;
DEBUG("Freeing image %u\n", w->current_image);
imd = wim_get_current_image_metadata(w);
free_dentry_tree(imd->root_dentry, NULL, false);
-#if 0
- destroy_security_data(&imd->security_data);
-#endif
imd->root_dentry = NULL;
+#ifdef ENABLE_SECURITY_DATA
+ free_security_data(imd->security_data);
+ imd->security_data = NULL;
+#endif
}
w->current_image = image;
return read_metadata_resource(w->fp,
wim_metadata_resource_entry(w),
wimlib_get_compression_type(w),
- /*wim_security_data(w), */
- wim_root_dentry_p(w));
+ wim_get_current_image_metadata(w));
}
}
FREE(w->xml_data);
free_wim_info(w->wim_info);
if (w->image_metadata) {
- for (i = 0; i < w->hdr.image_count; i++)
+ for (i = 0; i < w->hdr.image_count; i++) {
free_dentry_tree(w->image_metadata[i].root_dentry,
NULL, false);
+ #ifdef ENABLE_SECURITY_DATA
+ free_security_data(w->image_metadata[i].security_data);
+ #endif
+ }
FREE(w->image_metadata);
}
FREE(w);