mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:17:36 +00:00
AK: Make Vector use size_t for its size and capacity
This commit is contained in:
parent
9c6f7d3e7d
commit
ceec1a7d38
94 changed files with 323 additions and 317 deletions
|
@ -40,7 +40,7 @@ public:
|
|||
void go_forward();
|
||||
|
||||
bool can_go_back() { return m_current > 0; }
|
||||
bool can_go_forward() { return m_current + 1 < m_items.size(); }
|
||||
bool can_go_forward() { return m_current + 1 < static_cast<int>(m_items.size()); }
|
||||
|
||||
void clear();
|
||||
|
||||
|
|
|
@ -138,7 +138,8 @@ void DisplayPropertiesWidget::create_frame()
|
|||
|
||||
auto wallpaper_model = wallpaper_list->model();
|
||||
auto find_first_wallpaper_index = m_wallpapers.find_first_index(m_selected_wallpaper);
|
||||
auto wallpaper_index_in_model = wallpaper_model->index(find_first_wallpaper_index, wallpaper_list->model_column());
|
||||
ASSERT(find_first_wallpaper_index.has_value());
|
||||
auto wallpaper_index_in_model = wallpaper_model->index(find_first_wallpaper_index.value(), wallpaper_list->model_column());
|
||||
if (wallpaper_model->is_valid(wallpaper_index_in_model))
|
||||
wallpaper_list->selection().set(wallpaper_index_in_model);
|
||||
|
||||
|
@ -164,7 +165,8 @@ void DisplayPropertiesWidget::create_frame()
|
|||
|
||||
auto resolution_model = resolution_list->model();
|
||||
auto find_first_resolution_index = m_resolutions.find_first_index(m_selected_resolution);
|
||||
auto resolution_index_in_model = resolution_model->index(find_first_resolution_index, resolution_list->model_column());
|
||||
ASSERT(find_first_resolution_index.has_value());
|
||||
auto resolution_index_in_model = resolution_model->index(find_first_resolution_index.value(), resolution_list->model_column());
|
||||
if (resolution_model->is_valid(resolution_index_in_model))
|
||||
resolution_list->selection().set(resolution_index_in_model);
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ private:
|
|||
ViewMode m_view_mode { Invalid };
|
||||
|
||||
NonnullRefPtr<GUI::FileSystemModel> m_model;
|
||||
int m_path_history_position { 0 };
|
||||
size_t m_path_history_position { 0 };
|
||||
Vector<String> m_path_history;
|
||||
void add_path_to_history(const StringView& path);
|
||||
|
||||
|
|
|
@ -182,7 +182,7 @@ String get_duplicate_name(const String& path, int duplicate_count)
|
|||
FileSystemPath fsp(path);
|
||||
StringBuilder duplicated_name;
|
||||
duplicated_name.append('/');
|
||||
for (int i = 0; i < fsp.parts().size() - 1; ++i) {
|
||||
for (size_t i = 0; i < fsp.parts().size() - 1; ++i) {
|
||||
duplicated_name.appendf("%s/", fsp.parts()[i].characters());
|
||||
}
|
||||
auto prev_duplicate_tag = String::format("(%d)", duplicate_count);
|
||||
|
|
|
@ -38,7 +38,7 @@ public:
|
|||
void go_forward();
|
||||
|
||||
bool can_go_back() { return m_current_history_item > 0; }
|
||||
bool can_go_forward() { return m_current_history_item + 1 < m_items.size(); }
|
||||
bool can_go_forward() { return m_current_history_item + 1 < static_cast<int>(m_items.size()); }
|
||||
|
||||
void clear();
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ GUI::ModelIndex ManualModel::parent_index(const GUI::ModelIndex& index) const
|
|||
return create_index(row, 0, parent);
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
for (int row = 0; row < parent->parent()->children().size(); row++) {
|
||||
for (size_t row = 0; row < parent->parent()->children().size(); row++) {
|
||||
ManualNode* child_at_row = &parent->parent()->children()[row];
|
||||
if (child_at_row == parent)
|
||||
return create_index(row, 0, parent);
|
||||
|
|
|
@ -241,7 +241,7 @@ void IRCClient::send_whois(const String& nick)
|
|||
void IRCClient::handle(const Message& msg)
|
||||
{
|
||||
#ifdef IRC_DEBUG
|
||||
printf("IRCClient::execute: prefix='%s', command='%s', arguments=%d\n",
|
||||
printf("IRCClient::execute: prefix='%s', command='%s', arguments=%zu\n",
|
||||
msg.prefix.characters(),
|
||||
msg.command.characters(),
|
||||
msg.arguments.size());
|
||||
|
@ -463,7 +463,7 @@ IRCChannel& IRCClient::ensure_channel(const String& name)
|
|||
|
||||
void IRCClient::handle_ping(const Message& msg)
|
||||
{
|
||||
if (msg.arguments.size() < 0)
|
||||
if (msg.arguments.size() < 1)
|
||||
return;
|
||||
m_log->add_message(0, "", "Ping? Pong!");
|
||||
send_pong(msg.arguments[0]);
|
||||
|
@ -646,7 +646,7 @@ void IRCClient::unregister_subwindow(IRCWindow& subwindow)
|
|||
if (subwindow.type() == IRCWindow::Server) {
|
||||
m_server_subwindow = &subwindow;
|
||||
}
|
||||
for (int i = 0; i < m_windows.size(); ++i) {
|
||||
for (size_t i = 0; i < m_windows.size(); ++i) {
|
||||
if (m_windows.at(i) == &subwindow) {
|
||||
m_windows.remove(i);
|
||||
break;
|
||||
|
|
|
@ -84,13 +84,13 @@ public:
|
|||
const IRCWindow& window_at(int index) const { return *m_windows.at(index); }
|
||||
IRCWindow& window_at(int index) { return *m_windows.at(index); }
|
||||
|
||||
int window_index(const IRCWindow& window) const
|
||||
size_t window_index(const IRCWindow& window) const
|
||||
{
|
||||
for (int i = 0; i < m_windows.size(); ++i) {
|
||||
for (size_t i = 0; i < m_windows.size(); ++i) {
|
||||
if (m_windows[i] == &window)
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
||||
void did_part_from_channel(Badge<IRCChannel>, IRCChannel&);
|
||||
|
|
|
@ -226,11 +226,11 @@ Audio::Sample AudioEngine::noise() const
|
|||
Audio::Sample AudioEngine::recorded_sample(size_t note)
|
||||
{
|
||||
int t = m_pos[note];
|
||||
if (t >= m_recorded_sample.size())
|
||||
if (t >= static_cast<int>(m_recorded_sample.size()))
|
||||
return 0;
|
||||
double w_left = m_recorded_sample[t].left;
|
||||
double w_right = m_recorded_sample[t].right;
|
||||
if (t + 1 < m_recorded_sample.size()) {
|
||||
if (t + 1 < static_cast<int>(m_recorded_sample.size())) {
|
||||
double t_fraction = m_pos[note] - t;
|
||||
w_left += (m_recorded_sample[t + 1].left - m_recorded_sample[t].left) * t_fraction;
|
||||
w_right += (m_recorded_sample[t + 1].right - m_recorded_sample[t].right) * t_fraction;
|
||||
|
|
|
@ -70,7 +70,7 @@ void WaveEditor::paint_event(GUI::PaintEvent& event)
|
|||
painter.set_pixel({ prev_x, left_prev_y }, left_wave_colors[RecordedSample]);
|
||||
painter.set_pixel({ prev_x, right_prev_y }, right_wave_colors[RecordedSample]);
|
||||
|
||||
for (int x = 1; x < recorded_sample.size(); ++x) {
|
||||
for (size_t x = 1; x < recorded_sample.size(); ++x) {
|
||||
int left_y = sample_to_y(recorded_sample[x].left);
|
||||
int right_y = sample_to_y(recorded_sample[x].right);
|
||||
|
||||
|
|
|
@ -62,8 +62,8 @@ private:
|
|||
void remove_dead_buffers();
|
||||
|
||||
bool m_paused { true };
|
||||
int m_next_ptr { 0 };
|
||||
int m_last_seek { 0 };
|
||||
size_t m_next_ptr { 0 };
|
||||
size_t m_last_seek { 0 };
|
||||
float m_total_length { 0 };
|
||||
OwnPtr<Audio::WavLoader> m_loader { nullptr };
|
||||
NonnullRefPtr<Audio::ClientConnection> m_connection;
|
||||
|
|
|
@ -62,7 +62,7 @@ Vector<char const*> PowerDialog::show()
|
|||
PowerDialog::PowerDialog()
|
||||
: GUI::Dialog(nullptr)
|
||||
{
|
||||
Gfx::Rect rect({ 0, 0, 180, 180 + ((options.size() - 3) * 16) });
|
||||
Gfx::Rect rect({ 0, 0, 180, 180 + ((static_cast<int>(options.size()) - 3) * 16) });
|
||||
rect.center_within(GUI::Desktop::the().rect());
|
||||
set_rect(rect);
|
||||
set_resizable(false);
|
||||
|
@ -83,7 +83,7 @@ PowerDialog::PowerDialog()
|
|||
header->set_font(Gfx::Font::default_bold_font());
|
||||
|
||||
int selected = -1;
|
||||
for (int i = 0; i < options.size(); i++) {
|
||||
for (size_t i = 0; i < options.size(); i++) {
|
||||
auto action = options[i];
|
||||
auto radio = main->add<GUI::RadioButton>();
|
||||
radio->set_enabled(action.enabled);
|
||||
|
|
|
@ -62,7 +62,7 @@ void TextWidget::paint_event(GUI::PaintEvent& event)
|
|||
if (frame_thickness() > 0)
|
||||
indent = font().glyph_width('x') / 2;
|
||||
|
||||
for (int i = 0; i < m_lines.size(); i++) {
|
||||
for (size_t i = 0; i < m_lines.size(); i++) {
|
||||
auto& line = m_lines[i];
|
||||
|
||||
auto text_rect = frame_inner_rect();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue