- if ((flags & WIMLIB_RESOURCE_FLAG_RAW)
- || ctype == WIMLIB_COMPRESSION_TYPE_NONE)
- ret = read_uncompressed_resource(fp,
- lte->resource_entry.offset + offset,
- size, buf);
- else
- ret = read_compressed_resource(fp,
- lte->resource_entry.size,
- lte->resource_entry.original_size,
- lte->resource_entry.offset,
- ctype, size, offset, buf);
- #ifdef WITH_FUSE
- if (flags & WIMLIB_RESOURCE_FLAG_MULTITHREADED) {
- int ret2 = wim_release_fp(lte->wim, fp);
- if (ret == 0)
- ret = ret2;
- }
- #endif
- break;
- case RESOURCE_IN_STAGING_FILE:
- case RESOURCE_IN_FILE_ON_DISK:
- /* The resource is in some file on the external filesystem and
- * needs to be read uncompressed */
- wimlib_assert(lte->file_on_disk);
- wimlib_assert(<e->file_on_disk == <e->staging_file_name);
- /* Use existing file pointer if available; otherwise open one
- * temporarily */
- if (lte->file_on_disk_fp) {
- fp = lte->file_on_disk_fp;
- } else {
- fp = fopen(lte->file_on_disk, "rb");
- if (!fp) {
- ERROR_WITH_ERRNO("Failed to open the file "
- "`%s'", lte->file_on_disk);
- ret = WIMLIB_ERR_OPEN;
- break;
- }