mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:47:46 +00:00
LibSQL: Always read and write entire heap blocks
This commit is contained in:
parent
ba354fa396
commit
26516ee160
1 changed files with 3 additions and 6 deletions
|
@ -91,11 +91,9 @@ ErrorOr<ByteBuffer> Heap::read_block(u32 block)
|
||||||
TRY(seek_block(block));
|
TRY(seek_block(block));
|
||||||
|
|
||||||
auto buffer = TRY(ByteBuffer::create_uninitialized(BLOCKSIZE));
|
auto buffer = TRY(ByteBuffer::create_uninitialized(BLOCKSIZE));
|
||||||
// FIXME: This should read the entire span.
|
TRY(m_file->read_until_filled(buffer));
|
||||||
auto bytes = TRY(m_file->read_some(buffer));
|
|
||||||
|
|
||||||
dbgln_if(SQL_DEBUG, "{:hex-dump}", bytes.trim(8));
|
dbgln_if(SQL_DEBUG, "{:hex-dump}", buffer.bytes().trim(8));
|
||||||
TRY(buffer.try_resize(bytes.size()));
|
|
||||||
|
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
@ -124,8 +122,7 @@ ErrorOr<void> Heap::write_block(u32 block, ByteBuffer& buffer)
|
||||||
}
|
}
|
||||||
|
|
||||||
dbgln_if(SQL_DEBUG, "{:hex-dump}", buffer.bytes().trim(8));
|
dbgln_if(SQL_DEBUG, "{:hex-dump}", buffer.bytes().trim(8));
|
||||||
// FIXME: This should write the entire span.
|
TRY(m_file->write_until_depleted(buffer));
|
||||||
TRY(m_file->write_some(buffer));
|
|
||||||
|
|
||||||
if (block == m_end_of_file)
|
if (block == m_end_of_file)
|
||||||
m_end_of_file++;
|
m_end_of_file++;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue