- fclose(w->fp);
- w->fp = NULL;
-
- if (i == 0) {
- ctype = wimlib_get_compression_type(w);
- guid = w->hdr.guid;
- } else {
- if (wimlib_get_compression_type(w) != ctype) {
- ERROR("The split WIMs do not all have the same "
- "compression type");
- ret = WIMLIB_ERR_SPLIT_INVALID;
- goto err;
- }
- if (memcmp(guid, w->hdr.guid, WIM_GID_LEN) != 0) {
- ERROR("The split WIMs do not all have the same "
- "GUID");
- ret = WIMLIB_ERR_SPLIT_INVALID;
- goto err;
- }
- }
- if (w->hdr.total_parts != num_swms) {
- ERROR("`%s' (part %d) says there are %d total parts, "
- "but %d parts were specified",
- swm_names[i], w->hdr.part_number,
- w->hdr.total_parts, num_swms);
- ret = WIMLIB_ERR_SPLIT_INVALID;
- goto err;
- }
- if (w->hdr.part_number == 0 || w->hdr.part_number > num_swms) {
- ERROR("`%s' says it is part %d, but expected a number "
- "between 1 and %d",
- swm_names[i], w->hdr.part_number, num_swms);
- ret = WIMLIB_ERR_SPLIT_INVALID;
- goto err;
- }
- part_idx = w->hdr.part_number - 1;
- if (swms[part_idx] != NULL) {
- ERROR("`%s' and `%s' both say they are part %d of %d",
- swm_names[i], swms[part_idx]->filename,
- w->hdr.part_number, num_swms);
- ret = WIMLIB_ERR_SPLIT_INVALID;
- goto err;
- }
- swms[part_idx] = w;
-
- }
- joined_wim = new_wim_struct();
- if (!joined_wim) {
- ret = WIMLIB_ERR_NOMEM;
- goto err;