Cut core/view and shell/view comment bloat ~65% (comments only, zero code change)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// view_tree — pure folder-depth walk. See view_tree.h.
|
||||
// See view_tree.h.
|
||||
|
||||
#include "core/view/view_tree.h"
|
||||
|
||||
@@ -8,11 +8,8 @@ FolderTree buildFolderTree(const std::vector<TrackFolderEntry>& entries) {
|
||||
FolderTree tree;
|
||||
tree.nodes.reserve(entries.size());
|
||||
|
||||
// Stack of currently-open folder-parent GUIDs. The top is the immediate parent
|
||||
// of the next track. A folder-parent track opens its folder AFTER contributing
|
||||
// its own node (its own parent is the enclosing folder), so the push trails the
|
||||
// assignment. A closing track belongs to the folder it closes, so the pop also
|
||||
// trails the assignment.
|
||||
// Stack of open folder-parent GUIDs; top is the next track's parent. A
|
||||
// folder-parent's push and a closer's pop both trail their own assignment.
|
||||
std::vector<std::string> open;
|
||||
|
||||
for (const TrackFolderEntry& e : entries) {
|
||||
@@ -23,11 +20,8 @@ FolderTree buildFolderTree(const std::vector<TrackFolderEntry>& entries) {
|
||||
tree.nodes.push_back(node);
|
||||
|
||||
if (e.folderDepth == 1) {
|
||||
open.push_back(e.guid); // this track's folder opens for what follows
|
||||
open.push_back(e.guid);
|
||||
} else if (e.folderDepth < 0) {
|
||||
// Closes |folderDepth| levels after this (already-assigned) track.
|
||||
// Clamp to the stack size so a malformed/stale depth stream can't
|
||||
// underflow — the walk stays total.
|
||||
int levels = -e.folderDepth;
|
||||
while (levels-- > 0 && !open.empty()) {
|
||||
open.pop_back();
|
||||
|
||||
Reference in New Issue
Block a user