darlinghq / darling-dmg

FUSE module for .dmg files (containing an HFS+ filesystem)
http://www.darlinghq.org
GNU General Public License v3.0
278 stars 45 forks source link

HFSCatalogBTree::stat didn't follow node forward link, missing some files. #80

Closed jief666 closed 6 years ago

jief666 commented 6 years ago

To find a record, it may be needed to traverse node forward link like HFSBTree::findLeafNodes does.

HFSCatalogBTree::stat now follow the same logic (logic that was moved in HFSCatalogBTree::findHFSPlusCatalogFileOrFolderForParentIdAndName), HFSCatalogBTree::findLeafNodes, then looking for record in all these leaves and checking that no more than one is found.

To avoid memory problem like I had, I switched to return std::shared_ptr instead of HFSBTreeNode, and std::shared_ptr instead of HFSPlusCatalogFileOrFolder (these shared ptr retain the node while exposing the record). This also avoid a lot of copy constructor.

tomkoen commented 6 years ago

@jief666 extern int mustbreak; ??

jief666 commented 6 years ago

A debug leftover, sorry. I always use this kind of things to conditionally break, for example in HFSBTreeNode::traverseTree, when a condition was true in another method, for example in HFSCatalogBTree::stat (path==[somthing]).