mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:27:34 +00:00
LibDNS: Use AllocatingMemoryStream
in DNS package construction
This commit is contained in:
parent
202175cf4c
commit
87c64834ca
8 changed files with 31 additions and 28 deletions
|
@ -75,15 +75,15 @@ void Name::randomize_case()
|
|||
m_name = builder.to_deprecated_string();
|
||||
}
|
||||
|
||||
OutputStream& operator<<(OutputStream& stream, Name const& name)
|
||||
ErrorOr<void> Name::write_to_stream(Core::Stream::Stream& stream) const
|
||||
{
|
||||
auto parts = name.as_string().split_view('.');
|
||||
auto parts = as_string().split_view('.');
|
||||
for (auto& part : parts) {
|
||||
stream << (u8)part.length();
|
||||
stream << part.bytes();
|
||||
TRY(stream.write_trivial_value<u8>(part.length()));
|
||||
TRY(stream.write_entire_buffer(part.bytes()));
|
||||
}
|
||||
stream << '\0';
|
||||
return stream;
|
||||
TRY(stream.write_trivial_value('\0'));
|
||||
return {};
|
||||
}
|
||||
|
||||
unsigned Name::Traits::hash(Name const& name)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue