Fixing STFS reading.
This commit is contained in:
parent
6b633e4e28
commit
0581d8eb07
|
@ -54,13 +54,17 @@ X_STATUS STFSContainerFile::ReadSync(
|
||||||
stfs_entry->block_list.size(),
|
stfs_entry->block_list.size(),
|
||||||
(size_t)ceil((byte_offset + real_length) / 4096.0));
|
(size_t)ceil((byte_offset + real_length) / 4096.0));
|
||||||
uint8_t* dest_ptr = (uint8_t*)buffer;
|
uint8_t* dest_ptr = (uint8_t*)buffer;
|
||||||
|
size_t remaining_length = real_length;
|
||||||
for (size_t n = start_block; n < end_block; n++) {
|
for (size_t n = start_block; n < end_block; n++) {
|
||||||
auto& record = stfs_entry->block_list[n];
|
auto& record = stfs_entry->block_list[n];
|
||||||
size_t offset = record.offset;
|
size_t offset = record.offset;
|
||||||
size_t read_length = record.length;
|
if (n == start_block) {
|
||||||
xe_copy_memory(dest_ptr, buffer_length - (dest_ptr - (uint8_t*)buffer),
|
offset += byte_offset % 4096;
|
||||||
map_ptr + offset, read_length);
|
}
|
||||||
|
size_t read_length = MIN(remaining_length, record.length);
|
||||||
|
xe_copy_struct(dest_ptr, map_ptr + offset, read_length);
|
||||||
dest_ptr += read_length;
|
dest_ptr += read_length;
|
||||||
|
remaining_length -= read_length;
|
||||||
}
|
}
|
||||||
*out_bytes_read = real_length;
|
*out_bytes_read = real_length;
|
||||||
return X_STATUS_SUCCESS;
|
return X_STATUS_SUCCESS;
|
||||||
|
|
Loading…
Reference in New Issue