mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-18 21:55:45 +00:00
LibIPC: Add support for passing around ByteBuffers and HashMap<K, V>
It should be noted that using a shared buffer should still be preferred over passing a raw ByteBuffer over the wire.
This commit is contained in:
committed by
Andreas Kling
parent
705ad670f3
commit
c930e02624
@@ -112,6 +112,25 @@ bool Decoder::decode(String& value)
|
||||
return !m_stream.handle_any_error();
|
||||
}
|
||||
|
||||
bool Decoder::decode(ByteBuffer& value)
|
||||
{
|
||||
i32 length = 0;
|
||||
m_stream >> length;
|
||||
if (m_stream.handle_any_error())
|
||||
return false;
|
||||
if (length < 0) {
|
||||
value = {};
|
||||
return true;
|
||||
}
|
||||
if (length == 0) {
|
||||
value = ByteBuffer::create_uninitialized(0);
|
||||
return true;
|
||||
}
|
||||
value = ByteBuffer::create_uninitialized(length);
|
||||
m_stream >> value.bytes();
|
||||
return !m_stream.handle_any_error();
|
||||
}
|
||||
|
||||
bool Decoder::decode(URL& value)
|
||||
{
|
||||
String string;
|
||||
|
||||
Reference in New Issue
Block a user