diff --git a/src/permission/fs_permission.cc b/src/permission/fs_permission.cc index fadf75968c779d..7a073f99a49440 100644 --- a/src/permission/fs_permission.cc +++ b/src/permission/fs_permission.cc @@ -56,7 +56,7 @@ bool is_tree_granted(node::permission::FSPermission::RadixTree* granted_tree, // is UNC file path if (param.rfind("\\\\", 0) == 0) { // return lookup with normalized param - int starting_pos = 4; // "\\?\" + size_t starting_pos = 4; // "\\?\" if (param.rfind("\\\\?\\UNC\\") == 0) { starting_pos += 4; // "UNC\" } @@ -176,7 +176,7 @@ bool FSPermission::RadixTree::Lookup(const std::string_view& s, if (current_node->children.size() == 0) { return when_empty_return; } - unsigned int parent_node_prefix_len = current_node->prefix.length(); + size_t parent_node_prefix_len = current_node->prefix.length(); const std::string path(s); auto path_len = path.length(); @@ -202,10 +202,10 @@ bool FSPermission::RadixTree::Lookup(const std::string_view& s, void FSPermission::RadixTree::Insert(const std::string& path) { FSPermission::RadixTree::Node* current_node = root_node_; - unsigned int parent_node_prefix_len = current_node->prefix.length(); - int path_len = path.length(); + size_t parent_node_prefix_len = current_node->prefix.length(); + size_t path_len = path.length(); - for (int i = 1; i <= path_len; ++i) { + for (size_t i = 1; i <= path_len; ++i) { bool is_wildcard_node = path[i - 1] == '*'; bool is_last_char = i == path_len; diff --git a/src/permission/fs_permission.h b/src/permission/fs_permission.h index 80374a08c75d26..74b1440536652a 100644 --- a/src/permission/fs_permission.h +++ b/src/permission/fs_permission.h @@ -45,8 +45,8 @@ class FSPermission final : public PermissionBase { } // swap prefix - unsigned int i = 0; - unsigned int prefix_len = prefix.length(); + size_t i = 0; + size_t prefix_len = prefix.length(); for (; i < child->prefix.length(); ++i) { if (i > prefix_len || prefix[i] != child->prefix[i]) { std::string parent_prefix = child->prefix.substr(0, i); @@ -72,7 +72,7 @@ class FSPermission final : public PermissionBase { return wildcard_child; } - Node* NextNode(const std::string& path, unsigned int idx) { + Node* NextNode(const std::string& path, size_t idx) { if (idx >= path.length()) { return nullptr; } @@ -83,8 +83,8 @@ class FSPermission final : public PermissionBase { } auto child = it->second; // match prefix - unsigned int prefix_len = child->prefix.length(); - for (unsigned int i = 0; i < path.length(); ++i) { + size_t prefix_len = child->prefix.length(); + for (size_t i = 0; i < path.length(); ++i) { if (i >= prefix_len || child->prefix[i] == '*') { return child; }