1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:47:34 +00:00

Everywhere: Rename {Deprecated => Byte}String

This commit un-deprecates DeprecatedString, and repurposes it as a byte
string.
As the null state has already been removed, there are no other
particularly hairy blockers in repurposing this type as a byte string
(what it _really_ is).

This commit is auto-generated:
  $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \
    Meta Ports Ladybird Tests Kernel)
  $ perl -pie 's/\bDeprecatedString\b/ByteString/g;
    s/deprecated_string/byte_string/g' $xs
  $ clang-format --style=file -i \
    $(git diff --name-only | grep \.cpp\|\.h)
  $ gn format $(git ls-files '*.gn' '*.gni')
This commit is contained in:
Ali Mohammad Pur 2023-12-16 17:49:34 +03:30 committed by Ali Mohammad Pur
parent 38d62563b3
commit 5e1499d104
1615 changed files with 10257 additions and 10257 deletions

View file

@ -21,7 +21,7 @@
namespace HTTP {
static ErrorOr<ByteBuffer> handle_content_encoding(ByteBuffer const& buf, DeprecatedString const& content_encoding)
static ErrorOr<ByteBuffer> handle_content_encoding(ByteBuffer const& buf, ByteString const& content_encoding)
{
dbgln_if(JOB_DEBUG, "Job::handle_content_encoding: buf has content_encoding={}", content_encoding);
@ -173,11 +173,11 @@ void Job::register_on_ready_to_read(Function<void()> callback)
};
}
ErrorOr<DeprecatedString> Job::read_line(size_t size)
ErrorOr<ByteString> Job::read_line(size_t size)
{
auto buffer = TRY(ByteBuffer::create_uninitialized(size));
auto bytes_read = TRY(m_socket->read_until(buffer, "\r\n"sv));
return DeprecatedString::copy(bytes_read);
return ByteString::copy(bytes_read);
}
ErrorOr<ByteBuffer> Job::receive(size_t size)
@ -203,7 +203,7 @@ void Job::on_socket_connected()
if constexpr (JOB_DEBUG) {
dbgln("Job: raw_request:");
dbgln("{}", DeprecatedString::copy(raw_request));
dbgln("{}", ByteString::copy(raw_request));
}
bool success = !m_socket->write_until_depleted(raw_request).is_error();
@ -304,7 +304,7 @@ void Job::on_socket_connected()
}
if (on_headers_received) {
if (!m_set_cookie_headers.is_empty())
m_headers.set("Set-Cookie", JsonArray { m_set_cookie_headers }.to_deprecated_string());
m_headers.set("Set-Cookie", JsonArray { m_set_cookie_headers }.to_byte_string());
on_headers_received(m_headers, m_code > 0 ? m_code : Optional<u32> {});
}
m_state = State::InBody;
@ -361,7 +361,7 @@ void Job::on_socket_connected()
builder.append(existing_value.value());
builder.append(',');
builder.append(value);
m_headers.set(name, builder.to_deprecated_string());
m_headers.set(name, builder.to_byte_string());
} else {
m_headers.set(name, value);
}
@ -423,7 +423,7 @@ void Job::on_socket_connected()
break;
} else {
auto chunk = size_lines[0].split_view(';', SplitBehavior::KeepEmpty);
DeprecatedString size_string = chunk[0];
ByteString size_string = chunk[0];
char* endptr;
auto size = strtoul(size_string.characters(), &endptr, 16);
if (*endptr) {