mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 01:20:25 +00:00
AK+Userland: Fix some compiler warnings and make variables const-ref
This fixes a few compiler warnings and makes some variables const-ref in preparation for the next commit which changes how ByteBuffer works.
This commit is contained in:
parent
fbdc3b0ee2
commit
f0fa51773a
Notes:
sideshowbarker
2024-07-18 18:02:02 +09:00
Author: https://github.com/gunnarbeutner Commit: https://github.com/SerenityOS/serenity/commit/f0fa51773ab Pull-request: https://github.com/SerenityOS/serenity/pull/7151 Reviewed-by: https://github.com/alimpfard
7 changed files with 12 additions and 7 deletions
|
@ -28,6 +28,10 @@ void UUID::convert_string_view_to_uuid(const StringView& uuid_string_view)
|
||||||
auto fourth_unit = decode_hex(uuid_string_view.substring_view(19, 4));
|
auto fourth_unit = decode_hex(uuid_string_view.substring_view(19, 4));
|
||||||
auto fifth_unit = decode_hex(uuid_string_view.substring_view(24, 12));
|
auto fifth_unit = decode_hex(uuid_string_view.substring_view(24, 12));
|
||||||
|
|
||||||
|
VERIFY(first_unit.value().size() == 4 && second_unit.value().size() == 2
|
||||||
|
&& third_unit.value().size() == 2 && fourth_unit.value().size() == 2
|
||||||
|
&& fifth_unit.value().size() == 6);
|
||||||
|
|
||||||
m_uuid_buffer.span().overwrite(0, first_unit.value().data(), first_unit.value().size());
|
m_uuid_buffer.span().overwrite(0, first_unit.value().data(), first_unit.value().size());
|
||||||
m_uuid_buffer.span().overwrite(4, second_unit.value().data(), second_unit.value().size());
|
m_uuid_buffer.span().overwrite(4, second_unit.value().data(), second_unit.value().size());
|
||||||
m_uuid_buffer.span().overwrite(6, third_unit.value().data(), third_unit.value().size());
|
m_uuid_buffer.span().overwrite(6, third_unit.value().data(), third_unit.value().size());
|
||||||
|
|
|
@ -14,7 +14,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
|
||||||
if (!request_wrapper.has_value())
|
if (!request_wrapper.has_value())
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
auto request = request_wrapper.value();
|
auto& request = request_wrapper.value();
|
||||||
VERIFY(request.method() != HTTP::HttpRequest::Method::Invalid);
|
VERIFY(request.method() != HTTP::HttpRequest::Method::Invalid);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -466,7 +466,7 @@ static bool fill_getserv_buffers(const char* line, ssize_t read)
|
||||||
}
|
}
|
||||||
auto alias = split_line[i].to_byte_buffer();
|
auto alias = split_line[i].to_byte_buffer();
|
||||||
alias.append("\0", sizeof(char));
|
alias.append("\0", sizeof(char));
|
||||||
__getserv_alias_list_buffer.append(alias);
|
__getserv_alias_list_buffer.append(move(alias));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -636,7 +636,7 @@ static bool fill_getproto_buffers(const char* line, ssize_t read)
|
||||||
break;
|
break;
|
||||||
auto alias = split_line[i].to_byte_buffer();
|
auto alias = split_line[i].to_byte_buffer();
|
||||||
alias.append("\0", sizeof(char));
|
alias.append("\0", sizeof(char));
|
||||||
__getproto_alias_list_buffer.append(alias);
|
__getproto_alias_list_buffer.append(move(alias));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ Vector<String> MimeData::formats() const
|
||||||
{
|
{
|
||||||
Vector<String> mime_types;
|
Vector<String> mime_types;
|
||||||
mime_types.ensure_capacity(m_data.size());
|
mime_types.ensure_capacity(m_data.size());
|
||||||
for (auto it : m_data)
|
for (auto& it : m_data)
|
||||||
mime_types.unchecked_append(it.key);
|
mime_types.unchecked_append(it.key);
|
||||||
return mime_types;
|
return mime_types;
|
||||||
}
|
}
|
||||||
|
|
|
@ -383,6 +383,7 @@ ssize_t TLSv12::handle_message(ReadonlyBytes buffer)
|
||||||
if (m_context.connection_status != ConnectionStatus::KeyExchange) {
|
if (m_context.connection_status != ConnectionStatus::KeyExchange) {
|
||||||
dbgln("unexpected change cipher message");
|
dbgln("unexpected change cipher message");
|
||||||
auto packet = build_alert(true, (u8)AlertDescription::UnexpectedMessage);
|
auto packet = build_alert(true, (u8)AlertDescription::UnexpectedMessage);
|
||||||
|
write_packet(packet);
|
||||||
payload_res = (i8)Error::UnexpectedMessage;
|
payload_res = (i8)Error::UnexpectedMessage;
|
||||||
} else {
|
} else {
|
||||||
dbgln_if(TLS_DEBUG, "change cipher spec message");
|
dbgln_if(TLS_DEBUG, "change cipher spec message");
|
||||||
|
|
|
@ -22,7 +22,7 @@ InspectableProcess::InspectableProcess(pid_t pid, NonnullRefPtr<Core::LocalSocke
|
||||||
{
|
{
|
||||||
m_socket->set_blocking(true);
|
m_socket->set_blocking(true);
|
||||||
m_socket->on_ready_to_read = [this] {
|
m_socket->on_ready_to_read = [this] {
|
||||||
auto buffer = m_socket->read(1);
|
[[maybe_unused]] auto buffer = m_socket->read(1);
|
||||||
if (m_socket->eof()) {
|
if (m_socket->eof()) {
|
||||||
g_processes.remove(m_pid);
|
g_processes.remove(m_pid);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -423,14 +423,14 @@ static void print(JS::Value value)
|
||||||
outln();
|
outln();
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool file_has_shebang(ByteBuffer file_contents)
|
static bool file_has_shebang(ByteBuffer const& file_contents)
|
||||||
{
|
{
|
||||||
if (file_contents.size() >= 2 && file_contents[0] == '#' && file_contents[1] == '!')
|
if (file_contents.size() >= 2 && file_contents[0] == '#' && file_contents[1] == '!')
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static StringView strip_shebang(ByteBuffer file_contents)
|
static StringView strip_shebang(ByteBuffer const& file_contents)
|
||||||
{
|
{
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
for (i = 2; i < file_contents.size(); ++i) {
|
for (i = 2; i < file_contents.size(); ++i) {
|
||||||
|
|
Loading…
Reference in a new issue