mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 01:25:09 +00:00
Kernel: Make KBufferBuilder::append() & friends return KResult
This allows callers to react to a failed append (due to OOM.)
This commit is contained in:
parent
b096e85777
commit
2065ced8f6
7 changed files with 63 additions and 42 deletions
|
@ -178,7 +178,8 @@ private:
|
|||
Message& append_number(N number)
|
||||
{
|
||||
VERIFY(!m_have_been_built);
|
||||
m_builder.append(reinterpret_cast<const char*>(&number), sizeof(number));
|
||||
// FIXME: Handle append failure.
|
||||
(void)m_builder.append(reinterpret_cast<const char*>(&number), sizeof(number));
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -264,14 +265,16 @@ Plan9FS::Message& Plan9FS::Message::operator<<(u64 number)
|
|||
Plan9FS::Message& Plan9FS::Message::operator<<(const StringView& string)
|
||||
{
|
||||
*this << static_cast<u16>(string.length());
|
||||
m_builder.append(string);
|
||||
// FIXME: Handle append failure.
|
||||
(void)m_builder.append(string);
|
||||
return *this;
|
||||
}
|
||||
|
||||
void Plan9FS::Message::append_data(const StringView& data)
|
||||
{
|
||||
*this << static_cast<u32>(data.length());
|
||||
m_builder.append(data);
|
||||
// FIXME: Handle append failure.
|
||||
(void)m_builder.append(data);
|
||||
}
|
||||
|
||||
Plan9FS::Message::Decoder& Plan9FS::Message::Decoder::operator>>(u8& number)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue