blob->offset_in_res = offset_in_res;
}
-/*
- * Declare that the specified blob is located in the specified non-solid WIM
- * resource. In this case, the blob data is the entire uncompressed resource.
- */
-static inline void
-blob_set_is_located_in_nonsolid_wim_resource(struct blob_descriptor *blob,
- struct wim_resource_descriptor *rdesc)
-{
- blob_set_is_located_in_wim_resource(blob, rdesc, 0);
- blob->size = rdesc->uncompressed_size;
-}
-
static inline void
blob_unset_is_located_in_wim_resource(struct blob_descriptor *blob)
{
wim_reshdr_to_desc(const struct wim_reshdr *reshdr, WIMStruct *wim,
struct wim_resource_descriptor *rdesc);
+extern void
+wim_reshdr_to_desc_and_blob(const struct wim_reshdr *reshdr, WIMStruct *wim,
+ struct wim_resource_descriptor *rdesc,
+ struct blob_descriptor *blob);
+
extern void
get_wim_reshdr(const struct wim_reshdr_disk *disk_reshdr,
struct wim_reshdr *reshdr);
if (!rdesc)
goto oom;
- wim_reshdr_to_desc(&reshdr, wim, rdesc);
-
- blob_set_is_located_in_nonsolid_wim_resource(cur_blob, rdesc);
+ wim_reshdr_to_desc_and_blob(&reshdr, wim, rdesc, cur_blob);
}
/* cur_blob is now a blob bound to a resource. */
if (ret)
return ret;
- wim_reshdr_to_desc(&reshdr, ctx->wim, &rdesc);
-
- if (!(rdesc.flags & WIM_RESHDR_FLAG_METADATA)
+ if (!(reshdr.flags & WIM_RESHDR_FLAG_METADATA)
&& (blob = lookup_blob(ctx->wim->blob_table, hash))
&& (blob->out_refcnt))
{
- blob_set_is_located_in_nonsolid_wim_resource(blob, &rdesc);
+ wim_reshdr_to_desc_and_blob(&reshdr, ctx->wim, &rdesc, blob);
ret = read_blob_with_sha1(blob, cbs);
blob_unset_is_located_in_wim_resource(blob);
if (ret)
return ret;
ctx->num_blobs_remaining--;
} else {
+ wim_reshdr_to_desc(&reshdr, ctx->wim, &rdesc);
ret = skip_wim_resource(&rdesc);
if (ret)
return ret;
metadata_rdesc = MALLOC(sizeof(struct wim_resource_descriptor));
if (!metadata_rdesc)
goto out_wimlib_free;
- wim_reshdr_to_desc(&reshdr, pwm, metadata_rdesc);
- blob_set_is_located_in_nonsolid_wim_resource(imd->metadata_blob,
- metadata_rdesc);
+ wim_reshdr_to_desc_and_blob(&reshdr, pwm, metadata_rdesc,
+ imd->metadata_blob);
if (i == image) {
/* Metadata resource is for the image being extracted.
struct wim_resource_descriptor rdesc;
struct blob_descriptor blob;
- wim_reshdr_to_desc(reshdr, wim, &rdesc);
- blob_set_is_located_in_nonsolid_wim_resource(&blob, &rdesc);
+ wim_reshdr_to_desc_and_blob(reshdr, wim, &rdesc, &blob);
return read_blob_into_alloc_buf(&blob, buf_ret);
}
struct blob_descriptor blob;
int ret;
- wim_reshdr_to_desc(reshdr, wim, &rdesc);
- blob_set_is_located_in_nonsolid_wim_resource(&blob, &rdesc);
+ wim_reshdr_to_desc_and_blob(reshdr, wim, &rdesc, &blob);
blob.unhashed = 1;
ret = sha1_blob(&blob);
}
}
+/*
+ * Convert the short WIM resource header @reshdr to a stand-alone WIM resource
+ * descriptor @rdesc, then set @blob to consist of that entire resource. This
+ * should only be used for non-solid resources!
+ */
+void
+wim_reshdr_to_desc_and_blob(const struct wim_reshdr *reshdr, WIMStruct *wim,
+ struct wim_resource_descriptor *rdesc,
+ struct blob_descriptor *blob)
+{
+ wim_reshdr_to_desc(reshdr, wim, rdesc);
+ blob->size = rdesc->uncompressed_size;
+ blob_set_is_located_in_wim_resource(blob, rdesc, 0);
+}
+
/* Import a WIM resource header from the on-disk format. */
void
get_wim_reshdr(const struct wim_reshdr_disk *disk_reshdr,