}
next_p = eol + 1;
- bytes_remaining -= (eol - p) + 1;
+ bytes_remaining -= (next_p - p);
if (eol == p)
continue;
else if (p[0] == '[' && strrchr(p, ']')) {
ERROR("Unknown capture configuration section `%s'", p);
ret = WIMLIB_ERR_INVALID_CAPTURE_CONFIG;
- goto out_destroy;
} else switch (type) {
case EXCLUSION_LIST:
DEBUG("Adding pattern \"%s\" to exclusion list", p);
"in a block (such as [ExclusionList])",
line_no);
ret = WIMLIB_ERR_INVALID_CAPTURE_CONFIG;
- goto out_destroy;
+ break;
}
if (ret != 0)
goto out_destroy;
DEBUG("Assigning hard link group IDs");
assign_inode_numbers(&inode_list);
- if (flags & WIMLIB_ADD_IMAGE_FLAG_BOOT)
- wimlib_set_boot_idx(w, w->hdr.image_count);
-
ret = xml_add_image(w, name);
if (ret != 0)
goto out_destroy_imd;
+ if (flags & WIMLIB_ADD_IMAGE_FLAG_BOOT)
+ wimlib_set_boot_idx(w, w->hdr.image_count);
+
return 0;
out_destroy_imd:
destroy_image_metadata(&w->image_metadata[w->hdr.image_count - 1],
/**
* Deletes an image, or all images, from a WIM file.
*
- * All file resources referenced by the image(s) being deleted are removed from
- * the WIM if they are not referenced by any other images in the WIM.
+ * All streams referenced by the image(s) being deleted are removed from the
+ * lookup table of the WIM if they are not referenced by any other images in the
+ * WIM.
*
* @param wim
* Pointer to the ::WIMStruct for the WIM file that contains the image(s)
* The metadata resource for @a image in the WIM is invalid.
* @retval ::WIMLIB_ERR_INVALID_SECURITY_DATA
* The security data for @a image in the WIM is invalid.
- * @retval ::WIMLIB_ERR_NOMEM Failed to allocate needed memory.
+ * @retval ::WIMLIB_ERR_NOMEM
+ * Failed to allocate needed memory.
* @retval ::WIMLIB_ERR_READ
* Could not read the metadata resource for @a image from the WIM.
* @retval ::WIMLIB_ERR_SPLIT_UNSUPPORTED
/* Update directory count and file count.
*
* Each dentry counts as either a file or a directory, but not both.
- * The root directory is an exception: it is not counted.
+ * The root directory is an exception: it is not counted at all.
*
* Symbolic links and junction points (and presumably other reparse
* points) count as regular files. This is despite the fact that
out_destroy_image_info:
destroy_image_info(image_info);
+ wim_info->num_images--;
out_free_wim_info:
- if (w->wim_info)
- wim_info->num_images--;
- else
+ if (wim_info != w->wim_info)
FREE(wim_info);
ERROR("Out of memory");
return WIMLIB_ERR_NOMEM;