AK: Make Vector use size_t for its size and capacity

This commit is contained in:
Andreas Kling 2020-02-25 14:49:47 +01:00
parent 9c6f7d3e7d
commit ceec1a7d38
Notes: sideshowbarker 2024-07-19 09:04:32 +09:00
94 changed files with 323 additions and 317 deletions

View file

@ -44,7 +44,7 @@ ModelIndex FileSystemModel::Node::index(const FileSystemModel& model, int column
{
if (!parent)
return {};
for (int row = 0; row < parent->children.size(); ++row) {
for (size_t row = 0; row < parent->children.size(); ++row) {
if (&parent->children[row] == this)
return model.create_index(row, column, const_cast<Node*>(this));
}
@ -169,7 +169,7 @@ ModelIndex FileSystemModel::index(const StringView& path, int column) const
const Node* node = m_root;
if (canonical_path.string() == "/")
return m_root->index(*this, column);
for (int i = 0; i < canonical_path.parts().size(); ++i) {
for (size_t i = 0; i < canonical_path.parts().size(); ++i) {
auto& part = canonical_path.parts()[i];
bool found = false;
for (auto& child : node->children) {
@ -318,7 +318,7 @@ ModelIndex FileSystemModel::index(int row, int column, const ModelIndex& parent)
return {};
auto& node = this->node(parent);
const_cast<Node&>(node).reify_if_needed(*this);
if (row >= node.children.size())
if (static_cast<size_t>(row) >= node.children.size())
return {};
return create_index(row, column, &node.children[row]);
}