From 30ea4801357323e82b4de0eae387e9018aacdad5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= Date: Sat, 15 Jul 2023 01:42:39 +0200 Subject: [PATCH] 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: https://github.com/nodejs/node/pull/48677 PR-URL: https://github.com/nodejs/node/pull/48770 Reviewed-By: Rafael Gonzaga Reviewed-By: Luigi Pinca Reviewed-By: Yagiz Nizipli --- src/permission/fs_permission.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/permission/fs_permission.cc b/src/permission/fs_permission.cc index 7ae4a93fc4fcb4..a02f95ea55f3a2 100644 --- a/src/permission/fs_permission.cc +++ b/src/permission/fs_permission.cc @@ -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) { @@ -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",