mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:27:35 +00:00
Libraries: Fix -Wunreachable-code warnings from clang
This commit is contained in:
parent
96666f3209
commit
b8dc3661ac
10 changed files with 7 additions and 27 deletions
|
@ -111,8 +111,6 @@ bool IODevice::can_read_line() const
|
||||||
if (m_buffered_data.contains_in_range('\n', previous_buffer_size, new_buffer_size - 1))
|
if (m_buffered_data.contains_in_range('\n', previous_buffer_size, new_buffer_size - 1))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IODevice::can_read() const
|
bool IODevice::can_read() const
|
||||||
|
|
|
@ -43,7 +43,6 @@ static constexpr float wrap(float value, GLint mode)
|
||||||
|
|
||||||
case GL_MIRRORED_REPEAT:
|
case GL_MIRRORED_REPEAT:
|
||||||
return wrap_mirrored_repeat(value);
|
return wrap_mirrored_repeat(value);
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
VERIFY_NOT_REACHED();
|
VERIFY_NOT_REACHED();
|
||||||
|
|
|
@ -865,8 +865,6 @@ bool RemoveTextCommand::merge_with(GUI::Command const& other)
|
||||||
m_text = builder.to_string();
|
m_text = builder.to_string();
|
||||||
m_range.set_start(typed_other.m_range.start());
|
m_range.set_start(typed_other.m_range.start());
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoveTextCommand::redo()
|
void RemoveTextCommand::redo()
|
||||||
|
|
|
@ -784,7 +784,8 @@ static bool decode_dds(DDSLoadingContext& context)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t mipmap_level = 0; mipmap_level < max(context.header.mip_map_count, 1u); mipmap_level++) {
|
// We support parsing mipmaps, but we only care about the largest one :^) (At least for now)
|
||||||
|
if (size_t mipmap_level = 0; mipmap_level < max(context.header.mip_map_count, 1u)) {
|
||||||
u64 width = get_width(context.header, mipmap_level);
|
u64 width = get_width(context.header, mipmap_level);
|
||||||
u64 height = get_height(context.header, mipmap_level);
|
u64 height = get_height(context.header, mipmap_level);
|
||||||
|
|
||||||
|
@ -795,9 +796,6 @@ static bool decode_dds(DDSLoadingContext& context)
|
||||||
context.bitmap = Bitmap::try_create(BitmapFormat::BGRA8888, { width, height });
|
context.bitmap = Bitmap::try_create(BitmapFormat::BGRA8888, { width, height });
|
||||||
|
|
||||||
decode_bitmap(stream, context, format, width, height);
|
decode_bitmap(stream, context, format, width, height);
|
||||||
|
|
||||||
// We support parsing mipmaps, but we only care about the largest one :^) (At least for now)
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
context.state = DDSLoadingContext::State::BitmapDecoded;
|
context.state = DDSLoadingContext::State::BitmapDecoded;
|
||||||
|
|
|
@ -847,8 +847,6 @@ Token Lexer::force_slash_as_regex()
|
||||||
|
|
||||||
TokenType Lexer::consume_regex_literal()
|
TokenType Lexer::consume_regex_literal()
|
||||||
{
|
{
|
||||||
TokenType token_type = TokenType::RegexLiteral;
|
|
||||||
|
|
||||||
while (!is_eof()) {
|
while (!is_eof()) {
|
||||||
if (is_line_terminator() || (!m_regex_is_in_character_class && m_current_char == '/')) {
|
if (is_line_terminator() || (!m_regex_is_in_character_class && m_current_char == '/')) {
|
||||||
break;
|
break;
|
||||||
|
@ -868,10 +866,9 @@ TokenType Lexer::consume_regex_literal()
|
||||||
if (m_current_char == '/') {
|
if (m_current_char == '/') {
|
||||||
consume();
|
consume();
|
||||||
return TokenType::RegexLiteral;
|
return TokenType::RegexLiteral;
|
||||||
} else {
|
|
||||||
return TokenType::UnterminatedRegexLiteral;
|
|
||||||
}
|
}
|
||||||
return token_type;
|
|
||||||
|
return TokenType::UnterminatedRegexLiteral;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -986,7 +986,7 @@ void Editor::handle_read_event()
|
||||||
dbgln("LibLine: Unhandled final: {:02x} ({:c})", code_point, code_point);
|
dbgln("LibLine: Unhandled final: {:02x} ({:c})", code_point, code_point);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
break;
|
VERIFY_NOT_REACHED();
|
||||||
}
|
}
|
||||||
case InputState::Verbatim:
|
case InputState::Verbatim:
|
||||||
m_state = InputState::Free;
|
m_state = InputState::Free;
|
||||||
|
|
|
@ -163,7 +163,6 @@ bool Database::update(Row& tuple)
|
||||||
return m_serializer.serialize_and_write<Tuple>(tuple, tuple.pointer());
|
return m_serializer.serialize_and_write<Tuple>(tuple, tuple.pointer());
|
||||||
|
|
||||||
// TODO update indexes defined on table.
|
// TODO update indexes defined on table.
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1881,10 +1881,8 @@ Optional<float> Parser::try_parse_float(StringView string)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (str[i] < '0' || str[i] > '9' || exp_val != 0) {
|
if (str[i] < '0' || str[i] > '9' || exp_val != 0)
|
||||||
return {};
|
return {};
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_fractional) {
|
if (is_fractional) {
|
||||||
fraction *= 10;
|
fraction *= 10;
|
||||||
|
|
|
@ -30,27 +30,20 @@ static bool matches_attribute(CSS::Selector::SimpleSelector::Attribute const& at
|
||||||
switch (attribute.match_type) {
|
switch (attribute.match_type) {
|
||||||
case CSS::Selector::SimpleSelector::Attribute::MatchType::HasAttribute:
|
case CSS::Selector::SimpleSelector::Attribute::MatchType::HasAttribute:
|
||||||
return element.has_attribute(attribute.name);
|
return element.has_attribute(attribute.name);
|
||||||
break;
|
|
||||||
case CSS::Selector::SimpleSelector::Attribute::MatchType::ExactValueMatch:
|
case CSS::Selector::SimpleSelector::Attribute::MatchType::ExactValueMatch:
|
||||||
return element.attribute(attribute.name) == attribute.value;
|
return element.attribute(attribute.name) == attribute.value;
|
||||||
break;
|
|
||||||
case CSS::Selector::SimpleSelector::Attribute::MatchType::ContainsWord:
|
case CSS::Selector::SimpleSelector::Attribute::MatchType::ContainsWord:
|
||||||
return element.attribute(attribute.name).split_view(' ').contains_slow(attribute.value);
|
return element.attribute(attribute.name).split_view(' ').contains_slow(attribute.value);
|
||||||
break;
|
|
||||||
case CSS::Selector::SimpleSelector::Attribute::MatchType::ContainsString:
|
case CSS::Selector::SimpleSelector::Attribute::MatchType::ContainsString:
|
||||||
return element.attribute(attribute.name).contains(attribute.value);
|
return element.attribute(attribute.name).contains(attribute.value);
|
||||||
break;
|
|
||||||
case CSS::Selector::SimpleSelector::Attribute::MatchType::StartsWithSegment: {
|
case CSS::Selector::SimpleSelector::Attribute::MatchType::StartsWithSegment: {
|
||||||
auto segments = element.attribute(attribute.name).split_view('-');
|
auto segments = element.attribute(attribute.name).split_view('-');
|
||||||
return !segments.is_empty() && segments.first() == attribute.value;
|
return !segments.is_empty() && segments.first() == attribute.value;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case CSS::Selector::SimpleSelector::Attribute::MatchType::StartsWithString:
|
case CSS::Selector::SimpleSelector::Attribute::MatchType::StartsWithString:
|
||||||
return element.attribute(attribute.name).starts_with(attribute.value);
|
return element.attribute(attribute.name).starts_with(attribute.value);
|
||||||
break;
|
|
||||||
case CSS::Selector::SimpleSelector::Attribute::MatchType::EndsWithString:
|
case CSS::Selector::SimpleSelector::Attribute::MatchType::EndsWithString:
|
||||||
return element.attribute(attribute.name).ends_with(attribute.value);
|
return element.attribute(attribute.name).ends_with(attribute.value);
|
||||||
break;
|
|
||||||
case CSS::Selector::SimpleSelector::Attribute::MatchType::None:
|
case CSS::Selector::SimpleSelector::Attribute::MatchType::None:
|
||||||
VERIFY_NOT_REACHED();
|
VERIFY_NOT_REACHED();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -61,7 +61,7 @@ void TextNode::paint_text_decoration(Gfx::Painter& painter, LineBoxFragment cons
|
||||||
line_start_point = fragment_box.top_left().translated(0, baseline - x_height / 2);
|
line_start_point = fragment_box.top_left().translated(0, baseline - x_height / 2);
|
||||||
line_end_point = fragment_box.top_right().translated(0, baseline - x_height / 2);
|
line_end_point = fragment_box.top_right().translated(0, baseline - x_height / 2);
|
||||||
break;
|
break;
|
||||||
} break;
|
}
|
||||||
case CSS::TextDecorationLine::Blink:
|
case CSS::TextDecorationLine::Blink:
|
||||||
// Conforming user agents may simply not blink the text
|
// Conforming user agents may simply not blink the text
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue