Skip to content

Commit

Permalink
permission: fix data types in PrintTree
Browse files Browse the repository at this point in the history
* 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: nodejs#48677
PR-URL: nodejs#48770
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
  • Loading branch information
tniessen authored and Ceres6 committed Aug 14, 2023
1 parent c85df4e commit 6d53d0e
Showing 1 changed file with 3 additions and 3 deletions.
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

0 comments on commit 6d53d0e

Please sign in to comment.