1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:38:11 +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

@ -74,7 +74,7 @@ ReadyState WebSocket::ready_state()
}
}
DeprecatedString WebSocket::subprotocol_in_use()
ByteString WebSocket::subprotocol_in_use()
{
return m_subprotocol_in_use;
}
@ -90,7 +90,7 @@ void WebSocket::send(Message const& message)
send_frame(WebSocket::OpCode::Binary, message.data(), true);
}
void WebSocket::close(u16 code, DeprecatedString const& message)
void WebSocket::close(u16 code, ByteString const& message)
{
VERIFY(m_impl);
@ -186,7 +186,7 @@ void WebSocket::send_client_handshake()
u8 nonce_data[16];
fill_with_random(nonce_data);
// FIXME: change to TRY() and make method fallible
m_websocket_key = MUST(encode_base64({ nonce_data, 16 })).to_deprecated_string();
m_websocket_key = MUST(encode_base64({ nonce_data, 16 })).to_byte_string();
builder.appendff("Sec-WebSocket-Key: {}\r\n", m_websocket_key);
// 8. Origin (optional field)
@ -219,7 +219,7 @@ void WebSocket::send_client_handshake()
builder.append("\r\n"sv);
m_state = WebSocket::InternalState::WaitingForServerHandshake;
auto success = m_impl->send(builder.to_deprecated_string().bytes());
auto success = m_impl->send(builder.to_byte_string().bytes());
VERIFY(success);
}
@ -322,7 +322,7 @@ void WebSocket::read_server_handshake()
if (header_name.equals_ignoring_ascii_case("Sec-WebSocket-Accept"sv)) {
// 4. |Sec-WebSocket-Accept| should be base64(SHA1(|Sec-WebSocket-Key| + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"))
auto expected_content = DeprecatedString::formatted("{}258EAFA5-E914-47DA-95CA-C5AB0DC85B11", m_websocket_key);
auto expected_content = ByteString::formatted("{}258EAFA5-E914-47DA-95CA-C5AB0DC85B11", m_websocket_key);
Crypto::Hash::Manager hash;
hash.initialize(Crypto::Hash::HashKind::SHA1);
@ -485,7 +485,7 @@ void WebSocket::read_frame()
if (op_code == WebSocket::OpCode::ConnectionClose) {
if (payload.size() > 1) {
m_last_close_code = (((u16)(payload[0] & 0xff) << 8) | ((u16)(payload[1] & 0xff)));
m_last_close_message = DeprecatedString(ReadonlyBytes(payload.offset_pointer(2), payload.size() - 2));
m_last_close_message = ByteString(ReadonlyBytes(payload.offset_pointer(2), payload.size() - 2));
}
m_state = WebSocket::InternalState::Closing;
return;
@ -632,7 +632,7 @@ void WebSocket::notify_open()
on_open();
}
void WebSocket::notify_close(u16 code, DeprecatedString reason, bool was_clean)
void WebSocket::notify_close(u16 code, ByteString reason, bool was_clean)
{
if (!on_close)
return;