X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=src%2Fresource.c;fp=src%2Fresource.c;h=a4cc6c1291c669da3715f51d5132f6dfb03f6349;hp=74c9bb8b9a9570aa52110139e73cc9a0907982bb;hb=b82856cb22783df0e19990eb68d3694753f52220;hpb=bf06d7c97be31ca199d19af76cdfd2dc5c38c6de diff --git a/src/resource.c b/src/resource.c index 74c9bb8b..a4cc6c12 100644 --- a/src/resource.c +++ b/src/resource.c @@ -808,8 +808,7 @@ wim_reshdr_to_data(const struct wim_reshdr *reshdr, WIMStruct *wim, 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); } @@ -824,8 +823,7 @@ wim_reshdr_to_hash(const struct wim_reshdr *reshdr, WIMStruct *wim, 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); @@ -1267,6 +1265,21 @@ wim_reshdr_to_desc(const struct wim_reshdr *reshdr, WIMStruct *wim, } } +/* + * 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,