mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-26 22:38:51 +00:00
ByteBuffer: Remove pointer() in favor of data()
We had two ways to get the data inside a ByteBuffer. That was silly.
This commit is contained in:
parent
dd696e7c75
commit
8f45a259fc
Notes:
sideshowbarker
2024-07-19 11:52:49 +09:00
Author: https://github.com/awesomekling
Commit: 8f45a259fc
30 changed files with 89 additions and 92 deletions
|
@ -107,7 +107,7 @@ ByteBuffer DiskBackedFS::read_block(unsigned index) const
|
|||
auto buffer = ByteBuffer::create_uninitialized(block_size());
|
||||
//kprintf("created block buffer with size %u\n", block_size());
|
||||
DiskOffset base_offset = static_cast<DiskOffset>(index) * static_cast<DiskOffset>(block_size());
|
||||
auto* buffer_pointer = buffer.pointer();
|
||||
auto* buffer_pointer = buffer.data();
|
||||
bool success = device().read(base_offset, block_size(), buffer_pointer);
|
||||
ASSERT(success);
|
||||
ASSERT(buffer.size() == block_size());
|
||||
|
@ -126,13 +126,13 @@ ByteBuffer DiskBackedFS::read_blocks(unsigned index, unsigned count) const
|
|||
if (count == 1)
|
||||
return read_block(index);
|
||||
auto blocks = ByteBuffer::create_uninitialized(count * block_size());
|
||||
u8* out = blocks.pointer();
|
||||
u8* out = blocks.data();
|
||||
|
||||
for (unsigned i = 0; i < count; ++i) {
|
||||
auto block = read_block(index + i);
|
||||
if (!block)
|
||||
return nullptr;
|
||||
memcpy(out, block.pointer(), block.size());
|
||||
memcpy(out, block.data(), block.size());
|
||||
out += block_size();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue