net/HostParser: use std::string_view instead of StringView

This commit is contained in:
Max Kellermann
2022-05-31 13:33:33 +02:00
parent d5db4ca0e7
commit 242ba727b2
3 changed files with 26 additions and 17 deletions
+3 -3
View File
@@ -108,11 +108,11 @@ Resolve(const char *host_and_port, int default_port,
if (eh.HasFailed())
throw std::runtime_error("Failed to extract host name");
if (eh.host.size >= sizeof(buffer))
if (eh.host.size() >= sizeof(buffer))
throw std::runtime_error("Host name too long");
memcpy(buffer, eh.host.data, eh.host.size);
buffer[eh.host.size] = 0;
memcpy(buffer, eh.host.data(), eh.host.size());
buffer[eh.host.size()] = 0;
host = buffer;
#ifndef _WIN32