Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

permission: fix data types in PrintTree #48770

Merged
merged 1 commit into from
Jul 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
permission: fix data types in PrintTree
* The first argument `node` should be a const pointer.
* The second argument `spaces` should not be a signed integer type.
* The local variable `child` should be size_t.
* The local variable `pair` in the range declaration should be a
  reference type to avoid copying the object.

Refs: #48677
  • Loading branch information
tniessen committed Jul 14, 2023
commit 024af0850011e01d45e03a6a1aa802c0ab45a7a2
6 changes: 3 additions & 3 deletions src/permission/fs_permission.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ namespace node {

namespace permission {

void PrintTree(FSPermission::RadixTree::Node* node, int spaces = 0) {
void PrintTree(const FSPermission::RadixTree::Node* node, size_t spaces = 0) {
std::string whitespace(spaces, ' ');

if (node == nullptr) {
Expand All @@ -90,8 +90,8 @@ void PrintTree(FSPermission::RadixTree::Node* node, int spaces = 0) {
whitespace,
node->prefix);
if (node->children.size()) {
int child = 0;
for (const auto pair : node->children) {
size_t child = 0;
for (const auto& pair : node->children) {
++child;
per_process::Debug(DebugCategory::PERMISSION_MODEL,
"%s Child(%s): %s\n",
Expand Down
Loading