summaryrefslogtreecommitdiff
path: root/jni/node.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'jni/node.cpp')
-rw-r--r--jni/node.cpp29
1 files changed, 8 insertions, 21 deletions
diff --git a/jni/node.cpp b/jni/node.cpp
index 6c530cbcd..8898b7b5b 100644
--- a/jni/node.cpp
+++ b/jni/node.cpp
@@ -41,33 +41,20 @@ namespace mediaprovider {
namespace fuse {
// Assumes that |node| has at least one child.
-void node::BuildPathForNodeRecursive(bool safe, const node* node, std::stringstream* path) {
- if (node->parent_) {
- BuildPathForNodeRecursive(safe, node->parent_, path);
- }
+void node::BuildPathForNodeRecursive(node* node, std::string* path) {
+ if (node->parent_) BuildPathForNodeRecursive(node->parent_, path);
- if (safe && node->parent_) {
- (*path) << reinterpret_cast<uintptr_t>(node);
- } else {
- (*path) << node->GetName();
- }
- (*path) << "/";
+ (*path) += node->GetName() + "/";
}
std::string node::BuildPath() const {
std::lock_guard<std::recursive_mutex> guard(*lock_);
- std::stringstream path;
-
- BuildPathForNodeRecursive(false, this, &path);
- return path.str();
-}
-
-std::string node::BuildSafePath() const {
- std::lock_guard<std::recursive_mutex> guard(*lock_);
- std::stringstream path;
+ std::string path;
- BuildPathForNodeRecursive(true, this, &path);
- return path.str();
+ path.reserve(PATH_MAX);
+ if (parent_) BuildPathForNodeRecursive(parent_, &path);
+ path += name_;
+ return path;
}
const node* node::LookupAbsolutePath(const node* root, const std::string& absolute_path) {