1
Fork 0
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:
Tim Schumacher 2023-03-01 17:30:30 +01:00 committed by Linus Groh
parent ba354fa396
commit 26516ee160

View file

@ -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++;