if (chunk_entry_size == 4) {
u32 *entries = (u32*)chunk_tab_buf;
while (num_needed_chunk_entries--)
- *chunk_tab_p++ = to_le32(*entries++);
+ *chunk_tab_p++ = le32_to_cpu(*entries++);
} else {
u64 *entries = (u64*)chunk_tab_buf;
while (num_needed_chunk_entries--)
- *chunk_tab_p++ = to_le64(*entries++);
+ *chunk_tab_p++ = le64_to_cpu(*entries++);
}
/* Done with the chunk table now. We must now seek to the first chunk
}
if (chunk_tab->bytes_per_chunk_entry == 8) {
- array_to_le64(chunk_tab->offsets, chunk_tab->num_chunks);
+ array_cpu_to_le64(chunk_tab->offsets, chunk_tab->num_chunks);
} else {
for (u64 i = 0; i < chunk_tab->num_chunks; i++)
((u32*)chunk_tab->offsets)[i] =
- to_le32(chunk_tab->offsets[i]);
+ cpu_to_le32(chunk_tab->offsets[i]);
}
bytes_written = fwrite((u8*)chunk_tab->offsets +
chunk_tab->bytes_per_chunk_entry,
if (ret != 0)
break;
sha1_update(&ctx, buf, to_read);
- if (full_write(fd, buf, to_read) < 0) {
+ if (full_write(fd, buf, to_read) < to_read) {
ERROR_WITH_ERRNO("Error extracting WIM resource");
return WIMLIB_ERR_WRITE;
}
if (ret != 0)
goto out;
- /* It's very likely the SHA1 message digest of the metadata resource, so
- * re-insert the lookup table entry into the lookup table. */
+ /* It's very likely the SHA1 message digest of the metadata resource
+ * changed, so re-insert the lookup table entry into the lookup table.
+ * */
lookup_table_unlink(w->lookup_table, lte);
lookup_table_insert(w->lookup_table, lte);