mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 12:17:44 +00:00
AK: Add String::copy(BufferType) helper.
This will create a String from any BufferType that has data() and size().
This commit is contained in:
parent
5eedb22834
commit
ab94a6be00
11 changed files with 31 additions and 27 deletions
|
@ -265,7 +265,7 @@ Vector<IPv4Address> lookup(const String& hostname, bool& did_timeout)
|
|||
|
||||
static String parse_dns_name(const byte* data, int& offset, int max_offset)
|
||||
{
|
||||
Vector<char> buf;
|
||||
Vector<char, 128> buf;
|
||||
while (offset < max_offset) {
|
||||
byte ch = data[offset];
|
||||
if (ch == '\0') {
|
||||
|
@ -283,5 +283,5 @@ static String parse_dns_name(const byte* data, int& offset, int max_offset)
|
|||
buf.append('.');
|
||||
offset += ch + 1;
|
||||
}
|
||||
return String(buf.data(), buf.size());
|
||||
return String::copy(buf);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue