News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

question on the GetDeepestMatchingPosition function

Started by ollydbg, March 03, 2009, 03:34:16 PM

Previous topic - Next topic

ollydbg

This is a bit strange.

inline unsigned int SearchTreeNode::GetDeepestMatchingPosition(BasicSearchTree* tree, const wxString& s,unsigned int StringStartDepth)

I carefully examined the code, I found that the above function will always be called with the parameter StringStartDepth==0.

The only existence of this call is in FindNode().

bool BasicSearchTree::FindNode(const wxString& s, nSearchTreeNode nparent, SearchTreePoint* result)
{
        size_t top_depth = m_pNodes[nparent]->GetDepth();
       ......
        unsigned int newdepth = childnode->GetDeepestMatchingPosition(this,s,top_depth);
       ......
}


But all the FindNode() function was used like below( the second parameter is always 0 )


FindNode(s, 0, &resultpos)


So, the root node's parent is itself. and its depth is surely zero.


Any comments?  Thanks.


If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.